我把窗体的FormborderStyle设为了None,想给窗体绘制个黑色边框,四个角是弧形,本人新手,在线等,有合适的分数全部相送
解决方案 »
- 新手关于c#几个问题
- 使用OleDbConnection等来操作excel,如何兼容excel2003和exce2007?
- System.InvalidCastException异常 FormatException
- 求一简单算法
- 请教关于析构方法 ~类名() 和Dispose()的差别问题
- 你写的一个猜字游戏(好玩轻松)有难易度选择。能不能帮我用c#做,而且用c#控制台运用程序运行
- 服务器报错提示:servers unavailable
- 数据库的更新问题
- 调用Oracle存储过程问题
- 希望此贴能够深刻的影响你的一生!!!
- 在写一框架的时候首先要写什么程序文档,之类的问题
- 根据GPS记录计算统计车辆里程算法.
重写WndProc方法,用API获取Windows消息绘制窗体的非客户区,网上没有找到C#的例子
现在只有找一下C++的,查一下Win32编程的资料,可能会有所启发用API函数SystemParametersInfo获取Windows工作区的大小,然后给窗体的MaximumSize属性赋值,限定窗体的最大Size,这样就不会盖住任务栏了。
public static Region CreateRoundRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nWidthEllipse, int nHeightEllipse)
{
GraphicsPath path = new GraphicsPath();
path.AddArc(new Rectangle(nLeftRect, nTopRect, nWidthEllipse, nHeightEllipse), 180f, 90f);
path.AddArc(new Rectangle((nRightRect - nWidthEllipse) - 1, nTopRect, nWidthEllipse, nHeightEllipse), -90f, 90f);
path.AddArc(new Rectangle((nRightRect - nWidthEllipse) - 1, (nBottomRect - nHeightEllipse) - 1, nWidthEllipse, nHeightEllipse), 0f, 90f);
path.AddArc(new Rectangle(nLeftRect, (nBottomRect - nHeightEllipse) - 1, nWidthEllipse, nHeightEllipse), 90f, 90f);
path.CloseAllFigures();
return new Region(path);
}form1.Region = CreateRoundRectRgn(this.sideWidth, this.formTopOffset, (this.frmBase.ClientSize.Width + this.sideWidth) + 1, (this.frmBase.Height - this.sideWidth) + 1, RoundWidth, RoundHeight);