Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb_dotnet thread: Drawing on a pictureBox Using VB.net


Message #1 by devc7@h... on Fri, 22 Mar 2002 09:17:06
Hello All, 

i have a picturebox on which i am selecting some test.gif 
in the image property in the design time ...
i am drawing some graphs on a picturebox using drawline 
method of the graphics object out side the paint handler 
of the picture box. when i make some other application 
active and come back to this application again. the drawn 
lines disappear. how do i make the graphs persists even 
though picbox is painted. 
after drawing this i want to save the image. but while 
saving also it saves only the the original test.gif and 
not the additional graphs i have drawn in the run time.

i tried a lot .... 
but i could not get throught !!! 



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

hDCSrc = GetDC(hWndSrc)
hDCMemory = CreateCompatibleDC(hDCSrc)
hBmp = CreateCompatibleBitmap(hDCSrc, WidthSrc, HeightSrc)
hBmpPrev = SelectObject(hDCMemory, hBmp)
r = BitBlt(hDCMemory, 0, 0, WidthSrc, HeightSrc, hDCSrc, 
LeftSrc, TopSrc, vbSrcCopy)
hBmp = SelectObject(hDCMemory, hBmpPrev)
r = DeleteDC(hDCMemory)
r = ReleaseDC(hWndSrc, hDCSrc)
OleCreatePictureIndirect(Pic, IID_IDispatch, 1, IPic)



  Return to Index