vb.net无边框窗口 vb窗口具有双线框架怎么设置

vb.net 无边框窗体的问题设置窗体的text为空,设置窗体的controlbox属性为false,设置窗体的FormBorderStyle 属性为Sizable,就可以改变窗体大小了 , 并且可以在任务栏点击 。
VB.NET 拖动无边框窗体编程实例 Imports System Drawing Imports System Windows Forms****************************************** Private oOriginalRegion As Region = Nothing用于窗体移动 Private bFormDragging As Boolean = False Private oPointClicked As Point****************************************** Private Sub Form _MouseDown(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseDown Me bFormDragging = True Me oPointClicked = New Point(e X e Y) End Sub****************************************** Private Sub Form _MouseUp(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseUp Me bFormDragging = False End Sub****************************************** Private Sub Form _MouseMove(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseMove If Me bFormDragging Then Dim oMoveToPoint As Point以当前鼠标位置为基础 找出目标位置 oMoveToPoint = Me PointToScreen(New Point(e X e Y))根据开始位置作出调整 oMoveToPoint Offset(Me oPointClicked X * _ (Me oPointClicked Y_ SystemInformation CaptionHeight_ SystemInformation BorderSize Height) * )移动窗体 Me Location = oMoveToPoint End If
lishixinzhi/Article/program/ASP/201311/21755
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")]
【vb.net无边框窗口 vb窗口具有双线框架怎么设置】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窗口具有双线框架怎么设置的介绍到此就结束了 , 不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。

    推荐阅读