Langkahnya sbb.:
1. tambahkan modul dalam project Anda, dgn nama (misalnya) modResize
2. Copy paste source code berikut dalam modul modResize tbs.

'-------------- awal modResize ---------------
Option Explicit
Private Type ControlSize 'to store control dimensions
    RatioHeight As Single
    RatioWidth As Single
    RatioTop As Single
    RatioLeft As Single
End Type
Private Type SizeOfFont 'store font sizes
    TheFont As Single
End Type
Private Type LineSize 'store, you guessed it, line sizes
    LLeft As Single
    LWidth As Single
    LTop As Single
    LHeight As Single
End Type
Dim OriginalHeight As Single
Dim OriginalWidth As Single
Dim NewWidth As Single
Dim NewHeight As Single
Dim HeightChange As Single
Dim WidthChange As Single
Dim LineCount As Integer
Dim aForm As Form
Dim LastFormUsed As String
Private LineSizes() As LineSize
Private ctlSizeArray() As ControlSize
Private FontArray() As SizeOfFont
Private Sub SizeData(aForm As Form)
Dim ctl As Control
Dim i As Integer
Dim j As Integer
On Error Resume Next
Linecounter aForm
ReDim FontArray(0 To aForm.Controls.Count - 1)
ReDim ctlSizeArray(0 To aForm.Controls.Count - 1)
ReDim LineSizes(0 To LineCount - 1)
    For Each ctl In aForm.Controls
        If TypeOf ctl Is Line Then
            OriginalWidth = aForm.ScaleWidth
            OriginalHeight = aForm.Height
            With LineSizes(j)
                    .LLeft = ctl.X1  'save line positions
                    .LWidth = ctl.X2
                    .LTop = ctl.Y1
                    .LHeight = ctl.Y2
            End With
            j = j + 1
            Else
            With ctlSizeArray(i)
                .RatioHeight = ctl.Height / aForm.ScaleHeight
                .RatioWidth = ctl.Width / aForm.ScaleWidth
                .RatioTop = ctl.Top / aForm.ScaleHeight
                .RatioLeft = ctl.Left / aForm.ScaleWidth
            End With
        End If
            If TypeName(ctl) = "RichTextBox" Then
                FontArray(i).TheFont = aForm.Controls(i).Font.Size /
aForm.ScaleWidth
            Else
                FontArray(i).TheFont = aForm.Controls(i).FontSize /
aForm.ScaleWidth
            End If
    i = i + 1
    Next
End Sub
Public Sub Resize(aForm As Form)
Dim ctl As Control
Dim i As Integer
Dim j As Integer
Static CountSwitch As Integer
On Error Resume Next
    If aForm.Name <> LastFormUsed Then
        ReDim LineSizes(0)
        ReDim ctlSizeArray(0)
        ReDim FontArray(0)
        LastFormUsed = aForm.Name
        CountSwitch = 0
    End If
If CountSwitch = 0 Then
    SizeData aForm
    CountSwitch = 1
End If
For Each ctl In aForm
    If TypeOf ctl Is Line Then 'deal with lines
        LineSizer j, ctl, aForm
        j = j + 1
    Else
        If TypeOf ctl Is DriveListBox Or TypeOf ctl Is ComboBox Then
            BoxSizer ctl, i, aForm
        Else
            If TypeOf ctl Is Image Then
                ctl.Stretch = True
                ImageSizer ctl, i, aForm
            Else
                With ctlSizeArray(i)
                    aForm.Controls(i).Move .RatioLeft * aForm.ScaleWidth,
.RatioTop * aForm.ScaleHeight, _
                    .RatioWidth * aForm.ScaleWidth, .RatioHeight *
aForm.ScaleHeight
                End With
            End If
        End If
    End If
    If TypeName(ctl) = "RichTextBox" Then
        aForm.Controls(i).Font.Size = FontArray(i).TheFont *
aForm.ScaleWidth
    Else
        aForm.Controls(i).FontSize = FontArray(i).TheFont * aForm.ScaleWidth
    End If
i = i + 1
Next
End Sub
Private Sub Linecounter(aForm As Form) 'count lines, if any
Dim ctl As Control
    For Each ctl In aForm
        If TypeOf ctl Is Line Then
            LineCount = LineCount + 1
        End If
    Next
End Sub
Private Sub BoxSizer(ctl As Control, i As Integer, aForm As Form)
    With ctlSizeArray(i)
        aForm.Controls(i).Move .RatioLeft * aForm.ScaleWidth
        ctl.Width = .RatioWidth * aForm.ScaleWidth
        ctl.Top = .RatioTop * aForm.ScaleHeight
    End With
End Sub
Private Sub LineSizer(j As Integer, ctl As Control, aForm As Form)
        NewWidth = aForm.ScaleWidth - OriginalWidth
        NewHeight = aForm.ScaleHeight - OriginalHeight
        HeightChange = aForm.ScaleHeight / OriginalHeight
        WidthChange = aForm.ScaleWidth / OriginalWidth
        With LineSizes(j)
            ctl.Y1 = .LTop * HeightChange
            ctl.Y2 = .LHeight * HeightChange
            ctl.X1 = .LLeft * WidthChange
            ctl.X2 = .LWidth * WidthChange
        End With
End Sub
Private Sub ImageSizer(ctl As Control, i As Integer, aForm As Form)
    With ctlSizeArray(i)
       aForm.Controls(i).Move .RatioLeft * aForm.ScaleWidth, .RatioTop *
aForm.ScaleHeight, _
       .RatioWidth * aForm.ScaleWidth, .RatioHeight * aForm.ScaleHeight
    End With
End Sub
'-------- akhir modResize -------------

3. Masukkan code yg akan di eksekusi saat form di resize sbb:

Private Sub Form_Resize()
     modResize.Resize Me
End Sub


Semoga berguna

Widyo Rio
http://www.bursaneka.com/rumpi


  ----- Original Message -----
  From: Darminto
  To: [email protected]
  Sent: Saturday, November 12, 2005 12:38 AM
  Subject: [Programmer-VB] object ditengah form


  Supaya sebuah object (misalnya picture box) tetap berada di tengah form,
setelah form di resize gimana ya....



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/k7folB/TM
--------------------------------------------------------------------~-> 

Untuk keluar dari millis ini, kirim email kosong ke:
[EMAIL PROTECTED]

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/Programmer-VB/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Kirim email ke