Re: Scalemode and picture box size VB5

Tech-Archive recommends: Fix windows errors by optimizing your registry



> a) I have an application which uses a form and within the form a
picturebox.
> The form property 'WiindowState' on startup has been set to Maximized.
> The picturebox does not have a 'WiindowState' property so in the form load
> section I have used the following code to increase the picturebox size to
> match
> the form size:
>
> Picture1.Width = Form1.Width
> Picture1.Height = Form1.Height
> Picture1.ScaleWidth = Form1.ScaleWidth
> Picture1.ScaleHeight = Form1.ScaleHeight
>
> This does not give me the correct results, the picturebox size does not
> match the form size.
> Any ideas please????

The Width/Height properties of the form refer to the client area of the
window, what you want to do is scale the picture box to the non-client area
of the form. Try this instead:

'***
Private Sub Form_Resize()
Call Picture1.Move(0, 0, Me.ScaleWidth, Me.ScaleHeight)
End Sub
'***

> b) The following code is used to construct a rectangle from mouse
positions.
> My application requires scalemode to be set at 6 for millimetre but the
code
> only
> works correctly if scalemode is set to 1 or 3, am I missing something???
<code snipped>

When working at custom scale modes the coordinates may not evaluate to
integer coordinates, so declare your X1/Y1/X2/Y2 variables as Singles and
they will store their original position as opposed to the nearest integer.
Hope this helps,

Mike


- Microsoft Visual Basic MVP -
E-Mail: EDais@xxxxxxxx
WWW: Http://EDais.mvps.org/


.



Relevant Pages

  • Scalemode and picture box size VB5
    ... I have an application which uses a form and within the form a picturebox. ... The form property 'WiindowState' on startup has been set to Maximized. ... Private Sub picture1_MouseDown(Button As Integer, Shift As Integer, X As ...
    (microsoft.public.vb.winapi.graphics)
  • Re: Twips - mm
    ... Nicht nur das Bildfeld (PictureBox) gibt auf dieser Form seine Abmessungen ... in der Masseinheit vbMillimeters zurück sondern alle auf dieser Form ... und dieser Bereich hat wieder seinen eigenen Scalemode. ...
    (microsoft.public.de.vb)
  • Re: Smooth lines in Picturebox
    ... Set your ScaleMode for the PictureBox to vbPixels ... (you would have to do that for APIs anyway) ...
    (microsoft.public.vb.general.discussion)