Drawing on top of controls inside a panel (C# WinForms)

前端 未结 10 2269
暖寄归人
暖寄归人 2020-11-29 22:27

I know this question had been asked more than a few times, but so far I haven\'t been able to find a good solution for it.

I\'ve got a panel with other control on it

10条回答
  •  伪装坚强ぢ
    2020-11-29 22:42

    I think the best way is to inherit the control of which you want to draw a line on. Override the OnPaint method, call base.Paint() from within, after that draw the line using the same graphic instance. At the same time, you can also have a parameter which specific at which point the line should be draw, so that you can control the line directly from your main form.

提交回复
热议问题