资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

vb.net边框特效,vb窗体边框样式

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中,Tabcontrol控件的边框怎么去掉?

你把 选项卡 拖到屏幕外面不就行了 只显示选项卡内东西 周围边缘都不要了 每个选项卡内配合labl 或按钮 标识不就行了。

VB.net怎么去掉MDI窗体立体边框

DllImport("user32.dll", ExactSpelling:=True) _

Private Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, _

ByVal uFlags As UInteger) As Integer

End Function

Private Const GWL_STYLE As Integer = -16

Private Const GWL_EXSTYLE As Integer = -20

Private Const WS_BORDER As Integer = H800000

Private Const WS_EX_CLIENTEDGE As Integer = H200

Private Const SWP_NOSIZE As UInteger = H1

Private Const SWP_NOMOVE As UInteger = H2

Private Const SWP_NOZORDER As UInteger = H4

Private Const SWP_NOREDRAW As UInteger = H8

Private Const SWP_NOACTIVATE As UInteger = H10

Private Const SWP_FRAMECHANGED As UInteger = H20

Private Const SWP_SHOWWINDOW As UInteger = H40

Private Const SWP_HIDEWINDOW As UInteger = H80

Private Const SWP_NOCOPYBITS As UInteger = H100

Private Const SWP_NOOWNERZORDER As UInteger = H200

Private Const SWP_NOSENDCHANGING As UInteger = H400

Public Sub ChangeMdiClientBorderStyle(ByVal Value As System.Windows.Forms.BorderStyle, ByVal Handle As IntPtr)

Dim style As Integer = GetWindowLong(Handle, GWL_STYLE)

Dim exStyle As Integer = GetWindowLong(Handle, GWL_EXSTYLE)

' Add or remove style flags as necessary.

Select Case Value

Case BorderStyle.Fixed3D

exStyle = exStyle Or WS_EX_CLIENTEDGE

style = style And Not WS_BORDER

Exit Select

Case BorderStyle.FixedSingle

exStyle = exStyle And Not WS_EX_CLIENTEDGE

style = style Or WS_BORDER

Exit Select

Case BorderStyle.None

style = style And Not WS_BORDER

exStyle = exStyle And Not WS_EX_CLIENTEDGE

Exit Select

End Select

' Set the styles using Win32 calls

SetWindowLong(Handle, GWL_STYLE, style)

SetWindowLong(Handle, GWL_EXSTYLE, exStyle)

' Update the non-client area.

SetWindowPos(Handle, IntPtr.Zero, 0, 0, 0, 0, _

SWP_NOACTIVATE Or SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOZORDER Or SWP_NOOWNERZORDER Or SWP_FRAMECHANGED)

End Sub

''' summary

''' 获取MDIClient句柄

''' /summary

''' returns/returns

