|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Redrawing a part of a controlHi all,
I am drawing some lines on a picturebox control. In the .Paint event of the picturebox I draw the lines of a graph. These lines are static and never move. Now, in the same Sub I am drawing the plot of the graph based on some changing variables in memory. This works and when the variables change in memory I call the Invalidate method of the picturebox to redraw the lines. This seems wrong to me as I am drawing many lines again (the graph axis etc.) just to refresh the line of the graph. It also gives me a flicker. Does anyone know of a better way to eliminate the existing line on the graph and redraw it (or to redraw an existing line if that is possible.) Thanks, Hugh Create a bitmap
Dim bmp as BitMap(Width,Height) Dim g as graphics = graphics.fromimage(bmp) - please check , not at regular computer. with g ..draw etc ..dispose() end with backgroundimage = bmp now you can refresh and draw temp lines etc. Hello Hugh,
Set double buffering on (See the SetStyle method).. this will help to eliminate the flicker. Also set all painting to be done in the WM_PAINT (same method). Also, since the grid lines don't change (but I assume they are generated dynamicly).. you could draw them into a bitmap that you hold in memory.. then when it's time to redraw the graph, blit the bitmap onto the canvas and then redraw your value lines. Since this is raster stuff and not vector there's really no way of saying.. erase this one line only and redraw it. Even behind the scenes vector rendering is really raster.. same principles apply there. Show quoteHide quote > Hi all, > > I am drawing some lines on a picturebox control. In the .Paint event > of the picturebox I draw the lines of a graph. These lines are static > and never move. Now, in the same Sub I am drawing the plot of the > graph based on some changing variables in memory. > > This works and when the variables change in memory I call the > Invalidate method of the picturebox to redraw the lines. This seems > wrong to me as I am drawing many lines again (the graph axis etc.) > just to refresh the line of the graph. It also gives me a flicker. > > Does anyone know of a better way to eliminate the existing line on the > graph and redraw it (or to redraw an existing line if that is > possible.) > > Thanks, > Hugh
DateTime conversion to Integer
Detecting if a printer is connected to the PC Component UI CAB Architecture Guide??? For Dummies Book? :-) What to do when GetDeviceCaps doesn't? SqlDataAdapter.FillSchema Send SMS from PC through fixed land line Datagrid relationships Math question: Based on excel Regex Question VB6: send active hyperlink in body of email sent in VB6 |
|||||||||||||||||||||||