I am trying to resize an image in a program that runs on a pocket PC.
this doesn't work in the compact framework:
dim ReBMP as NEW bitmap (OrigBMP, width, height)
Anyone know how I can do this?
Printable View
I am trying to resize an image in a program that runs on a pocket PC.
this doesn't work in the compact framework:
dim ReBMP as NEW bitmap (OrigBMP, width, height)
Anyone know how I can do this?
Where is this image being displayed for you to test?
Stupid question, but you haven't got autosize on a picture box have you?
the picturebox has stretch or centre. what I need is a 100*100 image displayed as a 200*200 picturebox.image.
what do you mean it doesnt work ? you mean it doesnt build?
Regards
Jorge
Please give the specific error
Overload resolution failed because no accessible 'New' accepts this number of arguments.
As far as I can tell this is supported on the normal framework but not on the compact framework. I did look at the possible parameter combinations for a new bitmap but none were suitable.
And how about using Image.GetThumbnailImage ?
Regards
Jorge
guess what; Image.GetThumbnailImage doesn't appear to be
supported on the compact framework.
Well you can always create a new bitmap with the desired size, then create a Graphics object from it to draw the image on it.
the graphic.drawimage looks like it could be a winner. I don't suppose you have an example of how to code this?
As it happens I was just jotting it up :)VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim origimage As Image = Image.FromFile("someimageondisk") Dim bmp As New Bitmap(100, 100) Dim gr As Graphics = Graphics.FromImage(bmp) gr.DrawImage(origimage, 0, 0, 100, 100) Me.BackgroundImage = bmp End Sub
edit: don't know if it works compact though.
Thanks a lot. It looks like its going to work (no compilation errors but I need to spend a bit of time incorperation it into the rest of the code).
I will mark this as resolved and raise it again if I have a specific problem.
Thanks again to all.