ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦p¦ó±oª¾ Data.GetText ªº¨Ó·½¬O¨Ó¦Û listbox1 ©Î ,listbox2?

[µo°Ý] ¦p¦ó±oª¾ Data.GetText ªº¨Ó·½¬O¨Ó¦Û listbox1 ©Î ,listbox2?

¤S¥d¦í¤F¡I½Ð¥ý¶i¤j¤j­Ì¨ó§U
°ÝÃD¦b¦P¤@userform1¤º§tlistbox1,listbox2,listbox3
¨ä¤¤ listbox1±N¸ê®Æ©ì¦²µ¹Comd1(±ý­­¨î¨ä¥LComdµLªk±µ¨ü)
         listbox2±N¸ê®Æ©ì¦²µ¹Comd2~Comd5(±ý­­¨î¨ä¥LComdµLªk±µ¨ü)µ¥µ¥
§Ú¨Ï¥Î¦p¤U  §Q¥Îclass1
Option Explicit
Dim newcontrol() As New Class1
Private Sub UserForm_Initialize()
     ReDim newcontrol(26)
    For i = 0 To 25
        Set newcontrol(i).Comd = Controls("CommandButton" & i + 1)
        newcontrol(i).Comd.Caption = ""
    Next
    listupdate1
    listupdate3
End Sub

Private Sub ListBox1_MouseMove(ByVal Button As  Integer, ByVal Shift As Integer, ByVal X As   Single, ByVal Y As Single)
    Dim MyDataObject As DataObject
    On Error Resume Next
    If Button = 1 Then
        Set MyDataObject = New DataObject
        Dim Effect As Integer
        MyDataObject.SetText ListBox1.Value
        Effect = MyDataObject.StartDrag
    End If
    On Error GoTo 0
