用LABEL控件可以完成:
在窗口上放上相同的两个LABEL控件,将控件的BACKSTYLE设置为0-TRANSPARENT,将下面那个控件的字体颜色改为阴影颜色,调整两个控件的LEFT和TOP,使文字稍微错位,这样就有了阴影的效果。
根据代码,应该没有问题才对……我知道用GDI+绘制阴影
1.创建DC
2.创建bitmap
3.初始化UpdateLayeredWindow各种参数
4.GDI+画阴影(或者GDI绘制阴影)
5.UpdateLayeredWindow
还可以用SetPixel自己画上去…………
设置全局变量:
Dim drag As BooleanDim mousex As Integer
Dim mousey As Integer
假设你想拖动的是Panel1控件,以及此控件上的 Label1(用于显示标题)和PictureBox4(用于显示图标):
Private Sub TitleMove_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown, Label1.MouseDown, PictureBox4.MouseDown
drag = True
mousex = Windows.Forms.Cursor.Position.X - Me.Left
mousey = Windows.Forms.Cursor.Position.Y - Me.Top
End Sub
Private Sub TitleMove_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove, Label1.MouseMove, PictureBox4.MouseMove
If drag Then
Me.Top = Windows.Forms.Cursor.Position.Y - mousey
Me.Left = Windows.Forms.Cursor.Position.X - mousex
End If
End Sub
Private Sub TitleMove_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp, Label1.MouseUp, PictureBox4.MouseUp
drag = False
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)