GraphicCommons.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:beremiz 作者: nucleron 项目源码 文件源码
def Draw(self, dc):
        if not getattr(dc, "printing", False):
            if self.Highlighted:
                self.DrawHighlightment(dc)
            if self.Selected:
                scalex, scaley = dc.GetUserScale()
                dc.SetUserScale(1, 1)
                dc.SetPen(MiterPen(wx.BLACK))
                dc.SetBrush(wx.BLACK_BRUSH)

                left = (self.BoundingBox.x - 2) * scalex - HANDLE_SIZE
                center = (self.BoundingBox.x + self.BoundingBox.width / 2) * scalex - HANDLE_SIZE / 2
                right = (self.BoundingBox.x + self.BoundingBox.width + 2) * scalex

                top = (self.BoundingBox.y - 2) * scaley - HANDLE_SIZE
                middle = (self.BoundingBox.y + self.BoundingBox.height / 2) * scaley - HANDLE_SIZE / 2
                bottom = (self.BoundingBox.y + self.BoundingBox.height + 2) * scaley

                for x, y in [(left, top), (center, top), (right, top),
                             (left, middle), (right, middle),
                             (left, bottom), (center, bottom), (right, bottom)]:
                    dc.DrawRectangle(x, y, HANDLE_SIZE, HANDLE_SIZE)

                dc.SetUserScale(scalex, scaley)


# -------------------------------------------------------------------------------
#                           Group of graphic elements
# -------------------------------------------------------------------------------
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号