''' remarks/remarks

Private Function getMdiClientHandle() As IntPtr

Dim Obj As MdiClient = Nothing

Dim t As Type

For Each Item As Control In Me.Controls

t = Item.[GetType]()

If t.Name = "MdiClient" Then

Obj = DirectCast(Item, MdiClient)

Exit For

End If

Next

If Obj IsNot Nothing Then

Return Obj.Handle

Else

Return IntPtr.Zero

End If

End Function

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

If Me.IsMdiContainer Then

ChangeMdiClientBorderStyle(BorderStyle.None, getMdiClientHandle)

End If

End Sub

VB.NET我要用鼠标轨迹画一个矩形框 然后选中控件。就像星际和魔兽争霸里对部队单位的选中一样~等大神回答

这个类继承自Panel,把它加到你的项目里面,先运行一下,然后从工具箱里把它拖到窗体上,然后再向里面添加其它控件就可以了,支持Shift加选,Alt减选

Imports System.Linq

Imports System.Collections

Public Class MyPanel

Inherits Panel

' 选择模式,相交还是包含

Enum SelectMode

Intersects

Contains

End Enum

Dim down As New Point(-1, -1)

Dim rect As Rectangle

Dim selected As New List(Of Control)

Dim editting As IEnumerable(Of Control)

Dim mode As SelectMode = SelectMode.Contains

Dim shift, alt As Boolean

Public Sub New()

Me.DoubleBuffered = True

End Sub

Protected Overrides Sub OnMouseDown(e As MouseEventArgs)

MyBase.OnMouseDown(e)

down = e.Location

editting = selected.ToArray().ToList()

OnMouseMove(e)

End Sub

Protected Overrides Sub OnMouseMove(e As MouseEventArgs)

MyBase.OnMouseMove(e)

If e.Button = Windows.Forms.MouseButtons.Left Then

Dim loc As New Point(Math.Min(down.X, e.X), Math.Min(down.Y, e.Y))

Dim size As New Size(Math.Abs(down.X - e.X), Math.Abs(down.Y - e.Y))

rect = New Rectangle(loc, size)

Dim cs As New List(Of Control)

For Each c In Controls

cs.Add(c)

Next

Dim a = cs.Where(Function(n As Control) (mode = SelectMode.Contains And rect.Contains(n.Bounds)) Or (mode = SelectMode.Intersects And rect.IntersectsWith(n.Bounds)))

If shift Then editting = a.Union(selected) Else If alt Then editting = selected.Except(a) Else editting = a

Invalidate()

End If

End Sub

Protected Overrides Sub OnMouseUp(e As MouseEventArgs)

MyBase.OnMouseUp(e)

down = New Point(-1, -1)

selected = editting.ToList()

editting = Nothing

Invalidate()

End Sub

Protected Overrides Function ProcessKeyPreview(ByRef m As Message) As Boolean

Dim KeyCode As Keys = CInt(m.WParam) And CInt(Keys.KeyCode)

Dim d As Boolean

If m.Msg = H100 Or m.Msg = H104 Then d = True Else If m.Msg = H101 Or m.Msg = H105 Then d = False Else Return MyBase.ProcessKeyPreview(m)

If KeyCode = Keys.ShiftKey Then

shift = d

ElseIf KeyCode = Keys.Menu Then

alt = d

End If

Return MyBase.ProcessKeyPreview(m)

End Function

Protected Overrides Sub OnPaint(e As PaintEventArgs)

MyBase.OnPaint(e)

For Each c As Control In IIf(editting Is Nothing, selected, editting)

e.Graphics.DrawRectangle(New Pen(Color.Gray) With {.DashStyle = Drawing2D.DashStyle.DashDot}, c.Left - 1, c.Top - 1, c.Width + 1, c.Height + 1)

Next

If (down.X  0) Then e.Graphics.DrawRectangle(New Pen(Color.Gray) With {.DashStyle = Drawing2D.DashStyle.DashDot}, rect)

End Sub

End Class

VB中如何设置label的边框

Label是VB中的标签框控件,一般用来显示对其他控件功能进行说明性的文本信息。比如在学生信息管理系统中,在一个文本框前面加上一个Lable标题为“姓名”,提醒用户在这个Lable控件右边的文本框中输入学生姓名。

Label控件的边框属性为BorderStyle,一共有两种属性值:0和1。分别表示没有边框和固定边框,该属性在Label控件的属性表中通过单击鼠标选择设置:

示意图为:

VB.net怎样按住鼠标移动无边框窗体

1.在mouse事件中实现

2.调用windows API

实现方式为:

1.在mouse事件中实现

[csharp] view plain copy

Point mouseOff;//鼠标移动位置变量

bool leftFlag;//标签是否为左键

private void groupControl1_MouseUp(object sender, MouseEventArgs e)

{

if (leftFlag)

{

leftFlag = false;//释放鼠标后标注为false;

}

}

private void groupControl1_MouseMove(object sender, MouseEventArgs e)

{

if (leftFlag)

{

Point mouseSet = Control.MousePosition;

mouseSet.Offset(mouseOff.X, mouseOff.Y); //设置移动后的位置

Location = mouseSet;

}

}

private void groupControl1_MouseDown(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

mouseOff = new Point(-e.X, -e.Y); //得到变量的值

leftFlag = true; //点击左键按下时标注为true;

}

}

private void groupControl1_MouseDown(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

mouseOff = new Point(-e.X, -e.Y); //得到变量的值

leftFlag = true; //点击左键按下时标注为true;

}

}

2.调用windows API

调用前需要添加using System.Runtime.InteropServices;

[csharp] view plain copy

[DllImport("user32.dll")]

public static extern bool ReleaseCapture();

[DllImport("user32.dll")]

public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);

private void groupControl1_MouseDown(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

ReleaseCapture(); //释放鼠标捕捉

//发送左键点击的消息至该窗体(标题栏)

SendMessage(Handle, 0xA1, 0x02, 0);

}

}


当前名称:vb.net边框特效,vb窗体边框样式
标题来源:http://cdkjz.cn/article/dsggcig.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220