Results 1 to 17 of 17

Thread: [VB6] - stretch an image to usercontrol size

Hybrid View

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

    Re: [VB6] - stretch an image to usercontrol size

    UserControl.Width,Height are always in Twips: 690 in your case. Same as a form's Width,Height are always in Twips.
    UserControl.ScaleWidth,ScaleHeight are in usercontrol's ScaleMode: 46 in your case

    In post #2 above I tried to explain that to you. A control's Width,Height values are always in the control's container's scalemode. So UserControl1.Width will be in the uc's container's scalemode. UserControl1.Width is not the same as UserControl.Width called from within the uc.
    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}

  2. #2

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,964

    Re: [VB6] - stretch an image to usercontrol size

    Quote Originally Posted by LaVolpe View Post
    UserControl.Width,Height are always in Twips: 690 in your case. Same as a form's Width,Height are always in Twips.
    UserControl.ScaleWidth,ScaleHeight are in usercontrol's ScaleMode: 46 in your case

    In post #2 above I tried to explain that to you. A control's Width,Height values are always in the control's container's scalemode. So UserControl1.Width will be in the uc's container's scalemode. UserControl1.Width is not the same as UserControl.Width called from within the uc.
    ok. i understand that. but now i still have the same question: why that width(in these case) bug?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  3. #3

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,964

    Re: [VB6] - stretch an image to usercontrol size

    ......... i'm still blocked
    Last edited by joaquim; Nov 27th, 2010 at 11:17 AM.
    VB6 2D Sprite control

    To live is difficult, but we do it.

  4. #4

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,964

    Re: [VB6] - stretch an image to usercontrol size

    i'm good hehehehe
    i found the solution:
    1 - i have 1 picturebox for catch the real image size and works 100% fine;
    2 . i use the Extender object for catch the actual usercontrol size and works fine.
    Code:
    If blnStretch = True Then
            StretchBlt UserControl.hDC, 0, 0, Extender.Width, Extender.Height, UserControl.hDC, 0, 0, imgSize.Width, imgSize.Height, vbSrcCopy
            UserControl.Picture = UserControl.Image
        End If
    my little problem is if i reduze the original size(in UC) the image is showed like a double in diferent size. i belive that is something that i forget in that IF. can you advice me more?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  5. #5

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,964

    Re: [VB6] - stretch an image to usercontrol size

    ok... heres the code for avoid the double image:
    Code:
    If blnStretch = True Then
            picGraphicsEffects.Width = Extender.Width
            picGraphicsEffects.Height = Extender.Height
            picGraphicsEffects.Picture = Nothing
            StretchBlt picGraphicsEffects.hDC, 0, 0, Extender.Width, Extender.Height, UserControl.hDC, 0, 0, imgSize.Width, imgSize.Height, vbSrcCopy
            UserControl.Picture = Nothing
            picGraphicsEffects.Picture = picGraphicsEffects.Image
            UserControl.Picture = picGraphicsEffects.Image
        End If
    but when i reduse de image(from original size), i recive 1 bug. in image the half(more or less) image isn't showed. why? is about the stretchblt bug?
    VB6 2D Sprite control

    To live is difficult, but we do it.

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