My application has a requirement where I plot a hugh diagram on picturebox based on some data-analysis.
This diagram is drawn by creating Line, label and command button controls on runtime and placing them on picture box. The contents of picture box are not really picture as I really act on the events recvd from label and command buttons.
Now my problem is that when I try to save this image to bmp file I don't get all the contents correctly.
Effectively I'm not able to capture all the contents of PictureBox correctly. I'm using BitBlt to this.
So pls enlighten me on what is the best way to do this?
My secretary hopes that I will pay her, her landlord hopes that she will produce some rent, the Electricity Board hopes that he will settle their bill, and so on. I find it a wonderfully optimistic way of life. [Dirk Gently]
If you also want to grab some controls sitting on top of the picturebox (say, Pic1), place an invisible picturebox on the form with the autoredraw and autosize properties set to true (call it Pic2) and then get a screenshot of the desktop and place the relevant part (contents of Pic1) on Pic2. Thereafter, save the contents of Pic2 to hard disk.
In the code below I'm using TwipsX and TwipsY because the dimensions must be in pixels and the example I've copied the code from had them in twips.
Last edited by krtxmrtz; Apr 11th, 2005 at 06:18 AM.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
Well let me elaborate the problem. Assume I'm using pic1 to draw the image or diagram.
My PIC1 has autoredraw and autosize set to true, because its hugh picture even bigger than screen dimension. So I have placed scrollbars around it for user to view it fully.
Now when I try to do bitblt this hDC to another PIC2, I don't get full picture.
Pls see attached JPG file. You can easily see distortion in image caused by other controls present on the form.
So tell some way by which only the contents of PictureBox can be saved into a image or image file.
Now when I try to do bitblt this hDC to another PIC2, I don't get full picture.
Pls see attached JPG file. You can easily see distortion in image caused by other controls present on the form.
Maybe I misunderstood you. From the image you've posted I don't see any controls on the picturebox, only textboxes below. Unless the numbers representing IP addresses are labels...?
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
As you can see from the image. By BitBlt I'm unable to capture the full picture. Using hDC, I'm able to capture only the portion visible to user and not all the contents of Picturebox.