发过一个帖 只是说可以动态创建
最后用了控件数组   一个隐藏的控件 然后load它
Static n As Integer 
     
     If n <>0 Then Load Label1(n) 
     Label1(n).Move 300, 200 + n *500 
     Label1(n).Visible = True 
     n = n + 1 
可是这样创建出来的控件 无法拖拉 改变大小
(我是在 softcircuits  的那个可以拖拉控件的程序上改的 这个程序只对预先放在FORM上的控件有效果?)
对于动态创建的control不能在
dim i as long
for i = 0 to controls.count 
里面找到?
那么我该如何解决  这个问题

解决方案 »

  1.   

    脱动我到是做出来了,改变大小还没有想到好的方法
    脱动COMMAND为例
    Option Explicit
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Declare Function ReleaseCapture Lib "user32" () As Long
    Private Const WM_NCLBUTTONDOWN = &HA1
    Private Const HTCAPTION = 2Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    ReleaseCapture
    SendMessage Command1.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0
    End Sub
      

  2.   

    拖拉要自己写你想一个COmmand可以在下面几个事件中间写代码Private Sub Command1_OLECompleteDrag(Effect As Long)End SubPrivate Sub Command1_OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)End Sub
      

  3.   

    Sub ResizeControl(ControlName As Control, FormName As Form)
        bdsnd = Not bdsnd
        Dim NewStyle As Long
        NewStyle = GetWindowLong(ControlName.hwnd, GWL_STYLE)
        If bdsnd = True Then
        NewStyle = NewStyle Or WS_THICKFRAME
        Else
        NewStyle = NewStyle - WS_THICKFRAME
        End If
        NewStyle = SetWindowLong(text(n).hwnd, GWL_STYLE, NewStyle)
        SetWindowPos ControlName.hwnd, FormName.hwnd, 0, 0, 0, 0, SWP_NOZORDER Or SWP_NOSIZE Or SWP_NOMOVE Or SWP_DRAWFRAME
    End Sub不过这种NewStyle = NewStyle - WS_THICKFRAME
    好象很危险  有时候会出现其他的状态
    这是为什么?to daisy8675(莫依)
    应该如何学习WINDOWS程序设计
    现在我都是遇到问题找资料 然后改 
    感觉 自己写不出什么东西  :(
      

  4.   

    http://www.vbaspnew.com/ziyuan/y/ct/n1-27.zip