Drawing Lines in Autoscroll form c#









up vote
1
down vote

favorite












I just want to transform the points when scrolling. I already use the e.Graphics.TranslateTransform() but it only works on drawing. The point of the line wont change the offset.



 private void Form1_Scroll(object sender, ScrollEventArgs e)

Point scrollOffset = this.AutoScrollPosition;

for (int lk = 0; lk < Pt1.Count; lk++)

Pt1[lk] = new Point(Pt1[lk].X + scrollOffset.X, Pt1[lk].Y + scrollOffset.Y);
Pt2[lk] = new Point(Pt2[lk].X + scrollOffset.X, Pt2[lk].Y + scrollOffset.Y);

this.Invalidate();
this.Update();
this.Refresh();

private void Form1_Paint(object sender, PaintEventArgs e)

Point scrollOffset = this.AutoScrollPosition;
e.Graphics.TranslateTransform(scrollOffset.X, scrollOffset.Y);
e.Graphics.Clear(this.BackColor);
e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
Pen greenPen = new Pen(Color.Green,1);
greenPen.DashPattern = new float 5.0F, 5.0F, 5.0F, 5.0F ;
Pen red = new Pen(Color.Red,1);
red.DashPattern = new float 5.0F, 5.0F, 5.0F, 5.0F ;
Pen Grey = new Pen(Color.Gray,1);
Grey.DashPattern = new float 5.0F, 5.0F, 5.0F, 5.0F ;
#region "Draw Line using cursor"
Pen SolidGreen = new Pen(Color.Green, 1);
Pen SolidGrey = new Pen(Color.Gray, 1);
Pen Red = new Pen(Color.Red, 1);

for (int pl = 0; pl < Pt1j.Count; pl++)


PointF pointsj = new PointF

new PointF(Pt2j[pl].X, Pt2j[pl].Y),
new PointF(Pt3j[pl].X , Pt3j[pl].Y),
new PointF(Pt4j[pl].X , Pt4j[pl].Y),
new PointF(Pt5j[pl].X , Pt5j[pl].Y),
;
e.Graphics.DrawLine(Pens.Green, Pt1j[pl].X , Pt1j[pl].Y, Pt2j[pl].X, Pt2j[pl].Y);
e.Graphics.DrawCurve(Pens.Green, pointsj);
e.Graphics.DrawLine(Pens.Green, Pt5j[pl].X , Pt5j[pl].Y, Pt6j[pl].X, Pt6j[pl].Y);

for (int pl = 0; pl < Pt1DashedGray.Count; pl++)

e.Graphics.DrawLine(Grey, Pt1DashedGray[pl], Pt2DashedGray[pl]);
PointF pointsdhg = new PointF

new PointF(Pt2DashedGray[pl].X, Pt2DashedGray[pl].Y),
new PointF(Pt3DashedGray[pl].X, Pt3DashedGray[pl].Y),
new PointF(Pt4DashedGray[pl].X, Pt4DashedGray[pl].Y),
new PointF(Pt5DashedGray[pl].X, Pt5DashedGray[pl].Y),
;
e.Graphics.DrawCurve(Grey, pointsdhg);
e.Graphics.DrawLine(Grey, Pt5DashedGray[pl], Pt6DashedGray[pl]);

for (int pl = 0; pl < Pt1SolidGray.Count; pl++)

e.Graphics.DrawLine(SolidGrey, Pt1SolidGray[pl], Pt2SolidGray[pl]);
PointF pointsdhg = new PointF

new PointF(Pt2SolidGray[pl].X, Pt2SolidGray[pl].Y),
new PointF(Pt3SolidGray[pl].X, Pt3SolidGray[pl].Y),
new PointF(Pt4SolidGray[pl].X, Pt4SolidGray[pl].Y),
new PointF(Pt5SolidGray[pl].X, Pt5SolidGray[pl].Y),
;
e.Graphics.DrawCurve(SolidGrey, pointsdhg);
e.Graphics.DrawLine(SolidGrey, Pt5SolidGray[pl], Pt6SolidGray[pl]);




for (int pl = 0; pl < Pt1DashGreen.Count; pl++)

