RT

解决方案 »

  1.   

    不行,如果太长你换行显示,要么你用trimer不断去检测变化情况,但是方法不好ei
      

  2.   


    Dim M_Col As LongPrivate Sub Form_Load()
            Text1.Visible = False
    End SubPrivate Sub MSHFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
            With MSHFlexGrid1
                M_Col = .MouseCol
                Text1.Visible = False
                Text1.Move .Left + .CellLeft, .Top + .CellTop, .CellWidth, .CellHeight
                Text1.Text = .Text
                Text1.Visible = True
                Text1.SetFocus
            End With
    End SubPrivate Sub Text1_Change()
            Dim OleWidth As Long
            Dim NewWidth As Long
            
            With MSHFlexGrid1
                 .Text = Text1.Text
                 OleWidth = Text1.Width
                 NewWidth = TextWidth(Text1.Text)
                 If NewWidth > OleWidth Then
                    .ColWidth(M_Col) = NewWidth
                    Text1.Width = NewWidth
                 End If
            End With
    End Sub