博客
关于我
控件的布局
阅读量: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实现histogram stretch直方图拉伸算法(附完整源码)
    查看>>
    Objective-C实现Hopcroft算法(附完整源码)
    查看>>
    Objective-C实现horizontal projectile motion平抛运动算法(附完整源码)
    查看>>
    Objective-C实现hornerMethod霍纳法算法(附完整源码)
    查看>>
    Objective-C实现Horn–Schunck光流算法(附完整源码)
    查看>>
    Objective-C实现Http Post请求(附完整源码)
    查看>>
    Objective-C实现http下载文件 (附完整源码)
    查看>>
    Objective-C实现Http协议下载文件(附完整源码)
    查看>>
    Objective-C实现huffman哈夫曼编码算法(附完整源码)
    查看>>
    Objective-C实现ID3贪心算法(附完整源码)
    查看>>
    Objective-C实现IIR 滤波器算法(附完整源码)
    查看>>
    Objective-C实现IIR数字滤波器(附完整源码)
    查看>>
    Objective-C实现insertion sort插入排序算法(附完整源码)
    查看>>
    Objective-C实现integer partition整数分区算法(附完整源码)
    查看>>
    Objective-C实现integerPartition整数划分算法(附完整源码)
    查看>>
    Objective-C实现interpolation search插值搜索算法(附完整源码)
    查看>>
    Objective-C实现Interpolation search插值查找算法(附完整源码)
    查看>>
    Objective-C实现intersection交集算法(附完整源码)
    查看>>
    Objective-C实现intro sort内省排序算法(附完整源码)
    查看>>
    Objective-C实现inverse matrix逆矩阵算法(附完整源码)
    查看>>