得到窗体的大小,再按比例改变treeview和listview的heigh和width属性就行了

解决方案 »

  1.   

    我现在已经知道了Form的Width,Height,ScaleWidth,ScaleHeight的属性,
    有什么编程思路吗?烦高手指点!!
      

  2.   

    你得到form的大小,再按照一定的比例改变控件的height和width,就行了
      

  3.   

    1、在Form的resize事件里响应treeview 和listview控件的height、width的值与form的height、width的函数关系就行了。如果没有其他的东西,两控件宽、高之和等于窗体的宽、高。2、好像有个这样的控件,其实自己编写也不难呀,还是响应鼠标事件中treeview 和listview控件的width的值之间的函数关系(这是窗体的大小不变,两个之和为窗体的和)。
      

  4.   

    dsclub(▁▂▃▄▅▆▇█ 騩鹬) 说得对。
    2仔细观察一下别人的软件,大多数是这样做的,只需要加一个PictureBox控件,改成长条形。
    在picturebox的MouseDown,MouseUp,MouseMove事件中加入一些代码,如mouseDown中加入判断,只有按下鼠标才能拖动,
    mouseMove中加入判断函数,主要是鼠标的位置,
    mouseUp中把PictureBox的位置放在你想要的位置,再调整TreeView,ListView的位置,大小
      

  5.   

    第一个 问题:Dim FrmW As Single '存放改变前的窗体的宽度
    Dim frmH As Single '存放改变前的窗体的高度Private Sub Form_Load()
    If WindowState <> vbMinimized Then
       FrmW = Me.Width
       frmH = Me.Height
       '上面两句是初始化模块变量
    End If
    End SubPrivate Sub Form_Resize()
    If FrmW = 0 Or frmH = 0 Then Exit SubDim MyCon As Control
    Dim sig1 As Single, sig2 As Single
    sig1 = Me.Width / FrmW
    sig2 = Me.Height / frmH
    For Each MyCon In Me.Controls
        If TypeOf MyCon Is Label Or _
            TypeOf MyCon Is CommandButton Or _
            TypeOf MyCon Is ListView Or _
            TypeOf MyCon Is TextBox Or _
            TypeOf MyCon Is Toolbar Or _
            TypeOf MyCon Is SSTab Or _
            TypeOf MyCon Is PictureBox Or _
            TypeOf MyCon Is CheckBox Or _
            TypeOf MyCon Is OptionButton Or _
            TypeOf MyCon Is Frame Then
            
            With MyCon
          '       MsgBox .Name
                .Left = Int(.Left * sig1)
                .Top = Int(.Top * sig2)
                .Width = Int(.Width * sig1)
                .Height = Int(.Height * sig2)
            End With
            
        End If
    Next MyCon
       
    For Each MyCon In Me.Controls
    If TypeOf MyCon Is ComboBox Then
       With MyCon
            .Left = Int(.Left * sig1)
            .Top = Int(.Top * sig2)
            .Width = Int(.Width * sig1)
       End With
    End If
    Next MyConFrmW = Me.Width
    frmH = Me.HeightEnd Sub
      

  6.   

    第一个 问题:Dim FrmW As Single '存放改变前的窗体的宽度
    Dim frmH As Single '存放改变前的窗体的高度Private Sub Form_Load()
    If WindowState <> vbMinimized Then
       FrmW = Me.Width
       frmH = Me.Height
       '上面两句是初始化模块变量
    End If
    End SubPrivate Sub Form_Resize()
    If FrmW = 0 Or frmH = 0 Then Exit SubDim MyCon As Control
    Dim sig1 As Single, sig2 As Single
    sig1 = Me.Width / FrmW
    sig2 = Me.Height / frmH
    For Each MyCon In Me.Controls
        If TypeOf MyCon Is Label Or _
            TypeOf MyCon Is CommandButton Or _
            TypeOf MyCon Is ListView Or _
            TypeOf MyCon Is TextBox Or _
            TypeOf MyCon Is Toolbar Or _
            TypeOf MyCon Is SSTab Or _
            TypeOf MyCon Is PictureBox Or _
            TypeOf MyCon Is CheckBox Or _
            TypeOf MyCon Is OptionButton Or _
            TypeOf MyCon Is Frame Then
            
            With MyCon
          '       MsgBox .Name
                .Left = Int(.Left * sig1)
                .Top = Int(.Top * sig2)
                .Width = Int(.Width * sig1)
                .Height = Int(.Height * sig2)
            End With
            
        End If
    Next MyCon
       
    For Each MyCon In Me.Controls
    If TypeOf MyCon Is ComboBox Then
       With MyCon
            .Left = Int(.Left * sig1)
            .Top = Int(.Top * sig2)
            .Width = Int(.Width * sig1)
       End With
    End If
    Next MyConFrmW = Me.Width
    frmH = Me.HeightEnd Sub
      

  7.   

    GANXIAOPENG(种菜的) 
    没有搞错吗?
    不需要这么复杂。
      

  8.   

    TO :ypyao85() 我是从程序中直接拷的了!没有删除多余的东西了!
    SORRY!:)主要就是 TypeOf MyCon Is “控件类型” 了!