e.Graphics.DrawLine(greenPen, Pt1DashGreen[pl], Pt2DashGreen[pl]);
PointF pointsdhg = new PointF

new PointF(Pt2DashGreen[pl].X, Pt2DashGreen[pl].Y),
new PointF(Pt3DashGreen[pl].X, Pt3DashGreen[pl].Y),
new PointF(Pt4DashGreen[pl].X, Pt4DashGreen[pl].Y),
new PointF(Pt5DashGreen[pl].X, Pt5DashGreen[pl].Y),
;
e.Graphics.DrawCurve(greenPen, pointsdhg);
e.Graphics.DrawLine(greenPen, Pt5DashGreen[pl], Pt6DashGreen[pl]);


for (int i = 0; i < Pt1.Count; i++)

e.Graphics.DrawLine(SolidGreen, Pt1[i], Pt2[i]);

for (int l = 0; l < DashedGreen1.Count; l++)

e.Graphics.DrawLine(greenPen, DashedGreen1[l], DashedGreen2[l]);


for (int k = 0; k < SolidGrey1.Count; k++)

e.Graphics.DrawLine(SolidGrey, SolidGrey1[k], SolidGrey2[k]);

for (int j = 0; j < DashedGrey1.Count; j++)

e.Graphics.DrawLine(Grey, DashedGrey1[j], DashedGrey2[j]);

if (IsDrawing)

e.Graphics.DrawLine(Red, NewPt1.X, NewPt1.Y, NewPt2.X, NewPt2.Y);

if (Draw_Dashed_Green)

e.Graphics.DrawLine(red, DashedGreenPT1, DashedGreenPT2);

if (Draw_Solid_Grey)

e.Graphics.DrawLine(Red, SolidGreyPT1, SolidGreyPT2);

if (Draw_dashed_Grey)

e.Graphics.DrawLine(red, DashedGreyPT1, DashedGreyPT2);




Need Help
Here is my code so far.
BDW, The point of the line is stored in the list from.
The Drawn lines in Paint event also include the line jumpers which has 6 points on it to make a jumps.



So the only problem is I would like to change the Points of the lines as I use the scroll bar.
Thanks for answering my question.










