blackmap
09-17-2003, 04:10 AM
Hi all,
if the user maximizes the form, the mapcontrol stays the same size. I want to align the control on the form. How to do this. In Delphi this would be Alignment Client. How to do this in VB with the MapPoint Control?
Thanks
Peter
Anonymous
09-24-2003, 08:06 PM
Assuming that you have a Mappoint Control MPCtl1 on your form and you want the control to fill the entire screen, you could do the following with Visual Basic:
Private Sub Form_Resize()
Dim reEntered as Boolean
'Prevent error message when resizing to negative value
If reEntered or Me.WindowState = vbMinimized Then Exit Sub
reEntered = true
MPCtl1.Width = Me.ScaleWidth
MPCtl1.Left = Me.ScaleLeft
MPCtl1.Height = Me.ScaleHeight
MPCtl1.Top = Me.ScaleTop
End Sub
If you want to allign the control with other controls on the form, make adjustments as necessary. For example, if you had a combobox that you wanted to appear above the mappoint control, you would align the combobox using its left and top properties, then set the mappoint control properties:
Dim vPad as Long
vPad = 40 'vertical padding between controls
MPCtl1.Top = Combo1.Top + Combo1.Height + vPad
MPCtl1.Left = Me.ScaleLeft
MPCtl1.Width = Me.ScaleWidth
.
.
.
blackmap
09-25-2003, 01:43 AM
Hi all, hi Guest,
yep, that's what I did. Forgot to post the solution.Sorry for that .
I found it in a vb forum, of course. Here's exactly my code for Form_resize:
Form_Main.MappointControl1.Width = Me.ScaleWidth
Form_Main.MappointControl1.Height = Me.ScaleHeight
Thanks,
Peter