Aryo1
asked on
Draw a Line over child control such PictureBox or Group Box using C#
Hi Experts,
How do I draw line over a control ?
Let say like this, I have a Windows Forms, and top of it there are GroupBox and on top of GroupBox there are PictureBox.
And how do I draw a line over GroupBox and PictureBox ?
How do I draw line over a control ?
Let say like this, I have a Windows Forms, and top of it there are GroupBox and on top of GroupBox there are PictureBox.
And how do I draw a line over GroupBox and PictureBox ?
Maybe these controls fit your needs:
http://www.codeproject.com/useritems/Line_Control.asp
http://www.codeproject.com/cs/miscctrl/csLineControlWithRotateOp.asp
http://www.codeproject.com/useritems/Line_Control.asp
http://www.codeproject.com/cs/miscctrl/csLineControlWithRotateOp.asp
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@Idle_Mind
Thx, it seems your solutions can answers my problems.
BTW, Do you have suggestion where should I put this code ?
On Form_Paint or everytime there is change in UI (such as moving some control) ?
Thx, it seems your solutions can answers my problems.
BTW, Do you have suggestion where should I put this code ?
On Form_Paint or everytime there is change in UI (such as moving some control) ?
Well...a "catch all" approach would be to use the IMessageFilter() Interface and repaint the line whenever ANY control in your app gets a WM_PAINT message. If your app is partially obscured though you could end up drawing a line over another apps window since we are drawing with the desktop DC.
Here is an example of IMessageFilter being used:
https://www.experts-exchange.com/questions/22696110/Move-label-with-cursor-location.html
Here is an example of IMessageFilter being used:
https://www.experts-exchange.com/questions/22696110/Move-label-with-cursor-location.html
Open in new window