栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何移动和调整表格大小而没有边框?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何移动和调整表格大小而没有边框?

允许移动和调整表单大小的一些示例代码:

  public partial class Form1 : Form {    public Form1() {      InitializeComponent();      this.FormBorderStyle = FormBorderStyle.None;      this.DoubleBuffered = true;      this.SetStyle(ControlStyles.ResizeRedraw, true);    }    private const int cGrip = 16;      // Grip size    private const int cCaption = 32;   // Caption bar height;    protected override void onPaint(PaintEventArgs e) {      Rectangle rc = new Rectangle(this.ClientSize.Width - cGrip, this.ClientSize.Height - cGrip, cGrip, cGrip);      ControlPaint.DrawSizeGrip(e.Graphics, this.BackColor, rc);      rc = new Rectangle(0, 0, this.ClientSize.Width, cCaption);      e.Graphics.FillRectangle(Brushes.DarkBlue, rc);    }    protected override void WndProc(ref Message m) {      if (m.Msg == 0x84) {  // Trap WM_NCHITTEST        Point pos = new Point(m.LParam.ToInt32());        pos = this.PointToClient(pos);        if (pos.Y < cCaption) {          m.Result = (IntPtr)2;  // HTCAPTION          return;        }        if (pos.X >= this.ClientSize.Width - cGrip && pos.Y >= this.ClientSize.Height - cGrip) {          m.Result = (IntPtr)17; // HTBOTTOMRIGHT          return;        }      }      base.WndProc(ref m);    }  }


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/387204.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号