惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
The Register - Security
The Register - Security
量子位
Security Latest
Security Latest
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
MyScale Blog
MyScale Blog
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
Jina AI
Jina AI
博客园 - 【当耐特】
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
宝玉的分享
宝玉的分享
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
有赞技术团队
有赞技术团队
T
Tor Project blog
H
Hacker News: Front Page
A
Arctic Wolf
NISL@THU
NISL@THU
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
V
V2EX
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
I
InfoQ
D
Docker
L
LINUX DO - 最新话题
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42

博客园 - 岳洋

网上较好的提取链接的正则表达式 下载网页源代码的程序 一个读取网页源代码的小程序 file manager 0.1 circleliner阅读笔记 panel的使用 用于学习鼠标作图的网页。 写文件时换行的问题[转载] by 東風耐候 - 岳洋 用旧方法文件读写 - 岳洋 - 博客园 Birthday Reminder Framework 1.1版本 Birthday Reminder (R Edition) ver1.0 build 050813正式发布! 050627ReciteDemo0.2 050626诗歌背诵程序demo 050615 B-A-M v1.0源代码 050615 Bact.-Anti-Med.ver1.0正式发布! 新建一个按钮至少需要做的事情…… 我决定不再和窗体设计器争生意了! 050614Bact.-Anti-Med.v0.3最新更新 按钮的突然消失!(小记一次编程失误)
关键词:vb.net 扑克 cards.dll
岳洋 · 2006-02-09 · via 博客园 - 岳洋

Posted on 2006-02-09 16:56  岳洋  阅读(585)  评论()    收藏  举报

网上的确有,不过不知道为什么我那里运行不了。这里提供的代码是paint在panel上的。.net真好啊,不用设备上下文,gethdc默认还是隐藏的……我找来找去都找不到这个方法……
几点注意:
1.记得要把dll初始化,function cdtInit。两个参数,在网上找吧。
2.要redraw panel,用:Panel1.Invalidate()。

Public Class Form1
    
Inherits System.Windows.Forms.Form
    
Dim pcards(3As card
    
Dim p As card
    
Dim i As Integer
    
Declare Function cdtInit Lib "cards.dll" (ByRef width As Integer, _
    
ByRef height As IntegerAs Boolean
    
Declare Function cdtDrawExt Lib "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