永发信息网

VB在桌显示个十字架

答案:6  悬赏:40  手机版
解决时间 2021-05-01 04:34
VB在桌显示个十字架
最佳答案

估计你想创建一个特殊窗体。。。复制以下代码就行了


Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_SYSCOMMAND = &H112
Private Const SC_MOVE = &HF010&
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function Polygon Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Type POINTAPI
    x As Long
    y As Long
End Type
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function CreatePolyPolygonRgn Lib "gdi32" (lpPoint As POINTAPI, lpPolyCounts As Long, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long


Private Sub Form_Load()
Me.BorderStyle = 0
With Me
    .Height = 8000
    .Width = 8000
End With
Me.BackColor = vbBlue
Dim Points(12) As POINTAPI
Points(0).x = 250
Points(0).y = 0
Points(1).x = 250
Points(1).y = 250
Points(2).x = 0
Points(2).y = 250


Points(3).x = 0
Points(3).y = 280
Points(4).x = 250
Points(4).y = 280
Points(5).x = 250
Points(5).y = 500



Points(6).x = 280
Points(6).y = 500
Points(7).x = 280
Points(7).y = 280
Points(8).x = 500
Points(8).y = 280
Points(9).x = 500
Points(9).y = 250
Points(10).x = 280
Points(10).y = 250
Points(11).x = 280
Points(11).y = 0
Points(12).x = 250
Points(12).y = 0


SetWindowRgn Me.hWnd, CreatePolygonRgn(Points(0), 12, 1), True


End Sub


Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
    x = ReleaseCapture()
    Call SendMessage(Me.hWnd, WM_SYSCOMMAND, SC_MOVE + 2, 1)
End If
End Sub

全部回答

最关键的是要不影响桌面使用。

1,SetWindowRgn 做成的十字架

2,提取桌面图标容器的句柄,这个可以在网上找到相应的代码

3,用setparent把特殊形状(由SetWindowRgn 做成的十字架)放到桌面图标容器的句柄下。

新建一个Timer,间隔100,启用,代码:Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As LongPrivate Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Private Sub Timer1_Timer()For i = 0 To 10SetPixel GetDC(0), 5, i, &HFFFF&NextFor i = 0 To 10SetPixel GetDC(0), i, 5, &HFFFF&NextEnd Sub会在屏幕左上角画出一个黄色的十字架,不知道你是不是这意思.

把窗体背景变透明。。。来个LabelBox 里面调好透明,字体等属性后。。。加个TEXTBOX

Label1.Caption =  TextBox1.Text

如果想他移动就在个MouseDown   MouseMove MouseUP 。。。。

不知道你是不是想这样。如果是我可以给你一些代码。。。

窗体上放个有十字架的图片 然后把图片框之外都用api弄成透明

我用窗体透明了可以点到桌面 但加载了图片了就不可以  你用VB的窗体做桌面 可以不要点击吗

我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
巴西龟能力吃吗
美味香火锅我想知道这个在什么地方
XP系统时间制度
从镇江丹阳到江阴周庄开车去多少公里,走哪条
有刷空间留言的网站吗?
比喻不懂尴尬的句子,找朋友不交心的句子
谁有有效的戒烟方法
贵阳市云岩区大营坡和登高小区这一节租屋那有
斯普润市政工程建设公司在什么地方啊,我要过
什么年份的红酒好喝?红洒配什么最好吃?
洛阳乐器买卖好做不?
谁能告诉我该怎样避开在酒局中而不喝酒?
网络 协议下载和安装
能不能用剑屠来打双毒
教师个人格言大全,《保险意义》的名言名句
推荐资讯
mp3连接电脑后下载的歌显示不出来什么原因
最进有什么新番动漫
QQ地战之王的内侧资格
洋酒hennessy斧标1.4斤多少钱
广州~新化、怎么走
E盘无法打开怎么办?
李白的诗中写最高的楼的诗句
fifa online2跪求亚洲球员资料
有关银杏的唯美段落,描写果树的一个很好的一
去上海迪斯尼门票多少,上海迪斯尼在什么地方
谁能帮我开游戏人生拿快来帮我
许留山邻瑞广场店这个地址在什么地方,我要处
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?