Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb_dotnet thread: Re: Drawing on a pictureBox Using VB.net


Message #1 by "Olasupo Orimogunje" <supo99@n...> on Sun, 21 Apr 2002 13:47:28
To persist graphics, put the drawing code in the form's paint event OR 
draw to a memory bitmap and copy its contents in the form's paint event.

> Hello All, 

> i have a picturebox on which i am selecting some test.gif 
i> n the image property in the design time ...
i>  am drawing some graphs on a picturebox using drawline 
m> ethod of the graphics object out side the paint handler 
o> f the picture box. when i make some other application 
a> ctive and come back to this application again. the drawn 
l> ines disappear. how do i make the graphs persists even 
t> hough picbox is painted. 
a> fter drawing this i want to save the image. but while 
s> aving also it saves only the the original test.gif and 
n> ot the additional graphs i have drawn in the run time.

> i tried a lot .... 
b> ut i could not get throught !!! 

> 

> i have done the same in VB but that was using the API
u> sing function as follows

> hDCSrc = GetDC(hWndSrc)
h> DCMemory = CreateCompatibleDC(hDCSrc)
h> Bmp = CreateCompatibleBitmap(hDCSrc, WidthSrc, HeightSrc)
h> BmpPrev = SelectObject(hDCMemory, hBmp)
r>  = BitBlt(hDCMemory, 0, 0, WidthSrc, HeightSrc, hDCSrc, 
L> eftSrc, TopSrc, vbSrcCopy)
h> Bmp = SelectObject(hDCMemory, hBmpPrev)
r>  = DeleteDC(hDCMemory)
r>  = ReleaseDC(hWndSrc, hDCSrc)
O> leCreatePictureIndirect(Pic, IID_IDispatch, 1, IPic)

> 

  Return to Index