⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 io_label.ctl

📁 VB通过PPI协议访问S7-200 PLC的源程序,
💻 CTL
字号:
VERSION 5.00
Begin VB.UserControl IO_Label 
   BackStyle       =   0  '透明
   ClientHeight    =   1365
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   4530
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   12
      Charset         =   134
      Weight          =   700
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ScaleHeight     =   1365
   ScaleWidth      =   4530
   Begin VB.Frame Frame1 
      Height          =   1335
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   4455
      Begin VB.Label Label8 
         BackStyle       =   0  'Transparent
         Caption         =   ".7"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Left            =   3960
         TabIndex        =   8
         Top             =   240
         Width           =   255
      End
      Begin VB.Label Label7 
         BackStyle       =   0  'Transparent
         Caption         =   ".6"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Left            =   3480
         TabIndex        =   7
         Top             =   240
         Width           =   255
      End
      Begin VB.Label Label6 
         BackStyle       =   0  'Transparent
         Caption         =   ".5"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Left            =   3000
         TabIndex        =   6
         Top             =   240
         Width           =   255
      End
      Begin VB.Label Label5 
         BackStyle       =   0  'Transparent
         Caption         =   ".4"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Left            =   2520
         TabIndex        =   5
         Top             =   240
         Width           =   255
      End
      Begin VB.Label Label4 
         BackStyle       =   0  'Transparent
         Caption         =   ".3"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Left            =   2040
         TabIndex        =   4
         Top             =   240
         Width           =   255
      End
      Begin VB.Label Label3 
         BackStyle       =   0  'Transparent
         Caption         =   ".2"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Left            =   1560
         TabIndex        =   3
         Top             =   240
         Width           =   255
      End
      Begin VB.Label Label2 
         BackStyle       =   0  'Transparent
         Caption         =   ".1"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Left            =   1080
         TabIndex        =   2
         Top             =   240
         Width           =   255
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   ".0"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Left            =   600
         TabIndex        =   1
         Top             =   240
         Width           =   255
      End
      Begin VB.Shape Shape1 
         FillColor       =   &H00E0E0E0&
         FillStyle       =   0  'Solid
         Height          =   495
         Index           =   7
         Left            =   3960
         Top             =   600
         Width           =   255
      End
      Begin VB.Shape Shape1 
         FillColor       =   &H00E0E0E0&
         FillStyle       =   0  'Solid
         Height          =   495
         Index           =   6
         Left            =   3480
         Top             =   600
         Width           =   255
      End
      Begin VB.Shape Shape1 
         FillColor       =   &H00E0E0E0&
         FillStyle       =   0  'Solid
         Height          =   495
         Index           =   5
         Left            =   3000
         Top             =   600
         Width           =   255
      End
      Begin VB.Shape Shape1 
         FillColor       =   &H00E0E0E0&
         FillStyle       =   0  'Solid
         Height          =   495
         Index           =   4
         Left            =   2520
         Top             =   600
         Width           =   255
      End
      Begin VB.Shape Shape1 
         FillColor       =   &H00E0E0E0&
         FillStyle       =   0  'Solid
         Height          =   495
         Index           =   3
         Left            =   2040
         Top             =   600
         Width           =   255
      End
      Begin VB.Shape Shape1 
         FillColor       =   &H00E0E0E0&
         FillStyle       =   0  'Solid
         Height          =   495
         Index           =   2
         Left            =   1560
         Top             =   600
         Width           =   255
      End
      Begin VB.Shape Shape1 
         FillColor       =   &H00E0E0E0&
         FillStyle       =   0  'Solid
         Height          =   495
         Index           =   1
         Left            =   1080
         Top             =   600
         Width           =   255
      End
      Begin VB.Shape Shape1 
         FillColor       =   &H00E0E0E0&
         FillStyle       =   0  'Solid
         Height          =   495
         Index           =   0
         Left            =   600
         Top             =   600
         Width           =   255
      End
   End
End
Attribute VB_Name = "IO_Label"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'数字输入输出控件

Private IO_Value As Integer

Private mstrCaption

Private mBackColor As Long

Public Property Get Caption() As String

  Caption = mstrCaption
  
End Property


Public Property Let Caption(ByVal newValue As String)
  
  mstrCaption = newValue
  
  PropertyChanged "Caption"
  
  Frame1.Caption = newValue

End Property

Public Property Get BackColor() As OLE_COLOR

  BackColor = mBackColor

End Property

Public Property Let BackColor(ByVal newBackColor As OLE_COLOR)

  mBackColor = newBackColor

  Frame1.BackColor = newBackColor

  PropertyChanged ("BackColor")
  
End Property

Public Property Get Value() As Integer
  
  Value = IO_Value
  
End Property

Public Property Let Value(ByVal pVal As Integer)
    
  Dim i As Integer, Temp As Integer, IOState(7) As Boolean
  
  IO_Value = pVal Mod 256
  
  Temp = pVal Mod 256
  
  For i = 7 To 0 Step -1
  
      IOState(i) = Temp \ 2 ^ i
    
      Temp = Temp Mod 2 ^ i
      
      If IOState(i) Then
      
         Shape1(i).FillColor = &HFF00&
         
      Else
      
         Shape1(i).FillColor = &HE0E0E0
         
      End If
      
  Next i
      
End Property

Private Sub UserControl_InitProperties()

  Caption = Extender.Name

End Sub

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

  Caption = PropBag.ReadProperty("caption", Extender.Name)
  
  Value = PropBag.ReadProperty("value", 0)
  
  BackColor = PropBag.ReadProperty("BackColor", &H8000000F)

End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

  PropBag.WriteProperty "caption", Caption
  
  PropBag.WriteProperty "value", Value
  
  PropBag.WriteProperty "BackColor", BackColor

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -