Re: Stack over flow?
- From: Mike Williams <gagamomo@xxxxxxxxxxx>
- Date: Wed, 16 Apr 2008 10:42:02 -0700 (PDT)
On 16 Apr, 15:58, "Steve Gerrard" <mynameh...@xxxxxxxxxxx> wrote:
if there is a postable message that
could carry something useful, maybe
just a simple integer parameter . . .
There's one thing I forgot to mention in the code I recently posted
Steve. For the code to work so that the value received is the same as
the value sent you need to set the PictureBox ScaleMode to vbPixels (I
did this in the properties Window in the IDE when writing my example
and so you'll need to add it to the example code).
The reason for this is that VB preprocesses the MouseMove message it
receives from the OS (which of course contains standard default pixel
values) and it converts those values according to the current
ScaleMode of the PictureBox. That's because VB Form and VB PictureBox
DCs always actually use a MapMode of MM_TEXT (pixels) under the hood,
regardless of their VB ScaleMode. For example if you use the
following:
Private Sub Command2_Click()
sTest = "A"
PostMessage Picture1.hwnd, _
WM_MOUSEMOVE, 0&, 100&
sTest = sTest & "B"
End Sub
.. . . and if the PictureBox ScaleMode is vbPixels then you will also
get a value of 100 in the Single which refers to the x xoordinate in
the PictureBox's MouseMove event. However, if the ScaleMode is vbTwips
you will get a value of 1500 on a machine running at the standard 15
twips per pixel (96 dpi) setting and a value of 1200 on a machine
running at 12 twips per pixel (120 dpi) and various other values on
machines running at any of the various other possible twiups per pixel
settings. So, best use a PiuctureBox ScaleMode of pixels to make the
result reliable on all systems in a way that does not require you to
perform any conversions.
Mike
.
- Follow-Ups:
- Re: Stack over flow?
- From: Steve Gerrard
- Re: Stack over flow?
- References:
- Stack over flow?
- From: rick-paulos@xxxxxxxxx
- Re: Stack over flow?
- From: Steve Gerrard
- Re: Stack over flow?
- From: Mike Williams
- Re: Stack over flow?
- From: Steve Gerrard
- Re: Stack over flow?
- From: Mike Williams
- Re: Stack over flow?
- From: Steve Gerrard
- Re: Stack over flow?
- From: Mike Williams
- Re: Stack over flow?
- From: Steve Gerrard
- Stack over flow?
- Prev by Date: Re: Stack over flow?
- Next by Date: Want to buy VB6 compatible Farpoint Spread OCX software. (NOT the .NET version)
- Previous by thread: Re: Stack over flow?
- Next by thread: Re: Stack over flow?
- Index(es):
Relevant Pages
|
|