重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

vb.net画阴影,vb阴影效果

怎么用GDI+使窗体四周都有阴影效果,不用WPF,C#或者是vb.net也可以的 注意是四周不是两边的。求帮忙啊

调用API是个好的办法,给你个参考网文:

为平桂等地区用户提供了全套网页设计制作服务,及平桂网站建设行业解决方案。主营业务为成都做网站、成都网站设计、平桂网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

如果一定要自已用GDI+绘制,很麻烦,比如把窗体设置成无边框,贴图上去,但可能要自已定义事件来响应缺少标题栏后的操作。等等

Vb.net 窗体四周阴影效果

它们的窗体实际上就是你截图出来的大小,周围的阴影效果都是自己画出来的。

Vb.net 无边框窗体如何实现四周阴影? 网上搜到的都是两边阴影的,我需要四周阴影

设置全局变量:

Dim drag As Boolean

Dim 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

vb.net无边框窗口如何做出阴影效果?

调用系统API使窗体下拥有阴影效果

using System.Runtime.InteropServices;

然后再窗口类的随便哪个地方加上:

const int CS_DROPSHADOW = 0x20000;

const int GCL_STYLE = (-26);

//声明Win32 API

[DllImport("user32.dll", CharSet = CharSet.Auto)]

public static extern int SetClassLong(IntPtr hwnd,int nIndex,int dwNewLong);

[DllImport("user32.dll", CharSet = CharSet.Auto)]

public static extern int GetClassLong(IntPtr hwnd, int nIndex);

最后在窗体的构造函数中加上:

SetClassLong(this.Handle, GCL_STYLE, GetClassLong(this.Handle, GCL_STYLE) | CS_DROPSHADOW);

VB.NET窗体阴影

vb.net2008

vb.net API 是将除特殊变量(如H20000)的Long都改成Integer

窗体的右侧和下方有阴影

Public Class Form1

Private Const CS_DROPSHADOW = H20000

Private Const GCL_STYLE = (-26)

Private Declare Function GetClassLong Lib "user32" Alias "GetClassLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer) As Integer

Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Long) As Integer

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

SetClassLong(Me.Handle, GCL_STYLE, GetClassLong(Me.Handle, GCL_STYLE) Or CS_DROPSHADOW)

End Sub

End Class

vbnet自制窗体怎么加上窗体阴影

Public Class Form1

Private Const CS_DROPSHADOW = H20000

Private Const GCL_STYLE = (-26)

Private Declare Function GetClassLong Lib "user32" Alias "GetClassLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer) As Integer

Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer

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

SetClassLong(Me.Handle, GCL_STYLE, GetClassLong(Me.Handle, GCL_STYLE) Or CS_DROPSHADOW)


文章名称:vb.net画阴影,vb阴影效果
文章路径:http://cqcxhl.cn/article/hoidih.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP