示例#1
0
    def Draw(self, dc: DC, withChildren: bool = True):
        """
        Draw the text on the dc.

        Args:
            dc
            withChildren
        """
        if self._visible:
            RectangleShape.Draw(self, dc, False)
            dc.SetTextForeground(self._color)
            dc.SetBackgroundMode(PENSTYLE_SOLID)
            dc.SetTextBackground(self._textBack)
            x, y = self.GetPosition()

            # to draw the text shape with its own font size
            saveFont: Font = dc.GetFont()
            if self.GetFont() is not None:
                dc.SetFont(self.GetFont())

            dc.DrawText(self._text, x, y)
            dc.SetFont(saveFont)

            if withChildren:
                self.DrawChildren(dc)
示例#2
0
    def Draw(self, dc, withChildren=True):
        """
        Draw the shape on the dc.

        @param  dc
        @param withChildren
        """
        if self._visible:
            RectangleShape.Draw(self, dc, False)
            for shape in self._vShapes:
                shape.Draw(dc, self._x, self._y, self._scale)
            if withChildren:
                self.DrawChildren(dc)