如何去掉form边框(保留标题栏)

幽游闭关 2010-10-15 11:18:29
要做个播放器界面
要求看起来不是对话框样式的()

窗体用ssk皮肤文件修饰(为了美观以及以后换肤)
FormBoderStyle=Sizable (这个不能设置为none,因为我要保留标题栏以及拖动界面)
但这样的界面 边框存在

请问该如何去掉这个边框
...全文
1570 30 打赏 收藏 转发到动态 举报
写回复
用AI写文章
30 条回复
切换为时间正序
请发表友善的回复…
发表回复
编程爱好者L 2010-11-04
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 lukocho 的回复:]

现在的效果如下图:


要求的效果如下图所示(没有边框,但是要保留上面那图的标题栏):
[/Quote]
大哥 这个使用皮肤的.....
husanbo110 2010-10-21
  • 打赏
  • 举报
回复
private void Form_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
ControlPaint.DrawBorder(g, ClientRectangle,SystemColors.Highlight, ButtonBorderStyle.Solid);
}
昨天刚做了
这个是做一个边框
你重写这个方法就行了
mjp1234airen4385 2010-10-21
  • 打赏
  • 举报
回复
可以使用windowsAPI。
[DllImport("user32.dll")]
static extern int GetWindowRgn(IntPtr hWnd, long hRgn);
[DllImport("user32.dll")]
static extern int SetWindowRgn(IntPtr hWnd, long hRgn, bool bRedraw);
[DllImport("Gdi32.dll")]
static extern long CreateRectRgn(
int nLeftRect, // x-coordinate of upper-left corner
int nTopRect, // y-coordinate of upper-left corner
int nRightRect, // x-coordinate of lower-right corner
int nBottomRect // y-coordinate of lower-right corner
);

public Form1()
{
InitializeComponent();
long hrgn =
//int Result = GetWindowRgn(this.Handle, hrgn);
CreateRectRgn(this.Left + 2, this.Top, this.Right - 2, this.Bottom - 2);
SetWindowRgn(this.Handle, hrgn, true);

}
hongxu22 2010-10-21
  • 打赏
  • 举报
回复
FormBoderStyle设置为None,就ok了!!!
幽游闭关 2010-10-21
  • 打赏
  • 举报
回复
[Quote=引用 21 楼 seven8977 的回复:]
FormBoderStyle设置为None
然后自己做标题栏,自己写拖动事件!
就这样!
[/Quote]

有demo代码么
幽游闭关 2010-10-21
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 wuyq11 的回复:]
Form1_Paint重绘
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
drawForm(e.Graphics);
}
http://hi.baidu.com/tease/blog/item/ac608554be72a31b3b2935eb.html
[/Quote]

谁有源代码的能不能发我一份
那个网站打不开
fangxqian 2010-10-17
  • 打赏
  • 举报
回复
真厉害
seven8977 2010-10-16
  • 打赏
  • 举报
回复
FormBoderStyle设置为None
然后自己做标题栏,自己写拖动事件!
就这样!
yudengchang 2010-10-16
  • 打赏
  • 举报
回复
[Quote=引用 21 楼 seven8977 的回复:]
FormBoderStyle设置为None
然后自己做标题栏,自己写拖动事件!
就这样!
[/Quote]

以上这样就可以呀.

幽游闭关 2010-10-15
  • 打赏
  • 举报
回复
上面图贴反了
反正要求的效果就是保留标题栏
但是不要边框
幽游闭关 2010-10-15
  • 打赏
  • 举报
回复
现在的效果如下图:


要求的效果如下图所示(没有边框,但是要保留上面那图的标题栏):


编程爱好者L 2010-10-15
  • 打赏
  • 举报
回复
FormBoderStyle=none,如后在顶端停靠一个panel,panel里可以一张图片,这样可以达到你想要的外观效果,然后鼠标点击panel拖动的时候,然后就调用一个拖动这个窗体的方法.
兔子-顾问 2010-10-15
  • 打赏
  • 举报
回复
注意删掉默认的base.OnPaintBackground那行
兔子-顾问 2010-10-15
  • 打赏
  • 举报
回复
重载OnPaintBackground,直接执行依据
e.Graphics.Clear(BackColor);
火柴没帽 2010-10-15
  • 打赏
  • 举报
回复
FormBoderStyle=none
然后自己做一个标题栏
就向1楼那哥们说的,很好做的
一切为了你 2010-10-15
  • 打赏
  • 举报
回复
FormBoderStyle=none
bareman 2010-10-15
  • 打赏
  • 举报
回复
学习下
longhair9711 2010-10-15
  • 打赏
  • 举报
回复
先设置为none,然后用图片代替标题栏
wuyq11 2010-10-15
  • 打赏
  • 举报
回复
Form1_Paint重绘
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
drawForm(e.Graphics);
}
http://hi.baidu.com/tease/blog/item/ac608554be72a31b3b2935eb.html
明哥说编程 2010-10-15
  • 打赏
  • 举报
回复
FormBoderStyle设置为None
加载更多回复(6)

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