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

    你可能感兴趣的文章
    Objective-C实现anagrams字谜算法(附完整源码)
    查看>>
    Objective-C实现ApproximationMonteCarlo蒙特卡洛方法计算pi值算法 (附完整源码)
    查看>>
    Objective-C实现area under curve曲线下面积算法(附完整源码)
    查看>>
    Objective-C实现argmax函数功能(附完整源码)
    查看>>
    Objective-C实现arithmetic算术算法(附完整源码)
    查看>>
    Objective-C实现armstrong numbers阿姆斯壮数算法(附完整源码)
    查看>>
    Objective-C实现articulation-points(关键点)(割点)算法(附完整源码)
    查看>>
    Objective-C实现atoi函数功能(附完整源码)
    查看>>
    Objective-C实现average absolute deviation平均绝对偏差算法(附完整源码)
    查看>>
    Objective-C实现average mean平均数算法(附完整源码)
    查看>>
    Objective-C实现average median平均中位数算法(附完整源码)
    查看>>
    Objective-C实现average mode平均模式算法(附完整源码)
    查看>>
    Objective-C实现avl 树算法(附完整源码)
    查看>>
    Objective-C实现AvlTree树算法(附完整源码)
    查看>>
    Objective-C实现backtracking Jump Game回溯跳跃游戏算法(附完整源码)
    查看>>
    Objective-C实现BACKTRACKING 方法查找集合的幂集算法(附完整源码)
    查看>>
    Objective-C实现bailey borwein plouffe算法(附完整源码)
    查看>>
    Objective-C实现balanced parentheses平衡括号表达式算法(附完整源码)
    查看>>
    Objective-C实现base64加密和base64解密算法(附完整源码)
    查看>>
    Objective-C实现base64加解密(附完整源码)
    查看>>