|
-
Aug 1st, 2008, 10:48 PM
#1
Thread Starter
New Member
Problems with SavePicture
Hi Guys!
I used the following code to draw some shapes:
Dim item(10) As VB.shape
Private Sub Form_Load()
Dim a As Integer
For a = 0 To 9
Set shape(a) = Form1.Controls.Add("VB.Shape", "shp" & a)
item(a).Visible = True
item(a).Left = 1800 + (a * 150)
item(a).Top = 1500 + (a * 150)
Next
End Sub
It work fine but then I want to save these shapes into a bitmap. I used the Savepicture statement:
SavePicture Form1.image, "image.bmp"
but all it did was it saved the form without any of the shapes (i.e it was a blank form)
Any advise? Thanks in advance!
ps. all i want to do is to draw multiple shapes with flexibility of control and save them into a bitmap. am open to all suggestions.
-
Aug 2nd, 2008, 06:14 AM
#2
Re: Problems with SavePicture
It's because shape controls are not part of the containers image. If you draw your shapes using the containers drawing methods (Object.Line, Object.Circle) then they are part of the image and can be saved.
If you want to manipulate your drawn shapes after they have been drawn then you can use an array of some UDT to store there positions and size...
Code:
Private type tCircle
X as Single
Y as Single
Radius as Single
Colour as long
LineThickness as Long
Filled as Boolean
FillColour as Long
End Type
Private mCircles() as tCircle
-
Aug 2nd, 2008, 05:30 PM
#3
Thread Starter
New Member
Re: Problems with SavePicture
Hi Milk,
Thanks for your reply.
That was very helpful. There isnt a method for drawing rectangles would there?
Thanks again!
-
Aug 2nd, 2008, 07:13 PM
#4
Re: Problems with SavePicture
The line method.
The last optional parameter is either B or BF, that means box or filled box.
Edit: It's worth investigating GDI API if you have loads to draw
Last edited by Milk; Aug 2nd, 2008 at 07:38 PM.
-
Aug 2nd, 2008, 09:18 PM
#5
Hyperactive Member
Re: Problems with SavePicture
Explorer is you want to save your shapes for next time use, you will have to save the value of the properties of your shapes so that next time they can be drawn at the exact positions and in the exact manner. You will need to save the (x,y) cartesian coordinates, the color, the radius/length/width, the fill style, the border/line thickness and then apply these values to your shapes to draw the exact same shapes. I always use this method and it has never failed me.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|