share|improve this question























  • Can you explain what is the effect that you looking for? Are you trying to move the lines position on the surface using the Scrollbars? Or keep them steady? The AutoScrollPosition reports negative values. (Btw, you just need Invalidate())
    – Jimi
    Nov 9 at 6:34










  • Uhmmm ... I would like to move the lines position when using the scrollbar. I already use Invalidate() and I put the e.Graphics.TranslateTransform() in the paint event and it works. But the only problem is the point didnt move , only the drawn lines.
    – jayromel lawas
    Nov 9 at 7:44










  • Then post the Paint event code. As it is, this is very uncleary to me what you're trying to achieve. Also because, as I said before AutoScrollPosition gives negative values. Then, I already use Invalidate(). I meant you need Invalidate() alone. Adding Update() and Refresh() causes a second repaint for each Scroll() event change.
    – Jimi
    Nov 9 at 7:51










  • private void Form1_Paint(object sender, PaintEventArgs e) { Point scrollOffset = this.AutoScrollPosition; e.Graphics.TranslateTransform(scrollOffset.X, scrollOffset.Y); e.Graphics.Clear(this.BackColor);
    – jayromel lawas
    Nov 9 at 8:16










  • Nope, you need to Edit your question, adding any code snippet or description that can further explain your case. Don't insert code in comments.
    – Jimi
    Nov 9 at 8:18














up vote
1
down vote

favorite












I just want to transform the points when scrolling. I already use the e.Graphics.TranslateTransform() but it only works on drawing. The point of the line wont change the offset.



 private void Form1_Scroll(object sender, ScrollEventArgs e)

Point scrollOffset = this.AutoScrollPosition;

for (int lk = 0; lk < Pt1.Count; lk++)

Pt1[lk] = new Point(Pt1[lk].X + scrollOffset.X, Pt1[lk].Y + scrollOffset.Y);
Pt2[lk] = new Point(Pt2[lk].X + scrollOffset.X, Pt2[lk].Y + scrollOffset.Y);

this.Invalidate();
this.Update();
this.Refresh();

private void Form1_Paint(object sender, PaintEventArgs e)

Point scrollOffset = this.AutoScrollPosition;
e.Graphics.TranslateTransform(scrollOffset.X, scrollOffset.Y);
e.Graphics.Clear(this.BackColor);
e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
Pen greenPen = new Pen(Color.Green,1);
greenPen.DashPattern = new float 5.0F, 5.0F, 5.0F, 5.0F ;
Pen red = new Pen(Color.Red,1);
red.DashPattern = new float 5.0F, 5.0F, 5.0F, 5.0F ;
Pen Grey = new Pen(Color.Gray,1);
Grey.DashPattern = new float 5.0F, 5.0F, 5.0F, 5.0F ;
#region "Draw Line using cursor"
Pen SolidGreen = new Pen(Color.Green, 1);
Pen SolidGrey = new Pen(Color.Gray, 1);
Pen Red = new Pen(Color.Red, 1);

for (int pl = 0; pl < Pt1j.Count; pl++)


PointF pointsj = new PointF

new PointF(Pt2j[pl].X, Pt2j[pl].Y),
new PointF(Pt3j[pl].X , Pt3j[pl].Y),
new PointF(Pt4j[pl].X , Pt4j[pl].Y),
new PointF(Pt5j[pl].X , Pt5j[pl].Y),
;
e.Graphics.DrawLine(Pens.Green, Pt1j[pl].X , Pt1j[pl].Y, Pt2j[pl].X, Pt2j[pl].Y);
e.Graphics.DrawCurve(Pens.Green, pointsj);
e.Graphics.DrawLine(Pens.Green, Pt5j[pl].X , Pt5j[pl].Y, Pt6j[pl].X, Pt6j[pl].Y);

for (int pl = 0; pl < Pt1DashedGray.Count; pl++)

e.Graphics.DrawLine(Grey, Pt1DashedGray[pl], Pt2DashedGray[pl]);
PointF pointsdhg = new PointF

new PointF(Pt2DashedGray[pl].X, Pt2DashedGray[pl].Y),
new PointF(Pt3DashedGray[pl].X, Pt3DashedGray[pl].Y),
new PointF(Pt4DashedGray[pl].X, Pt4DashedGray[pl].Y),
new PointF(Pt5DashedGray[pl].X, Pt5DashedGray[pl].Y),
;
e.Graphics.DrawCurve(Grey, pointsdhg);
e.Graphics.DrawLine(Grey, Pt5DashedGray[pl], Pt6DashedGray[pl]);

for (int pl = 0; pl < Pt1SolidGray.Count; pl++)

e.Graphics.DrawLine(SolidGrey, Pt1SolidGray[pl], Pt2SolidGray[pl]);
PointF pointsdhg = new PointF

new PointF(Pt2SolidGray[pl].X, Pt2SolidGray[pl].Y),
new PointF(Pt3SolidGray[pl].X, Pt3SolidGray[pl].Y),
new PointF(Pt4SolidGray[pl].X, Pt4SolidGray[pl].Y),
new PointF(Pt5SolidGray[pl].X, Pt5SolidGray[pl].Y),
;
e.Graphics.DrawCurve(SolidGrey, pointsdhg);
e.Graphics.DrawLine(SolidGrey, Pt5SolidGray[pl], Pt6SolidGray[pl]);




for (int pl = 0; pl < Pt1DashGreen.Count; pl++)

e.Graphics.DrawLine(greenPen, Pt1DashGreen[pl], Pt2DashGreen[pl]);
PointF pointsdhg = new PointF

new PointF(Pt2DashGreen[pl].X, Pt2DashGreen[pl].Y),
new PointF(Pt3DashGreen[pl].X, Pt3DashGreen[pl].Y),
new PointF(Pt4DashGreen[pl].X, Pt4DashGreen[pl].Y),
new PointF(Pt5DashGreen[pl].X, Pt5DashGreen[pl].Y),
;
e.Graphics.DrawCurve(greenPen, pointsdhg);
e.Graphics.DrawLine(greenPen, Pt5DashGreen[pl], Pt6DashGreen[pl]);


for (int i = 0; i < Pt1.Count; i++)

e.Graphics.DrawLine(SolidGreen, Pt1[i], Pt2[i]);

for (int l = 0; l < DashedGreen1.Count; l++)

e.Graphics.DrawLine(greenPen, DashedGreen1[l], DashedGreen2[l]);


for (int k = 0; k < SolidGrey1.Count; k++)

e.Graphics.DrawLine(SolidGrey, SolidGrey1[k], SolidGrey2[k]);

for (int j = 0; j < DashedGrey1.Count; j++)

e.Graphics.DrawLine(Grey, DashedGrey1[j], DashedGrey2[j]);

if (IsDrawing)

e.Graphics.DrawLine(Red, NewPt1.X, NewPt1.Y, NewPt2.X, NewPt2.Y);

if (Draw_Dashed_Green)

e.Graphics.DrawLine(red, DashedGreenPT1, DashedGreenPT2);

if (Draw_Solid_Grey)

e.Graphics.DrawLine(Red, SolidGreyPT1, SolidGreyPT2);

if (Draw_dashed_Grey)

e.Graphics.DrawLine(red, DashedGreyPT1, DashedGreyPT2);




Need Help
Here is my code so far.
BDW, The point of the line is stored in the list from.
The Drawn lines in Paint event also include the line jumpers which has 6 points on it to make a jumps.



So the only problem is I would like to change the Points of the lines as I use the scroll bar.
Thanks for answering my question.










share|improve this question























  • Can you explain what is the effect that you looking for? Are you trying to move the lines position on the surface using the Scrollbars? Or keep them steady? The AutoScrollPosition reports negative values. (Btw, you just need Invalidate())
    – Jimi
    Nov 9 at 6:34










  • Uhmmm ... I would like to move the lines position when using the scrollbar. I already use Invalidate() and I put the e.Graphics.TranslateTransform() in the paint event and it works. But the only problem is the point didnt move , only the drawn lines.
    – jayromel lawas
    Nov 9 at 7:44










  • Then post the Paint event code. As it is, this is very uncleary to me what you're trying to achieve. Also because, as I said before AutoScrollPosition gives negative values. Then, I already use Invalidate(). I meant you need Invalidate() alone. Adding Update() and Refresh() causes a second repaint for each Scroll() event change.
    – Jimi
    Nov 9 at 7:51










  • private void Form1_Paint(object sender, PaintEventArgs e) { Point scrollOffset = this.AutoScrollPosition; e.Graphics.TranslateTransform(scrollOffset.X, scrollOffset.Y); e.Graphics.Clear(this.BackColor);
    – jayromel lawas
    Nov 9 at 8:16










  • Nope, you need to Edit your question, adding any code snippet or description that can further explain your case. Don't insert code in comments.
    – Jimi
    Nov 9 at 8:18












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I just want to transform the points when scrolling. I already use the e.Graphics.TranslateTransform() but it only works on drawing. The point of the line wont change the offset.



 private void Form1_Scroll(object sender, ScrollEventArgs e)

Point scrollOffset = this.AutoScrollPosition;

for (int lk = 0; lk < Pt1.Count; lk++)

Pt1[lk] = new Point(Pt1[lk].X + scrollOffset.X, Pt1[lk].Y + scrollOffset.Y);
Pt2[lk] = new Point(Pt2[lk].X + scrollOffset.X, Pt2[lk].Y + scrollOffset.Y);

this.Invalidate();
this.Update();
this.Refresh();

private void Form1_Paint(object sender, PaintEventArgs e)

Point scrollOffset = this.AutoScrollPosition;
e.Graphics.TranslateTransform(scrollOffset.X, scrollOffset.Y);
e.Graphics.Clear(this.BackColor);
e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
Pen greenPen = new Pen(Color.Green,1);
greenPen.DashPattern = new float 5.0F, 5.0F, 5.0F, 5.0F ;
Pen red = new Pen(Color.Red,1);
red.DashPattern = new float 5.0F, 5.0F, 5.0F, 5.0F ;
Pen Grey = new Pen(Color.Gray,1);
Grey.DashPattern = new float 5.0F, 5.0F, 5.0F, 5.0F ;
#region "Draw Line using cursor"
Pen SolidGreen = new Pen(Color.Green, 1);
Pen SolidGrey = new Pen(Color.Gray, 1);
Pen Red = new Pen(Color.Red, 1);

for (int pl = 0; pl < Pt1j.Count; pl++)


PointF pointsj = new PointF

new PointF(Pt2j[pl].X, Pt2j[pl].Y),
new PointF(Pt3j[pl].X , Pt3j[pl].Y),
new PointF(Pt4j[pl].X , Pt4j[pl].Y),
new PointF(Pt5j[pl].X , Pt5j[pl].Y),
;
e.Graphics.DrawLine(Pens.Green, Pt1j[pl].X , Pt1j[pl].Y, Pt2j[pl].X, Pt2j[pl].Y);
e.Graphics.DrawCurve(Pens.Green, pointsj);
e.Graphics.DrawLine(Pens.Green, Pt5j[pl].X , Pt5j[pl].Y, Pt6j[pl].X, Pt6j[pl].Y);

for (int pl = 0; pl < Pt1DashedGray.Count; pl++)

e.Graphics.DrawLine(Grey, Pt1DashedGray[pl], Pt2DashedGray[pl]);
PointF pointsdhg = new PointF

new PointF(Pt2DashedGray[pl].X, Pt2DashedGray[pl].Y),
new PointF(Pt3DashedGray[pl].X, Pt3DashedGray[pl].Y),
new PointF(Pt4DashedGray[pl].X, Pt4DashedGray[pl].Y),
new PointF(Pt5DashedGray[pl].X, Pt5DashedGray[pl].Y),
;
e.Graphics.DrawCurve(Grey, pointsdhg);
e.Graphics.DrawLine(Grey, Pt5DashedGray[pl], Pt6DashedGray[pl]);

for (int pl = 0; pl < Pt1SolidGray.Count; pl++)

e.Graphics.DrawLine(SolidGrey, Pt1SolidGray[pl], Pt2SolidGray[pl]);
PointF pointsdhg = new PointF

new PointF(Pt2SolidGray[pl].X, Pt2SolidGray[pl].Y),
new PointF(Pt3SolidGray[pl].X, Pt3SolidGray[pl].Y),
new PointF(Pt4SolidGray[pl].X, Pt4SolidGray[pl].Y),
new PointF(Pt5SolidGray[pl].X, Pt5SolidGray[pl].Y),
;
e.Graphics.DrawCurve(SolidGrey, pointsdhg);
e.Graphics.DrawLine(SolidGrey, Pt5SolidGray[pl], Pt6SolidGray[pl]);




for (int pl = 0; pl < Pt1DashGreen.Count; pl++)

e.Graphics.DrawLine(greenPen, Pt1DashGreen[pl], Pt2DashGreen[pl]);
PointF pointsdhg = new PointF

new PointF(Pt2DashGreen[pl].X, Pt2DashGreen[pl].Y),
new PointF(Pt3DashGreen[pl].X, Pt3DashGreen[pl].Y),
new PointF(Pt4DashGreen[pl].X, Pt4DashGreen[pl].Y),
new PointF(Pt5DashGreen[pl].X, Pt5DashGreen[pl].Y),
;
e.Graphics.DrawCurve(greenPen, pointsdhg);
e.Graphics.DrawLine(greenPen, Pt5DashGreen[pl], Pt6DashGreen[pl]);


for (int i = 0; i < Pt1.Count; i++)

e.Graphics.DrawLine(SolidGreen, Pt1[i], Pt2[i]);

for (int l = 0; l < DashedGreen1.Count; l++)

e.Graphics.DrawLine(greenPen, DashedGreen1[l], DashedGreen2[l]);


for (int k = 0; k < SolidGrey1.Count; k++)

e.Graphics.DrawLine(SolidGrey, SolidGrey1[k], SolidGrey2[k]);

for (int j = 0; j < DashedGrey1.Count; j++)

e.Graphics.DrawLine(Grey, DashedGrey1[j], DashedGrey2[j]);

if (IsDrawing)

e.Graphics.DrawLine(Red, NewPt1.X, NewPt1.Y, NewPt2.X, NewPt2.Y);

if (Draw_Dashed_Green)

e.Graphics.DrawLine(red, DashedGreenPT1, DashedGreenPT2);

if (Draw_Solid_Grey)

e.Graphics.DrawLine(Red, SolidGreyPT1, SolidGreyPT2);

if (Draw_dashed_Grey)

e.Graphics.DrawLine(red, DashedGreyPT1, DashedGreyPT2);




Need Help
Here is my code so far.
BDW, The point of the line is stored in the list from.
The Drawn lines in Paint event also include the line jumpers which has 6 points on it to make a jumps.



So the only problem is I would like to change the Points of the lines as I use the scroll bar.
Thanks for answering my question.










share|improve this question















I just want to transform the points when scrolling. I already use the e.Graphics.TranslateTransform() but it only works on drawing. The point of the line wont change the offset.



 private void Form1_Scroll(object sender, ScrollEventArgs e)

Point scrollOffset = this.AutoScrollPosition;

for (int lk = 0; lk < Pt1.Count; lk++)

Pt1[lk] = new Point(Pt1[lk].X + scrollOffset.X, Pt1[lk].Y + scrollOffset.Y);
Pt2[lk] = new Point(Pt2[lk].X + scrollOffset.X, Pt2[lk].Y + scrollOffset.Y);

this.Invalidate();
this.Update();
this.Refresh();

private void Form1_Paint(object sender, PaintEventArgs e)

Point scrollOffset = this.AutoScrollPosition;
e.Graphics.TranslateTransform(scrollOffset.X, scrollOffset.Y);
e.Graphics.Clear(this.BackColor);
e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
Pen greenPen = new Pen(Color.Green,1);
greenPen.DashPattern = new float 5.0F, 5.0F, 5.0F, 5.0F ;
Pen red = new Pen(Color.Red,1);
red.DashPattern = new float 5.0F, 5.0F, 5.0F, 5.0F ;
Pen Grey = new Pen(Color.Gray,1);
Grey.DashPattern = new float 5.0F, 5.0F, 5.0F, 5.0F ;
#region "Draw Line using cursor"
Pen SolidGreen = new Pen(Color.Green, 1);
Pen SolidGrey = new Pen(Color.Gray, 1);
Pen Red = new Pen(Color.Red, 1);

for (int pl = 0; pl < Pt1j.Count; pl++)


PointF pointsj = new PointF

new PointF(Pt2j[pl].X, Pt2j[pl].Y),
new PointF(Pt3j[pl].X , Pt3j[pl].Y),
new PointF(Pt4j[pl].X , Pt4j[pl].Y),
new PointF(Pt5j[pl].X , Pt5j[pl].Y),
;
e.Graphics.DrawLine(Pens.Green, Pt1j[pl].X , Pt1j[pl].Y, Pt2j[pl].X, Pt2j[pl].Y);
e.Graphics.DrawCurve(Pens.Green, pointsj);
e.Graphics.DrawLine(Pens.Green, Pt5j[pl].X , Pt5j[pl].Y, Pt6j[pl].X, Pt6j[pl].Y);

for (int pl = 0; pl < Pt1DashedGray.Count; pl++)

e.Graphics.DrawLine(Grey, Pt1DashedGray[pl], Pt2DashedGray[pl]);
PointF pointsdhg = new PointF

new PointF(Pt2DashedGray[pl].X, Pt2DashedGray[pl].Y),
new PointF(Pt3DashedGray[pl].X, Pt3DashedGray[pl].Y),
new PointF(Pt4DashedGray[pl].X, Pt4DashedGray[pl].Y),
new PointF(Pt5DashedGray[pl].X, Pt5DashedGray[pl].Y),
;
e.Graphics.DrawCurve(Grey, pointsdhg);
e.Graphics.DrawLine(Grey, Pt5DashedGray[pl], Pt6DashedGray[pl]);

for (int pl = 0; pl < Pt1SolidGray.Count; pl++)

e.Graphics.DrawLine(SolidGrey, Pt1SolidGray[pl], Pt2SolidGray[pl]);
PointF pointsdhg = new PointF

new PointF(Pt2SolidGray[pl].X, Pt2SolidGray[pl].Y),
new PointF(Pt3SolidGray[pl].X, Pt3SolidGray[pl].Y),
new PointF(Pt4SolidGray[pl].X, Pt4SolidGray[pl].Y),
new PointF(Pt5SolidGray[pl].X, Pt5SolidGray[pl].Y),
;
e.Graphics.DrawCurve(SolidGrey, pointsdhg);
e.Graphics.DrawLine(SolidGrey, Pt5SolidGray[pl], Pt6SolidGray[pl]);




for (int pl = 0; pl < Pt1DashGreen.Count; pl++)

e.Graphics.DrawLine(greenPen, Pt1DashGreen[pl], Pt2DashGreen[pl]);
PointF pointsdhg = new PointF

new PointF(Pt2DashGreen[pl].X, Pt2DashGreen[pl].Y),
new PointF(Pt3DashGreen[pl].X, Pt3DashGreen[pl].Y),
new PointF(Pt4DashGreen[pl].X, Pt4DashGreen[pl].Y),
new PointF(Pt5DashGreen[pl].X, Pt5DashGreen[pl].Y),
;
e.Graphics.DrawCurve(greenPen, pointsdhg);
e.Graphics.DrawLine(greenPen, Pt5DashGreen[pl], Pt6DashGreen[pl]);


for (int i = 0; i < Pt1.Count; i++)

e.Graphics.DrawLine(SolidGreen, Pt1[i], Pt2[i]);

for (int l = 0; l < DashedGreen1.Count; l++)

e.Graphics.DrawLine(greenPen, DashedGreen1[l], DashedGreen2[l]);


for (int k = 0; k < SolidGrey1.Count; k++)

e.Graphics.DrawLine(SolidGrey, SolidGrey1[k], SolidGrey2[k]);

for (int j = 0; j < DashedGrey1.Count; j++)

e.Graphics.DrawLine(Grey, DashedGrey1[j], DashedGrey2[j]);

if (IsDrawing)

e.Graphics.DrawLine(Red, NewPt1.X, NewPt1.Y, NewPt2.X, NewPt2.Y);

if (Draw_Dashed_Green)

e.Graphics.DrawLine(red, DashedGreenPT1, DashedGreenPT2);

if (Draw_Solid_Grey)

e.Graphics.DrawLine(Red, SolidGreyPT1, SolidGreyPT2);

if (Draw_dashed_Grey)

e.Graphics.DrawLine(red, DashedGreyPT1, DashedGreyPT2);




Need Help
Here is my code so far.
BDW, The point of the line is stored in the list from.
The Drawn lines in Paint event also include the line jumpers which has 6 points on it to make a jumps.



So the only problem is I would like to change the Points of the lines as I use the scroll bar.
Thanks for answering my question.







c# winforms gdi+






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 8:31

























asked Nov 9 at 3:53









jayromel lawas

114




114











  • Can you explain what is the effect that you looking for? Are you trying to move the lines position on the surface using the Scrollbars? Or keep them steady? The AutoScrollPosition reports negative values. (Btw, you just need Invalidate())
    – Jimi
    Nov 9 at 6:34










  • Uhmmm ... I would like to move the lines position when using the scrollbar. I already use Invalidate() and I put the e.Graphics.TranslateTransform() in the paint event and it works. But the only problem is the point didnt move , only the drawn lines.
    – jayromel lawas
    Nov 9 at 7:44










  • Then post the Paint event code. As it is, this is very uncleary to me what you're trying to achieve. Also because, as I said before AutoScrollPosition gives negative values. Then, I already use Invalidate(). I meant you need Invalidate() alone. Adding Update() and Refresh() causes a second repaint for each Scroll() event change.
    – Jimi
    Nov 9 at 7:51










  • private void Form1_Paint(object sender, PaintEventArgs e) { Point scrollOffset = this.AutoScrollPosition; e.Graphics.TranslateTransform(scrollOffset.X, scrollOffset.Y); e.Graphics.Clear(this.BackColor);
    – jayromel lawas
    Nov 9 at 8:16










  • Nope, you need to Edit your question, adding any code snippet or description that can further explain your case. Don't insert code in comments.
    – Jimi
    Nov 9 at 8:18
















  • Can you explain what is the effect that you looking for? Are you trying to move the lines position on the surface using the Scrollbars? Or keep them steady? The AutoScrollPosition reports negative values. (Btw, you just need Invalidate())
    – Jimi
    Nov 9 at 6:34










  • Uhmmm ... I would like to move the lines position when using the scrollbar. I already use Invalidate() and I put the e.Graphics.TranslateTransform() in the paint event and it works. But the only problem is the point didnt move , only the drawn lines.
    – jayromel lawas
    Nov 9 at 7:44










  • Then post the Paint event code. As it is, this is very uncleary to me what you're trying to achieve. Also because, as I said before AutoScrollPosition gives negative values. Then, I already use Invalidate(). I meant you need Invalidate() alone. Adding Update() and Refresh() causes a second repaint for each Scroll() event change.
    – Jimi
    Nov 9 at 7:51










  • private void Form1_Paint(object sender, PaintEventArgs e) { Point scrollOffset = this.AutoScrollPosition; e.Graphics.TranslateTransform(scrollOffset.X, scrollOffset.Y); e.Graphics.Clear(this.BackColor);
    – jayromel lawas
    Nov 9 at 8:16










  • Nope, you need to Edit your question, adding any code snippet or description that can further explain your case. Don't insert code in comments.
    – Jimi
    Nov 9 at 8:18















Can you explain what is the effect that you looking for? Are you trying to move the lines position on the surface using the Scrollbars? Or keep them steady? The AutoScrollPosition reports negative values. (Btw, you just need Invalidate())
– Jimi
Nov 9 at 6:34




Can you explain what is the effect that you looking for? Are you trying to move the lines position on the surface using the Scrollbars? Or keep them steady? The AutoScrollPosition reports negative values. (Btw, you just need Invalidate())
– Jimi
Nov 9 at 6:34












Uhmmm ... I would like to move the lines position when using the scrollbar. I already use Invalidate() and I put the e.Graphics.TranslateTransform() in the paint event and it works. But the only problem is the point didnt move , only the drawn lines.
– jayromel lawas
Nov 9 at 7:44




Uhmmm ... I would like to move the lines position when using the scrollbar. I already use Invalidate() and I put the e.Graphics.TranslateTransform() in the paint event and it works. But the only problem is the point didnt move , only the drawn lines.
– jayromel lawas
Nov 9 at 7:44












Then post the Paint event code. As it is, this is very uncleary to me what you're trying to achieve. Also because, as I said before AutoScrollPosition gives negative values. Then, I already use Invalidate(). I meant you need Invalidate() alone. Adding Update() and Refresh() causes a second repaint for each Scroll() event change.
– Jimi
Nov 9 at 7:51




Then post the Paint event code. As it is, this is very uncleary to me what you're trying to achieve. Also because, as I said before AutoScrollPosition gives negative values. Then, I already use Invalidate(). I meant you need Invalidate() alone. Adding Update() and Refresh() causes a second repaint for each Scroll() event change.
– Jimi
Nov 9 at 7:51












private void Form1_Paint(object sender, PaintEventArgs e) { Point scrollOffset = this.AutoScrollPosition; e.Graphics.TranslateTransform(scrollOffset.X, scrollOffset.Y); e.Graphics.Clear(this.BackColor);
– jayromel lawas
Nov 9 at 8:16




private void Form1_Paint(object sender, PaintEventArgs e) { Point scrollOffset = this.AutoScrollPosition; e.Graphics.TranslateTransform(scrollOffset.X, scrollOffset.Y); e.Graphics.Clear(this.BackColor);
– jayromel lawas
Nov 9 at 8:16












Nope, you need to Edit your question, adding any code snippet or description that can further explain your case. Don't insert code in comments.
– Jimi
Nov 9 at 8:18




Nope, you need to Edit your question, adding any code snippet or description that can further explain your case. Don't insert code in comments.
– Jimi
Nov 9 at 8:18

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53219621%2fdrawing-lines-in-autoscroll-form-c-sharp%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53219621%2fdrawing-lines-in-autoscroll-form-c-sharp%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)