欢迎来到飞鸟慕鱼博客,开始您的技术之旅!
当前位置: 首页知识笔记正文

关键字:vb.net扑克在cards.dll

终极管理员 知识笔记 112阅读

It does exist, but I don't know why I can't run it there. The code provided here is the paint on the panel. Nice net. Without a device context, gethdc is hidden by default. I can't find this method anywhere. Several points for attention: 1. Remember to initialize dll, function cdtInit. Two parameters, look online. 2. To redraw the panel, please use: panel1.invalid (). Public class form 1. Class form 1 inherits the system. Windows. Form. formdimpcards(3)ascarddimpascarddiasintegerdeclare closed _ Text ' style=' border : 1px solid rgba(128,128,128,1); Display : None; background-color: rgba(255,255,255,1)' FunctioncdtInit()FunctioncdtInitLib ' cards . dll '(ByRef width as integer, _ ByRefheightAsInteger)asbooleandeclaurefunctioncdtddrawext()FunctioncdtDrawExtLib '

1)">cards.dll" (ByVal hdc As IntPtr, _
      
ByVal x As IntegerByVal y As IntegerByVal dx As Integer, _
      
ByVal dy As IntegerByVal card As Integer, _
      
ByVal suit As IntegerByVal color As LongAs Boolean
    
Declare Sub cdtTerm Lib "cards.dll" ()

    
Public Structure card
        
Public face As Integer
        
Public suit As Integer
        
Public count As Integer
        
Public faceup As Boolean
    
End Structure



Windows 窗体设计器生成的代码


    
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
        
Dim ct As Int16 = 0
        
For ct = 1 To 3
            drawcard(pcards(ct), e.Graphics, 
10 + ct * 203075100)
        
Next
        
'For Each p In pcards
        'drawcard(p, e.Graphics, 10 + ct * 10, 30, 75, 100)
        'ct += 1
        'Next

    
End Sub

    
Private Sub drawcard(ByVal t As card, ByVal g As Graphics, ByVal x As Integer, _
     
ByVal y As IntegerByVal dx As IntegerByVal dy As Integer)
        
Dim hdc As IntPtr = g.GetHdc()
        
Try
            
Dim Card As Integer = t.suit * 4 + t.count
            cdtDrawExt(hdc, x, y, dx, dy, Card, 
00)
        
Finally
            
' If Intellisense doesn't show this method 
            ' unhide advanced members in Tools|Options
            g.ReleaseHdc(hdc)
        
End Try
    
End Sub


    
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        cdtInit(
75100)

        
For i = 1 To 3
            pcards(i) 
= New card()
            
With pcards(i)
                .suit 
= i
                .count 
= i + 1
            
End With
        
Next
        Panel1.Invalidate()
    
End Sub

End Class


标签:
声明:无特别说明,转载请标明本文来源!