-
April 27th, 2016, 12:51 PM
#1
Picturebox
Hello all,
So im trying to figure out how to draw a line on a form that will lay over top a picture box. Im using an image
in a picture box and want to draw a line which will go over the top. Right now I can draw a line that goes the
form but is drawn behind the picture box. Any way to bring it to the front? This is the code for my line.
Code:
protected override void OnPaint(PaintEventArgs e)//draw line
{
Pen pen = new Pen(Color.FromArgb(255, 0, 0, 0));
e.Graphics.DrawLine(pen, 100, 100, 300, 500);
}
and help is greatly appreciated.
thanks
-
April 27th, 2016, 02:47 PM
#2
Re: Picturebox
You could use a second pictureBox/label/etc with a .BackgroundColor, and then just set .Location and .Size according to needs, and even change .Visible or .SendToBack() or .BringToFront().
-
April 28th, 2016, 08:58 AM
#3
Re: Picturebox
Thanks much
-
April 28th, 2016, 12:18 PM
#4
Re: Picturebox
Same thread but similar question...hope its ok.
So I created a plane which is 250 x 250. Im trying to draw a line at an angle. So lets say for example I want to draw a 45 degree angle from center which is 125, 125 on the plane. I know using x1 = x + cos(angle)*length and
y1 = y + Sin(angle) * length gives you the end points but if the length is too long it scales off the plane which makes the line look wrong. Is there a way to do it without using length ? I basically want to just input degrees and have a line show on a plane that is at that angle from center.
thanks much for any help.
-
May 6th, 2016, 10:16 AM
#5
Re: Picturebox
Check out:
Drawing on picture box images D*****hka Madushan lk, 24 Jan 2012
http://www.codeproject.com/Tips/3189...ure-box-images
mpliam
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|