189 8069 5689

vb.net窗口阴影,winform窗体阴影

VB.NET里面要使无边框的窗体有阴影该怎么做

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

创新互联建站主要为客户提供服务项目涵盖了网页视觉设计、VI标志设计、成都全网营销推广、网站程序开发、HTML5响应式成都网站建设手机网站开发、微商城、网站托管及网站维护公司、WEB系统开发、域名注册、国内外服务器租用、视频、平面设计、SEO优化排名。设计、前端、后端三个建站步骤的完善服务体系。一人跟踪测试的建站服务标准。已经为成都会所设计行业客户提供了网站制作服务。

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 无边框窗体如何实现四周阴影? 网上搜到的都是两边阴影的,我需要四周阴影

设置全局变量:

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窗体阴影

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


本文名称:vb.net窗口阴影,winform窗体阴影
文章来源:http://cdxtjz.cn/article/phgcjg.html

其他资讯