VB在桌显示个十字架
- 提问者网友:别再叽里呱啦
- 2021-04-30 11:52
- 五星知识达人网友:行路难
- 2021-04-30 12:58
估计你想创建一个特殊窗体。。。复制以下代码就行了
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楼网友:怙棘
- 2021-04-30 16:43
最关键的是要不影响桌面使用。
1,SetWindowRgn 做成的十字架
2,提取桌面图标容器的句柄,这个可以在网上找到相应的代码
3,用setparent把特殊形状(由SetWindowRgn 做成的十字架)放到桌面图标容器的句柄下。
- 2楼网友:春色三分
- 2021-04-30 15:51
- 3楼网友:你可爱的野爹
- 2021-04-30 15:12
把窗体背景变透明。。。来个LabelBox 里面调好透明,字体等属性后。。。加个TEXTBOX
Label1.Caption = TextBox1.Text
如果想他移动就在个MouseDown MouseMove MouseUP 。。。。
不知道你是不是想这样。如果是我可以给你一些代码。。。
- 4楼网友:洒脱疯子
- 2021-04-30 14:28
- 5楼网友:未来江山和你
- 2021-04-30 14:12
我用窗体透明了可以点到桌面 但加载了图片了就不可以 你用VB的窗体做桌面 可以不要点击吗