uerasable lines
-
Hi I am developing an application for making data flow diagrams in c#, i can move around objects and also draw lines from one point to another, but the problem is that once the lines are drawn and then i move other objects around the lines get erased for obvious reasons how to get rid of that?
Sameer Sood Microsoft Student partner NIT Durgapur,India :-O
-
Hi I am developing an application for making data flow diagrams in c#, i can move around objects and also draw lines from one point to another, but the problem is that once the lines are drawn and then i move other objects around the lines get erased for obvious reasons how to get rid of that?
Sameer Sood Microsoft Student partner NIT Durgapur,India :-O
That is because you are drawing on the screen where the control happens to be instead of using the control to do the drawing. Use the Paint event of the control to do the drawing. Then whenever the control has to be redrawn for any reason, the lines will also be redrawn. Store the coordinates of the lines to draw in a list or something. Add coordinates to the list and use the Invalidate method on the control to make it redraw itself.
--- b { font-weight: normal; }
-
That is because you are drawing on the screen where the control happens to be instead of using the control to do the drawing. Use the Paint event of the control to do the drawing. Then whenever the control has to be redrawn for any reason, the lines will also be redrawn. Store the coordinates of the lines to draw in a list or something. Add coordinates to the list and use the Invalidate method on the control to make it redraw itself.
--- b { font-weight: normal; }
i knw that and i hv done it the problem is that it's a reversible line and this is done using controlpaint. this line is drawn only w.r.t. a form and not a control as far as i kinw, so hw to do that, to make it simple let us say u re drawing a line like mspaint, hw to handle that sort of line?
Sameer Sood Microsoft Student partner NIT Durgapur,india
-
i knw that and i hv done it the problem is that it's a reversible line and this is done using controlpaint. this line is drawn only w.r.t. a form and not a control as far as i kinw, so hw to do that, to make it simple let us say u re drawing a line like mspaint, hw to handle that sort of line?
Sameer Sood Microsoft Student partner NIT Durgapur,india
-
i knw that and i hv done it the problem is that it's a reversible line and this is done using controlpaint. this line is drawn only w.r.t. a form and not a control as far as i kinw, so hw to do that, to make it simple let us say u re drawing a line like mspaint, hw to handle that sort of line?
Sameer Sood Microsoft Student partner NIT Durgapur,india
If "u" "hv" done it that way, what is the problem? Whenever a part of the form needs repainting, it will first draw it's background, then "ur" event handler for the Paint event will draw the lines on top of it. It doesn't matter how "u" draw the lines, as they will always "b" drawn from the same state. If "u" "re" drawing a line like mspaint, "u" "wd" "b" drawing it on a bitmap, then displaying the bitmap.
--- b { font-weight: normal; }
-
If "u" "hv" done it that way, what is the problem? Whenever a part of the form needs repainting, it will first draw it's background, then "ur" event handler for the Paint event will draw the lines on top of it. It doesn't matter how "u" draw the lines, as they will always "b" drawn from the same state. If "u" "re" drawing a line like mspaint, "u" "wd" "b" drawing it on a bitmap, then displaying the bitmap.
--- b { font-weight: normal; }
hi First do it then answer me, imagine a scenario where 5 or ten lines are there, and also 5 or 6 controls object on the same board which you can move with mouse,so first question how will you know which line to refresh or redraw, the even if u redraw then the flickers are so high that it doesn't look nice, plus then as i said it's reversible lines , so when some part of it is missed and then i redraw, that missed part gets erased permanently, it's easier said than done my friend , pls try it.
Sameer Sood Microsoft Student partner NIT Durgapur,india
-
hi First do it then answer me, imagine a scenario where 5 or ten lines are there, and also 5 or 6 controls object on the same board which you can move with mouse,so first question how will you know which line to refresh or redraw, the even if u redraw then the flickers are so high that it doesn't look nice, plus then as i said it's reversible lines , so when some part of it is missed and then i redraw, that missed part gets erased permanently, it's easier said than done my friend , pls try it.
Sameer Sood Microsoft Student partner NIT Durgapur,india
Yes, as you are using reversible lines you have to redraw everything around a line when you are moving it, so you will have some flickering. You can specify a rectangle for the Invalidate method to make it redraw only the needed part of the control.
--- b { font-weight: normal; }
-
Yes, as you are using reversible lines you have to redraw everything around a line when you are moving it, so you will have some flickering. You can specify a rectangle for the Invalidate method to make it redraw only the needed part of the control.
--- b { font-weight: normal; }
-
ya i know about that , how will i detect that which line to redaw among so many lines, this is the main problem how to get the rectangle at the right place
Sameer Sood Microsoft Student partner NIT Durgapur,india
-
ssoffline wrote:
how will i detect that which line to redaw among so many lines
Eh? Are you unable detect what line you just changed yourself?
--- b { font-weight: normal; }