首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None,后窗体只有工作区了,小弟我想为为它画边框,小弟我

2012-08-27 
Me.FormBorderStyle Windows.Forms.FormBorderStyle.None,后窗体只有工作区了,我想为为它画边框,我在onp

Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None,后窗体只有工作区了,我想为为它画边框,我在onpaint方法里画了后发现边框把工作区占了,如何在非工作区画上边框呢?
RT

C#或VB.NET都可以的。

非常感谢!

VB.NET code
    Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)        MyBase.OnPaintBackground(e)        Dim p As New Pen(Color.Red, 10)        e.Graphics.DrawRectangle(p, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width - 1, e.ClipRectangle.Height - 1)    End Sub


[解决办法]
用photoshop画图,然后设置成背景吧
[解决办法]
zswang就是伴水,清洁工。不会帮你顶。等会我去群里叫叫他让他来给你看看
[解决办法]
比较难处理的是Mdi窗体
[解决办法]
参考一下
http://dev.csdn.net/develop/article/59/59601.shtm
[解决办法]
ref: http://topic.csdn.net/u/20080327/13/9fcbba65-855a-4fb2-b578-887c42041b99.html

貌似 7L->平民百姓 的代码有这方面的实现..

呵呵..
[解决办法]
1:如果窗体AutoScroll设置为True后想绘制窗体,就要考虑坐标偏移的问题了,偏移量是由AutoScrollPosition来计算的。

2:因为滚动条是由系统自动加上的,它是靠近窗体的边的,所以无边的窗体出现滚动条后在改变大小的时候就会很怪。如果要解决这个问题可以自已使用ScrollBar控件自已来控制滚动,但这也会带来新的问题虽然可以很好的解决。但最偷懒的方法是向窗体里加一个可滚动的Panel之类的控件。

3:无边的窗体我们可以自已给它一个“边”,比如我们可以设置一个BorderWidth的变量来记录边的宽,我们在绘图的时候注意这个宽就是了,但是对于在其中控件Dock后的效果我们是通过Padding属性来完成的。比如:
C# code
this.Padding = new Padding(this.m_BorderWidth, this.m_BorderWidth + this.m_CaptionHeight, this.m_BorderWidth, this.m_BorderWidth);
[解决办法]
C# code
 [System.Runtime.InteropServices.DllImport("user32.dll")]        public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int wndproc);        [System.Runtime.InteropServices.DllImport("user32.dll")]        public static extern int GetWindowLong(IntPtr hWnd, int nIndex);        public const int WS_CAPTION = 0xC00000;        public const int GWL_STYLE = -16;        private void Form1_Load(object sender, EventArgs e)        {            this.FormBorderStyle = FormBorderStyle.Sizable;            SetWindowLong(this.Handle, GWL_STYLE, (~WS_CAPTION) & GetWindowLong(this.Handle, GWL_STYLE));            this.Height = this.ClientSize.Height;        }
[解决办法]
觉得这需要细细调整,不是一两个技巧几句话就可以做成完好外观的。楼主好好再研究一下吧,我相信楼主会做出来好的效果的。

热点排行