????? ????? ????? ??? ????? ?? Visual Basic 6.0 ???? ????

?????? ????????? ?????? ?????????
???? ???????: 190670 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? Visual Basic 6.0 ???? ???? ????? ???? ???? ??? ????? ????? ??? ??????? ??????? ??????? Add ????? ?? ?????? ????? ??????. ???? ??? ?????? ????? ????? ???? ???? ??????? ?????? ???? ActiveX.

??????? ????

?????? ?????? ???? ???? ?????? ????? ???? ???? ???? ActiveX ???? ??? ????? ????? ??? ???????. ??????? ???? ????? ?????? ????? ???? ?????? ??????? ??????????. ??? ??? ???? ???? ???? ?????? ???? ???? ???? ??? ??????? ?? ???????? ?? ????? ??? ????? ????? ????? ???? ?????? ??? ?????? ????????. ?????? ??? ???? ?? ????????? ??? ?????? ???????? ?????? ?????? ??? "???????" ?? ??? ???????.

??? ?????? ????? ???? ?????? ??????? ???? ???? ??? ???? ??????? ?????? ???????? ???? ??? ?????? ??? ????? ???? ??????. ??? ?? ??? ???? ??????? ?????? ???????? ???? ??? ????? ?????? ??? ?????? ??? ????? ?????? ???? ??????.

?????? ?????? ??? ????? ?????? ???? ??????? ?????? ???????? ???? ????? ?? ???? ????? ??? ???????:
"?? ????? ?????? ??? ??????? ?? ??? ???????."
????? ??? ????? ???? ???? ActiveX ???? ???? ???????? ?????? VBControlExtender ? WithEvents ?? ????? declare ? ??? ??????? ??????? ObjectEvent ??? ???? ????? ???? ??????. ??? ??? ???? ?????? ???? ???? ???? WithEvents ??? ???? ??? ???? ????? ????? ???????? ???? ???? ?????? ???? ?? ???????. ????? ?????? ??? ?? ???? ????? ??????? ?????? ??????? ?? ???? ????????? ???????? ?? ?????? ?? ??????? ???????? ????? ?????? ?????? ?? ???? ????????? ????????:
Dim WithEvents cmdMyCommand as VB.CommandButton
				

??????? ??????? ?????? ????? ?????

  1. ????? ????? EXE ????? ????. ??? ????? Form1 ???? ???????.
  2. ?? ?????? ????????? ???????? ??????? ??? ???? ????????? ???????? ?????? Form1:
    Option Explicit
    ' If you are adding an ActiveX control at run-time that is
    ' not referenced in your project, you need to declare it
    ' as VBControlExtender.
    Dim WithEvents ctlDynamic As VBControlExtender
    Dim WithEvents ctlText As VB.TextBox
    Dim WithEvents ctlCommand As VB.CommandButton
    
    Private Sub ctlCommand_Click()
       ctlText.Text = "You Clicked the Command button"
    End Sub
    
    Private Sub ctlDynamic_ObjectEvent(Info As EventInfo)
       ' test for the click event of the TreeView
       If Info.Name = "Click" Then
          ctlText.Text = "You clicked " & ctlDynamic.object.selecteditem.Text
       End If
    End Sub
    
    Private Sub Form_Load()
       Dim i As Integer
       ' Add the license for the treeview to the license collection.
       ' If the license is already in the collection you will get
       ' the run-time error number 732.
       Licenses.Add "MSComctlLib.TreeCtrl"
    
       ' Dynamically add a TreeView control to the form.
       ' If you want the control to be added to a different
       ' container such as a Frame or PictureBox, you use the third
       ' parameter of the Controls.Add to specify the container.
       Set ctlDynamic = Controls.Add("MSComctlLib.TreeCtrl", _
                        "myctl", Form1)
       ' set the location and size of the control.
       ctlDynamic.Move 1, 1, 2500, 3500
    
       ' Add some nodes to the control.
       For i = 1 To 10
          ctlDynamic.object.nodes.Add Key:="Test" & Str(i), Text:="Test" _
                                            & Str(i)
          ctlDynamic.object.nodes.Add Relative:="Test" & Str(i), _
                               Relationship:=4, Text:="TestChild" & Str(i)
       Next i
       
       ' Make the control visible.
       ctlDynamic.Visible = True
    
       ' add a textbox
       Set ctlText = Controls.Add("VB.TextBox", "ctlText1", Form1)
       ' Set the location and size of the textbox
       ctlText.Move (ctlDynamic.Left + ctlDynamic.Width + 50), _
                     1, 2500, 100
    
       ' Change the backcolor.
       ctlText.BackColor = vbYellow
    
       ' Make it visible
       ctlText.Visible = True
    
       ' Add a CommandButton.
       Set ctlCommand = Controls.Add("VB.CommandButton", _
                        "ctlCommand1", Form1)
    
       ' Set the location and size of the CommandButton.
       ctlCommand.Move (ctlDynamic.Left + ctlDynamic.Width + 50), _
                        ctlText.Height + 50, 1500, 500
    
       ' Set the caption
       ctlCommand.Caption = "Click Me"
    
       ' Make it visible
       ctlCommand.Visible = True
    End Sub
    						
  3. ??? ??????? ???????. ???? ????? ??? CommandButton ??? ??? ?????? ?? TreeView. ????? ???? ?? ????? ???.

?????

?????? ??? ???? ?? ?????????? ?????? ?????? ??????? ??????? ?? "????? ??????? ?? Microsoft:

188577????? ?? ?? "?????? ?????? ????????? ??" ?

????? ????? "??????? ?????" ?? ???????? ???????:
  • ????? ????? (?????? ????? ??????)
  • ????? ????? (?????? ??????)

???????

???? ???????: 190670 - ????? ??? ??????: 13/????? ??????/1425 - ??????: 2.1
????? ???
  • Microsoft Visual Basic 6.0 Learning Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
????? ??????: 
kbmt kbctrlcreate kbfaq kbhowto KB190670 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????190670

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com