博客
关于我
控件的布局
阅读量: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/

    你可能感兴趣的文章
    python基础变量之---列表
    查看>>
    python基础变量之---元组
    查看>>
    python基础内容_Python基础入门必须了解的
    查看>>
    Python基础之面向对象2(封装)
    查看>>
    Python基础之给函数增加元信息
    查看>>
    python基础之字符编码
    查看>>
    python基础之多线程与多进程(二)
    查看>>
    Python基础之基本数据类型一《数字与字符串》
    查看>>
    python基础之变量---总纲
    查看>>
    Python基础之列表
    查看>>
    Python基础之Python环境搭建
    查看>>
    python基础之--面相对象--OOP基本特性
    查看>>
    python基础之--迭代器和生成器及异常处理
    查看>>
    python基础之--包和模块
    查看>>
    python基础之---面向对象--属性和方法
    查看>>
    python基础之---运算符
    查看>>
    python基础之---语句
    查看>>
    python基础之---正则表达式
    查看>>
    python基础之---函数式编程
    查看>>
    python基础之---函数
    查看>>