Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
基本上我有一个没有边框的表格,我想保持这样。它处于固定位置。我正在尝试在表单中绘制表单大小的轮廓(因此它看起来像边框)我遇到了麻烦并且从未真正在表单中使用过“绘图”技术。
Pen pen = new Pen(Color.Black, 20); Rectangle rect = new Rectangle(0, 0, this.Width, this.Height); Graphics g = CreateGraphics(); g.DrawRectangle(pen, rect);
这样做OnPaint:
OnPaint
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); Pen pen = new Pen(Color.Black, 20); Rectangle rect = new Rectangle(0, 0, this.Width, this.Height); e.Graphics.DrawRectangle(pen, rect); }