Results 1 to 4 of 4

Thread: Rotate image in image box

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    105

    Rotate image in image box

    Hi all,

    Is there any technique or idea to rotate an image in image box.
    I see many sample code to rotate image in a picture box, but I want to do the same using image box, is it possible ?

    Pls help

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Rotate image in image box

    Yes and no. The real answer is no.
    What you can do is rotate the image using various techniques you've found while searching -- whether it be rotating to a hidden picturebox or offscreen memory DC. Then assign the image control the handle of the rotated image.

    1. If rotating to a hidden picturebox, I am assuming your examples draw the rotated image to the picturebox vs. reassigning a handle...
    -- ensure AutoRedraw is True for picbox & sized appropriately for rotation
    -- set the image handle to the picbox image. Set imgbox.Picture = picbox.Image

    2. If rotating to a memory dc, you'll need to use APIs to convert the rotated bitmap handle to a stdPicture handle. Search forum for examples, using keyword: OleCreatePictureIndirect

    Also note that your image control will not contain transparency unless you convert the rotated bitmap to a transparent GIF or Icon format.

    You might want to search about using key terms: rotate transparent gif

    My Alpha Image Control project may be more than you are looking for, but you might want to play with that also. See the link in my signature below
    Last edited by LaVolpe; Oct 20th, 2011 at 11:53 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    105

    Re: Rotate image in image box

    Hi LaVolpe,

    Thanks for your prompt replay.

    The problem of picture box, it reduces the image clarity and neatness. I have already tested using a hidden picture box but it effects the image clarity negatively and the image become vulgar in the picture box.
    And in my project there is option for zoom in and out. This time the image become more vulgar and in bad condition in a picture box.

    But the image box keeps the clarity and we can zoom it without any problem to the image in it.

    So I want to rotate an image keeping its clarity and neatness.

    Can you please suggest any idea ?

    Regards,
    Nasreen

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Rotate image in image box

    Zooming with VB can produce poor results, especially zooming out to larger scales. This is because VB uses a scaling interpolation model of nearest neighbor. This is a very fast & simple model, but not necessarily the cleanest. Other models can be used that produce a soft blur around the rotated edges that remove jaggies. Two of those other models are known as bicubic & bilinear. Neither are supported by VB6 directly.

    If you are getting poor results when zooming compared to an image control with stretch property set to true, then I'd suggest that the problem lies in the rotation function you are using.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

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



Click Here to Expand Forum to Full Width