zoukankan      html  css  js  c++  java
  • 控件作为参数传递

    控件参数传递

     

    Option Explicit
    Private Sub Command1_Click()
        Dim i As Integer
        List1.Visible = True
        List2.Visible = True
        List1.ListIndex = 0
        List2.ListIndex = 0
    End Sub
    Private Sub Form_Load()
        List1.Visible = False
        List2.Visible = False
         With List1
            .AddItem Command1.Name
            .AddItem Check1.Name
            .AddItem List1.Name
            .AddItem List2.Name
            .AddItem Label1.Name
            .AddItem Data1.Name
        End With
        With List2
            .AddItem "0-
    默认"
            .AddItem "1-箭头"
            .AddItem "2-十字线"
            .AddItem "3-I型"
            .AddItem "4-
    图标 "
            .AddItem "5-
    四个方向的箭头"
            .AddItem "6-右上、左下的双箭头"
            .AddItem "7-上下两个方向的双箭头"
            .AddItem "8-左上、右下双箭头"
            .AddItem "9-左右两个方向的双箭头"
            .AddItem "10-向上的箭头"
            .AddItem "11-沙漏"
            .AddItem "12-禁止记号"
            .AddItem "13-箭头和沙漏"
            .AddItem "14-箭头和问号"
            .AddItem "15-四向尺寸线"
            
      End With
      Dim bs As String
    End Sub
    Private Sub List1_Click()
        List2.ListIndex = 0
    End Sub
    Private Sub List2_Click()
         On Error Resume Next
        Select Case List1.Text
               Case Command1.Name
                  Jiance Command1
               Case Check1.Name
                  Jiance Check1
              Case List1.Name
                  Jiance List1
              Case List2.Name
                  Jiance List2
              Case Label1.Name
                  Jiance Label1
              Case Data1.Name
                  Jiance Data1
        End Select
    End Sub
    Private Sub Jiance(xx As Control)
        Select Case List2.Text
                      Case "0-默认"
                           xx.MousePointer = 0
                      Case "1-箭头"
                           xx.MousePointer = 1
                      Case "2-十字线"
                           xx.MousePointer = 2
                      Case "3-I型"
                           xx.MousePointer = 3
                      Case "4-图标 "
                           xx.MousePointer = 4
                      Case "5-四个方向的箭头"
                           xx.MousePointer = 5
                      Case "6-右上、左下的双箭头"
                           xx.MousePointer = 6
                      Case "7-上下两个方向的双箭头"
                           xx.MousePointer = 7
                      Case "8-左上、右下双箭头"
                           xx.MousePointer = 8
                      Case "9-左右两个方向的双箭头"
                           xx.MousePointer = 9
                      Case "10-向上的箭头"
                           xx.MousePointer = 10
                      Case "11-沙漏"
                           xx.MousePointer = 11
                      Case "12-禁止记号"
                           xx.MousePointer = 12
                      Case "13-箭头和沙漏"
                           xx.MousePointer = 13
                      Case "14-箭头和问号"
                           xx.MousePointer = 14
                      Case "15-四向尺寸线"
                           xx.MousePointer = 15
                End Select
    End Sub

     '---------------------------------------------------------------------------------------------

     


    Private Sub Command1_Click()
        example Picture1
    End Sub

    Public Function example(obj As VB.PictureBox) As Boolean
        MsgBox obj.Name
    End Function



    VBScript code

    Option Explicit

    Private Sub Command1_Click()

            TransPit Picture1

    End Sub

     Private Sub Form_Load()

          Picture1.Picture = LoadPicture("c:\tt1.bmp")

     End Sub

     '图片控件作为参数传输

    Private Function TransPit(Pit As PictureBox) As Boolean

            Set Picture2.Picture = Pit.Picture

    End Function

     


    VBScript code

     

    '上面例子是picture1传输到picture2

     

    '这个例子是image1传输到picture1

     

    Option Explicit

     Private Sub Command1_Click()

          TransPit Image1

    End Sub

     Private Sub Form_Load()

          Image1.Picture = LoadPicture("c:\tt1.bmp")

     End Sub

     '图片控件作为参数传输

    Private Function TransPit(Pit As Image) As Boolean

            Set Picture1.Picture = Pit.Picture

    End Function

     

  • 相关阅读:
    魔幻的曲率--已知曲率画图形
    关于填报《国家自然科学基金资助项目结题报告》的补充说明
    关于填报《国家自然科学基金资助项目结题报告》的说明
    浙江大学2015年数学分析考研试题
    Slony-I中对storelisten出错的处理
    PostgreSQL没有redo log multiplexing
    Pgpool烂泥扶不上墙
    集群系统与事务处理需要注意的一点
    Slony-I 文摘
    什么样的日志才是好日志
  • 原文地址:https://www.cnblogs.com/no7dw/p/1612846.html
Copyright © 2011-2022 走看看