End Sub
Private Sub ListBox3_MouseMove(ByVal Button As  Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    Dim MyDataObject As DataObject
    On Error Resume Next
    If Button = 1 Then
        Set MyDataObject = New DataObject
        Dim Effect As Integer
        MyDataObject.SetText ListBox3.Value
        Effect = MyDataObject.StartDrag
    End If
    On Error GoTo 0
End Sub
class1
Private Sub Comd_BeforeDragOver(ByVal Cancel As  MSForms.ReturnBoolean, ByVal Data As  MSForms.DataObject, ByVal X As Single, _
    ByVal Y As Single, ByVal DragState As Long, ByVal Effect As MSF  orms.ReturnEffect,  ByVal Shift As Integer)
    Cancel = True
    Effect = 1
End Sub
Private Sub Comd_BeforeDropOrPaste(ByVal  Cancel As MSForms.ReturnBoolean, ByVal Action As Long, ByVal Data As  MSForms.DataObject, ByVal X As Single, _
    ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
    Dim am%, row1%, mod1%, n1%, i%
    Dim n%
    Dim str1 As String
    Dim ss1%, ss2%, ss3%
    Dim ss4 As Variant
    Cancel = True
    Effect = 1
    am = Len(Comd.Name)
        If am = 14 Then
            str1 = Right(Comd.Name, 1)
        ElseIf am = 15 Then
            str1 = Right(Comd.Name, 2)
        End If
        n = CInt(str1)
    If n = 1 Then Comd.Caption = Data.GetText

´N±Ð©ó¦U¦ì¤j¤j
        ¦p¦ó±oª¾  Data.GetText ªº¨Ó·½¬O¨Ó¦Û  listbox1   ©Î    ,listbox2?

¤S¥d¦í¤F¡I½Ð¥ý¶i¤j¤j­Ì¨ó§U
´N±Ð©ó¦U¦ì¤j¤j
        ¦p¦ó±oª¾  Data.GetText ªº¨Ó·½¬O¨Ó¦Û  listbox1   ©Î    ,listbox2? ...
yangjie µoªí©ó 2012-9-4 00:51


³o¸Ì´£¨Ñ¤@­Ó§Ú­è­è·Q¨ìªº¤èªk¨Ñ§A°Ñ¦Ò:
§A¥i¥H§Q¥Î ListBox ©ó¤W­z°Ê§@¤¤¥²µM(©Î¥i½T©w°Ê§@¤w§¹¦¨©Ò)·|µo¥Íªº¨Æ¥ó,
¦b¸Ó¨Æ¥óµ{§Ç¤¤§ì¨ú¸Ó ListBox ªº¦WºÙ,
¦A¾Ú¥H³]©w¬Y­Ó¥þ°ìÅܼÆ,
³o¼Ë¦b¸Óµ{§Ç¤¤À³¸Ó´N¯à§PÂ_¥X¨Ó·½¬O­þ­Ó ListBox ¤F.

¹ê¨Ò½Ð®¤§Ú¼È®É°µ¤£¥X¨Ó.

TOP

¦^´_ 2# luhpro
ÁÂÁÂ
­Ó¤H·Q¨ì¤@­Ó¤èªk¬O¥i¥H¸Ñ¨M
¥Îpublic flag as string
©ó  sub ListBox1_MouseMove¤º
¤U  flag="ListBox1"
©ó  sub ListBox2_MouseMove¤º
¤U  flag="ListBox2"   
©ó
Private Sub TextBox1_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
    Cancel = True
    Effect = 1
    If flag = "listbox1" Then TextBox1.Text = Data.GetText
'«ü©w¨Ó·½  ¤~¥i IJµo   Data.GetText ¤§ paste°Ê§@
End Sub

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2012-9-8 06:31 ½s¿è
¦^´_  luhpro
ÁÂÁÂ
­Ó¤H·Q¨ì¤@­Ó¤èªk¬O¥i¥H¸Ñ¨M
¥Îpublic flag as string
©ó  sub ListBox1_MouseMove ...
yangjie µoªí©ó 2012-9-5 07:27


MouseMove ¬O¥i¥H°µ¨ì°Õ,
¤£¹L¦³¥i¯à·|¦³¹L¦h¦¸¤£¥²­nªºÄ²µo
(·Æ¹«¦ì¸m¥u­n²¾°Ê´N·|³QIJµo,§Y¨Ï¥u¬O±N·Æ¹«²¾Â÷¸Ó«ö¶sªº¹Lµ{¤¤¤]·|IJµo¦h¦¸),
¾É­Pµ{¦¡°Ê§@³Q©ìºC©ÎÀWÁcÅܧó¸Ó­È.

­Ó¤H¤ñ¸û¶É¦V·Æ¹«¥ªÁä«ö¤U©Î¼u°_®É¤~³]©w¸Ó­È
(§YMouseDown »P MouseUp ¨Æ¥ó,¤@¯ë¤j³£·|¥Î MouseUp ¦]¬° MouseDown «á­Y°µ©ì¦²°Ê§@,¨º¼Ë¥i¯à·|§ì¿ù¼Ðªº),
¤]´N¬O§¹¦¨°Ê§@¥²©w·|IJµoªº¨Æ¥ó,
¦ý¤S¤£·|¦³¸û¦h¦¸ªºÄ²µo(³Ì¦n¬O¥u·|IJµo¤@¦¸),
³o¼Ë©Î³\·|¤ñ¸û¦n.

TOP

¦^´_ 4# luhpro
ÁÂÁÂ
MouseMove ¬O¦]¬° »Ý­n©ì¦²°Ê§@,
³o¦¸­Ó¤H¬O¨Ï¥Î  sub listbox1_Click()
          flag="listbox1" ¦p¦¹¤@¨Ó¡A¥u­n©ì¦²°Ê§@¦³«hÃѧOºXflag´NÁ|ºX

TOP

        ÀR«ä¦Û¦b : ¦¨¥\¬OÀuÂIªºµo´§¡A¥¢±Ñ¬O¯ÊÂIªº²Ö¿n¡C
ªð¦^¦Cªí ¤W¤@¥DÃD