vb.net 类中的伪 this对象

页面导航:首页 > 软件编程 > vb.net > vb.net 类中的伪 this对象

vb.net 类中的伪 this对象

来源: 作者: 时间:2016-01-18 16:54 【

print?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, ...

print?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", "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, 30, 50) 
    End Sub 
 
End Class 

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", "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, 30, 50)
    End Sub

End Class

 

 

Tags:

文章评论

最 近 更 新
热 点 排 行
Js与CSS工具
代码转换工具

<