Results 1 to 5 of 5

Thread: Issues with StretchBlt() under Windows2000 Pro ?

  1. #1

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    Issues with StretchBlt() under Windows2000 Pro ?

    Howdy.

    I've developed an app, as a college project, that performs a traceroute to a number of different hosts, and then displays the routes graphically.
    I got some nice pics off Sastraxi (which I think he probably "borrowed" from Windows), and was originally BitBlt'ing them onto a picturebox. But it was getting a bit cluttered.
    So I decided I would StretchBlt into the picturebox and reduce the pictures by 1.5

    So thats what I did. It works absolutely perfectly on my WinME laptop, but when I went into college to test it yesterday, StretchBlt didn't seem to be doing its thang.

    The images werent being displayed, but, after I loaded the app for about the 3rd or 4th time, the images were being displayed.
    I'm also setting the StretchBlt mode to HalfTone if thats of any consequence...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  2. #2
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    Do you shrink all nodes by 1.5? If so, why don't you just rip the original picture from Windows and shrink that?

    Btw, just tested StretchBlt here with Windows 2000 (halftone? what? how? where?), works fine, maybe an ancient video card?
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  3. #3

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    I suppose I could just shrink them... hadnt thought of that

    Oh and to set the StretchBlt mode, you just use the SetStretchBltMode() API :

    VB Code:
    1. Public Declare Function SetStretchBltMode Lib "gdi32" (ByVal hdc As Long, ByVal nStretchMode As Long) As Long
    2.  
    3. Public Const BLACKONWHITE As Long = 1
    4. Public Const WHITEONBLACK As Long = 2
    5. Public Const COLORONCOLOR As Long = 3
    6. Public Const HALFTONE As Long = 4

    Quote from MSDN on it :

    SetStretchBltMode
    The SetStretchBltMode function sets the bitmap stretching mode in the specified device context.

    int SetStretchBltMode(
    HDC hdc, // handle to device context
    int iStretchMode // bitmap stretching mode
    );

    Parameters
    hdc
    Handle to the device context.

    iStretchMode
    Specifies the stretching mode. It can be one of the following values: Value Description


    BLACKONWHITE Performs a Boolean AND operation using the color values for the eliminated and existing pixels. If the bitmap is a monochrome bitmap, this mode preserves black pixels at the expense of white pixels.
    COLORONCOLOR Deletes the pixels. This mode deletes all eliminated lines of pixels without trying to preserve their information.
    HALFTONE Maps pixels from the source rectangle into blocks of pixels in the destination rectangle. The average color over the destination block of pixels approximates the color of the source pixels.
    WHITEONBLACK Performs a Boolean OR operation using the color values for the eliminated and existing pixels. If the bitmap is a monochrome bitmap, this mode preserves white pixels at the expense of black pixels.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  4. #4
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    Shrinking would be easier/faster/less code



    Tested again (SetStretchBltMode , great function!), works fine...
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  5. #5

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Yes shrinking would be easier.
    I shall do that instead
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

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