主页面的显示布局应该怎么做?
VB新手,现在需要做这样一个页面,load的时候要最大化,然后窗体分为3部分,左边菜单(用TabStrip),右边的上面是查询(msfelxgrid),右下部分是详细信息(label,text等)。
这3部分初始化的时候有一个比例,但用户可以自己调节大小,这个应该怎么做阿?要用什么控件吗?
[解决办法]
在窗户调整窗体大小时运行的过程
Private Sub Form_Resize()
这里设置你相关控件的大小及left,top 以窗体为单位,注意最小不能任意小要有一个定值,就行了
End Sub
[解决办法]
我觉得应该是Form_Resize()过程中设置。
[解决办法]
这是水平分割的例子
Option Explicit
Private m_Draging As Boolean
Private m_StartX As Single
Private Sub AllDragDrop(target As Control, X As Single, Y As Single)
If m_Draging Then
m_Draging = False
Label1.Left = Label1.Left + (target.Left + X) - m_StartX
Call Form_Resize
End If
End Sub
Private Sub Form_Load()
Label1.MousePointer = vbSizeWE
Label1.Move ScaleWidth / 2, -ScaleHeight, 120, ScaleHeight * 3
End Sub
Private Sub Form_Resize()
On Error Resume Next
Text1.Move 0, 0, Label1.Left, ScaleHeight
Text2.Move Label1.Left + 120, 0, ScaleWidth - Label1.Left - 120, ScaleHeight
End Sub
Private Sub Label1_DragDrop(Source As Control, X As Single, Y As Single)
AllDragDrop Label1, X, Y
End Sub
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
m_Draging = True
m_StartX = Label1.Left + X
Label1.Drag vbBeginDrag
End Sub
Private Sub Text1_DragDrop(Source As Control, X As Single, Y As Single)
AllDragDrop Text1, X, Y
End Sub
Private Sub Text2_DragDrop(Source As Control, X As Single, Y As Single)
AllDragDrop Text2, X, Y
End Sub