我在窗体中有一个LABEL标签 和combo控件 我想让LABEL的位置随着FORM的扩大而改变。
COMBO控件的宽度随着FORM的扩大 而改变就想IE浏览器一样窗体扩大Combo也跟着加宽 。

解决方案 »

  1.   

    在Form_Size事件里改变Label和Combo的宽度,Lable的宽度使用Lable.Width=nnn,而Combo需要使用API,即:SendMessage YourCombo.hwnd, CB_SETDROPPEDWIDTH, 你想改变的Combo的宽度, ByVal 0& 。
      

  2.   

    用Form的Hight,Width,Top,Left来决定定Label和Combo的对应属性
      

  3.   

    在Load時,記住窗體的Height和Weight,再計算縮放比例,即在Form_Resize事件中獲取最後窗體的Height和Weight,設置以上控件的Weight = Weight * 縮放比例。
      

  4.   

    http://hi.baidu.com/belief85/blog/item/f5278b0842e3c7910b7b8275.html
      

  5.   

    给个简单示例Dim TT, TL, TW, TH As Single
    Dim CT, CL, CW, CH As Single
    Dim LT, LL, LW, LH As Single
    Dim CMT, CML, CMW, CMH As SinglePrivate Sub Form_Load()
        TT = Text1.Top
        TL = Text1.Left
        TW = Text1.Width
        TH = Text1.Height
        '保存Text1控件的Top、Left、Width和Height属性
        CT = Combo1.Top
        CL = Combo1.Left
        CW = Combo1.Width
        CH = Combo1.Height
        '保存Combo1控件的Top、Left、Width和Height属性
        LT = List1.Top
        LL = List1.Left
        LW = List1.Width
        LH = List1.Height
        '保存List1控件的Top、Left、Width和Height属性
        CMT = Command1.Top
        CML = Command1.Left
        CMW = Command1.Width
        CMH = Command1.Height
        '保存Command1控件的Top、Left、Width和Height属性
    End Sub
    Private Sub Form_Resize()
        Form1.ScaleHeight = 1000
        Form1.ScaleWidth = 1000
        Text1.Top = TT
        Text1.Left = TL
        Text1.Width = TW
        Text1.Height = TH
        '设置Text1的位置和大小
        List1.Top = LT
        List1.Left = LL
        List1.Width = LW
        List1.Height = LH
        '设置List1的位置和大小
        Combo1.Top = CT
        Combo1.Left = CL
        Combo1.Width = CW
    '    Combo1.Height = CH
        '设置Combo1的位置和大小
        Command1.Top = CMT
        Command1.Left = CML
        Command1.Width = CMW
        Command1.Height = CMH
        '设置Command1的位置和大小
    End Sub
      

  6.   

    就在Form_Size事件里控制就是了阿,