Frame ScaleMode?

TeraBlight
06-07-2005, 04:07 AM
Is there a way to set the coordinate system inside a Frame control?
There doesn't appear to be anything like the Scale[stuff] properties and methods that forms and pictureBoxes have.

In the help, it says that container controls placed on a form default to the default (NOT the current) scale of the form, which is twips. Any way to change that?

Diurnal
06-07-2005, 06:23 AM
The frame control uses the coordinate system of the container it is placed in. If the container scale changes, so will your reference to the frame. When you write the resizing code to move controls inside the frame, use the scalemode of the container.

You can change the scalemode of the container, do your resize, and then change it back.

Option Explicit

Private Sub Form_Resize()

Const BDR_WIDTH As Long = 10

Dim lScale As Long

'Adjust the scalemode.
lScale = Me.ScaleMode
Me.ScaleMode = vbPixels

'Move the control.
Me.Frame1.Move Me.ScaleLeft + BDR_WIDTH, Me.ScaleTop + BDR_WIDTH, _
Me.ScaleWidth - 2 * BDR_WIDTH, Me.ScaleHeight - 2 * BDR_WIDTH

'Reset the scalemode.
Me.ScaleMode = lScale

End Sub

TeraBlight
06-07-2005, 06:53 AM
No, that's not what I mean. Sorry if I was unclear.
I have a label ("Label3") inside a frame ("Frame2") and want to move the label around, whose position is given relative to its container, namely the frame. Now I can't figure out how to change the INTERNAL scale of the frame.


Me.ScaleMode = vbPixels

With Frame2
.Top = 100
.Left = 100
.Height = 100
.Width = 100
.Visible = True
End With

With Label3
.Top = 50
.Left = 50
.Height = 50
.Width = 50
.BackColor = vbRed
.Visible = True
End With


Executing this, I get a 50*50 twips label inside a 100*100 pixel frame.
Sure, I can manually multiply the sizes by the conversion factors, but there should be a way to do this ...?

pebtos
06-07-2005, 08:26 AM
I'm guessing only controls that have a DC, can have a ScaleMode property. The frame doesn't have one.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum