Results 1 to 3 of 3

Thread: using StretchBlt under vb.net

  1. #1

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729

    using StretchBlt under vb.net

    OK first of all dont say me "you can use framework" bla bla bla..i must do this this way..

    i have the following code:
    VB Code:
    1. final = pictureBox2
    2. dim original as Image = Image.FromFile("C:\Documents and Settings\_RIP_DREAMS\Desktop\D_r_e_a_m_s_i_g_n[1].jpg")
    3. dim g as Graphics = Graphics.FromImage(original)
    4. dim originalHdc as IntPtr = g.GetHdc()
    5. g = final.CreateGraphics()
    6. IntPtr finalHdc = g.GetHdc()
    7. Form1.SetStretchBltMode(finalHdc, 4)
    8. Form1.StretchBlt(finalHdc, 0, 0, 100, 100, originalHdc, 0, 0, original.Width, original.Height, 13369376)

    the problem is that the ORIGINAL image gets just black..anyone knows why? if instead of directly loading the file into memory i put it into a picturebox it works..whats the damn difference?
    \m/\m/

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    blah blah blah

    why can't you use the framework?

    There's 30 overloaded methods of .DrawImage.... which support scaling (stretching, etc)....

    graphics.drawimage(srcrect,destrect)

    etc...

    BUT, if you insist on it this way...

    1) do you have option strict on? (I know but I always ask anyway)

    2) You will have to post the other code you said worked... and I ask because I want to know if you load the image into the picbox before or after you trying StrecthBlting the form....

  3. #3

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    i didnt think of the DrawImage for image resizing but ill stick a bit with it, i've tried using GetThumbnail and it is completly bugged as the pictures get awful and thats why i didnt use it but i will try with drawimage() anyways..
    \m/\m/

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