How to overlap two controls

2019-07-17 06:29发布

I have a Circle and a Line control. Circle control's OnPaint draws a circle and Line control's one draws a line. These two controls are contained in another control (DrawingControl). I need to put a Line over a Circle, but Circle's background deletes the Line. I tried enabling transparency and overriding Circle's OnPaintBackground method, but it doesn't seem to work. Do you have any ideas? Thanks.

2条回答
迷人小祖宗
2楼-- · 2019-07-17 06:38

Does this tutorial help? It consists of three steps: Enabling transparency, overriding OnPaintBackground and overriding OnMove

查看更多
乱世女痞
3楼-- · 2019-07-17 06:38

See this answer about creating a diagonal-line control. This technique does not require using transparency, but instead uses an irregularly-shaped region. Creating a circle control this way would be a little more complicated than the line example, since you'll need to use bezier curves instead of line segments in order to create a smooth circle.

查看更多
登录 后发表回答