zoukankan
html css js c++ java
移动无标题(边框)窗体
之前看到过一个CSDN上的教程,移动无标题窗体很麻烦很麻烦,要不断重画窗体。
使用这种FormBorderStyle设置为none的窗体,可以简单的实现自定义窗体皮肤,当然皮肤要自己做图片了。
今天无意间发现了一个很简单的代码,调用了系统API
在Program.cs中存在如下代码:
[DllImport(
"
user32.dll
"
)]
public
static
extern
bool
ReleaseCapture();
[DllImport(
"
user32.dll
"
)]
public
static
extern
bool
SendMessage(IntPtr hwnd,
int
wMsg,
int
wParam,
int
lParam);
public
const
int
WM_SYSCOMMAND
=
0x0112
;
public
const
int
SC_MOVE
=
0xF010
;
public
const
int
HTCAPTION
=
0x0002
;
然后在想要实现这样功能的窗体上打入如下代码:
private
void
frmInputPsd_MouseDown(
object
sender, MouseEventArgs e)
{
//
如果鼠标指针在标题栏范围内并且按下了鼠标左键,则触发移动标题栏方法
if
(e.Button
==
MouseButtons.Left
&&
e.Y
<=
25
)
{
Program.ReleaseCapture();
Program.SendMessage(
this
.Handle, Program.WM_SYSCOMMAND, Program.SC_MOVE
+
Program.HTCAPTION,
0
);
}
}
查看全文
相关阅读:
WinForm 资源文件的使用
php 常量
netbean使用技巧
netbeans 7安装xdebug调试php程序
eclipse 开发技巧
asp.net 获取客户机IP地址
NameValueCollection详解
Paramics插件编程进程间通讯
Paramics API编程配置
windows查询端口占用
原文地址:https://www.cnblogs.com/top5/p/1723510.html
最新文章
arcgis_engine_c++_runtime_r6034_error
backup3
backup2
backup1
oracle_exp_query_where_clause
stimulsoft Report报表使用笔记
删除sde用户问题
python笔记一
不动产登记系统
GIt-解决冲突
热门文章
Go
Gitee-clone,push.pull
Gitee-码云
ping和tracert
C#-LINQ
C#-Json
C#-EF
codesoft-设计label
如何在winform DataGridView控件的DataGridViewButtonColumn按钮列中禁用按钮
.net RESX资源文件
Copyright © 2011-2022 走看看