[RESOLVED] Resize Image With Compact Framework-VBForums
Results 1 to 12 of 12

Thread: [RESOLVED] Resize Image With Compact Framework

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    77

    Resolved [RESOLVED] Resize Image With Compact Framework

    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?

  2. #2
    Addicted Member
    Join Date
    Feb 2003
    Posts
    183

    Re: Resize Image With Compact Framework

    Where is this image being displayed for you to test?

    Stupid question, but you haven't got autosize on a picture box have you?
    Look into the heart of infinity and find your truth

    Colonel Tom Edwards: This is the most fantastic story I've ever heard
    Jeff Trent: And every word of it's true, too
    Colonel Tom Edwards: That's the fantastic part of it

    ROFL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    77

    Re: Resize Image With Compact Framework

    the picturebox has stretch or centre. what I need is a 100*100 image displayed as a 200*200 picturebox.image.

  4. #4
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Resize Image With Compact Framework

    what do you mean it doesnt work ? you mean it doesnt build?

    Regards
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  5. #5
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: Resize Image With Compact Framework

    Please give the specific error
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    77

    Re: Resize Image With Compact Framework

    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.

  7. #7
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Resize Image With Compact Framework

    And how about using Image.GetThumbnailImage ?

    Regards
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    77

    Re: Resize Image With Compact Framework

    guess what; Image.GetThumbnailImage doesn't appear to be
    supported on the compact framework.

  9. #9
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: Resize Image With 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.
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    77

    Re: Resize Image With Compact Framework

    the graphic.drawimage looks like it could be a winner. I don't suppose you have an example of how to code this?

  11. #11
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: Resize Image With Compact Framework

    As it happens I was just jotting it up
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim origimage As Image = Image.FromFile("someimageondisk")
    3.         Dim bmp As New Bitmap(100, 100)
    4.         Dim gr As Graphics = Graphics.FromImage(bmp)
    5.         gr.DrawImage(origimage, 0, 0, 100, 100)
    6.         Me.BackgroundImage = bmp
    7.     End Sub

    edit: don't know if it works compact though.
    Last edited by grilkip; Sep 27th, 2005 at 10:05 AM.
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    77

    Re: Resize Image With Compact Framework

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.