vb.net 类中的伪 this对象
发布时间:2020-12-17 08:12:47 所属栏目:百科 来源:网络整理
导读:Public Class Form1 Dim z As New zxl Private Sub Form1_Click(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.Click Form2.Show() z.setvalue("123","123",90) z.prinf(Form2) End Sub Private Sub Form1_Load(ByVal sender As System.O
Public Class Form1
Dim z As New zxl
Private Sub Form1_Click(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.Click
Form2.Show()
z.setvalue("123","123",90)
z.prinf(Form2)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.Load
z.setvalue("123",90)
'z.prinf(Me)
End Sub
Private Sub Form1_Paint(ByVal sender As Object,ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
z.prinf(Me)
End Sub
End Class
Public Class zxl
Private Structure zx
Public no As String
Public name As String
Public score As Integer
End Structure
Dim this As New zx
Public Sub setvalue(ByVal no,ByVal name,ByVal score)
this.no = no : this.name = name : this.score = score
End Sub
Public Sub prinf(ByVal frm As Form)
Dim g As Graphics = frm.CreateGraphics
Dim f As Font = New Font("楷体",30,FontStyle.Bold)
Dim br As SolidBrush = New SolidBrush(Color.Black)
g.DrawString(this.no & " " & this.name & " " & this.score,f,br,50)
End Sub
End Class
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
