|
-
Nov 15th, 2001, 03:15 AM
#1
Thread Starter
Retired VBF Adm1nistrator
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]
-
Nov 15th, 2001, 03:47 AM
#2
Fanatic Member
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)
-
Nov 15th, 2001, 03:54 AM
#3
Thread Starter
Retired VBF Adm1nistrator
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:
Public Declare Function SetStretchBltMode Lib "gdi32" (ByVal hdc As Long, ByVal nStretchMode As Long) As Long
Public Const BLACKONWHITE As Long = 1
Public Const WHITEONBLACK As Long = 2
Public Const COLORONCOLOR As Long = 3
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]
-
Nov 15th, 2001, 04:01 AM
#4
Fanatic Member
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)
-
Nov 15th, 2001, 04:08 AM
#5
Thread Starter
Retired VBF Adm1nistrator
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|