博客
关于我
控件的布局
阅读量:588 次
发布时间:2019-03-11

本文共 1739 字,大约阅读时间需要 5 分钟。

?????

??????????????????????????????????

????

??????????????????

  • ????????????????????
  • ???????????????????
  • ?????????????
  • ??????

    ????????????????????????????????

    • textBox?AutoSize?????false???????????????
    • distinction between???Size?ClientSize?Size?????????????ClientSize??????????
    • ????????????????OnLayout??????

    ???????????????

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace WinForm??3{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();            this.timeField.AutoSize = false;        }        protected override void OnLayout(LayoutEventArgs event)        {            base.OnLayout(event);            int w = this.ClientSize.Width;            int h = this.ClientSize.Height;            int yoff = 4;            this.timeField.Location = new Point(0, yoff);            this.timeField.Size = new Size(w - 80, 30);            this.button1.Location = new Point(w - 80, yoff);            this.button1.Size = new Size(80, 30);            yoff += 30;            yoff += 4;            this.pictureBox1.Location = new Point(0, yoff);            this.pictureBox1.Size = new Size(w, h - yoff - 4);        }        private void On_Test(object sender, EventArgs e)        {            string timeStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");            timeField.Text = timeStr;        }    }}

    Dock??

    Dock??????????????????????????

    • Top??????
    • Bottom??????
    • Left??????
    • Right??????
    • Fill?????
    • None????

    ???Dock????Anchor??????

    ????

    ???????Dock????????

  • ????Panel??????
  • ????Panel??????
  • ????PictureBox??????
  • ??Dock??????????????

    转载地址:http://pzdtz.baihongyu.com/

    你可能感兴趣的文章
    octave错误-error: ‘squareThisNumber‘ undefined near line 1 column 1
    查看>>
    Octotree Chrome插件离线安装
    查看>>
    OCTO作为美团的高性能服务通信框架,究竟能不能称得上是杀手锏呢?
    查看>>
    OC中关于给NSString 赋 nil和@""的区别
    查看>>
    OC字符串方法汇总
    查看>>
    OC学习6——面相对象的三大特性
    查看>>
    OC点语法介绍和使用以及@property关键字
    查看>>
    oc知道经纬度求位置
    查看>>
    OC高效率52之提供“全能初始化”方法
    查看>>
    oc--习题
    查看>>
    oday!POC管理和漏洞扫描小工具
    查看>>
    ODBC的JAR包和PLSQL
    查看>>
    ODE网络:一场颠覆RNN的革命即将到来
    查看>>
    Odin 开源项目教程
    查看>>
    odoo14配置阿里云免费SSL证书
    查看>>
    odoo系统局域网及外网访问?快解析内网穿透方案教程
    查看>>
    Odoo:在选项卡中重用来自另一个模型的TreeView
    查看>>
    Odoo:如何将SQL语句转换为域
    查看>>
    ODP.Net Tips
    查看>>
    OD字符串条件断点 [STRING[ESP+8]] == "123456"
    查看>>