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

    你可能感兴趣的文章
    QVGA/HVGA/WVGA/FWVGA分辨率屏含义及大小//Android虚拟机分辨率
    查看>>
    pipreqs : 无法将“pipreqs”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径 正确,然后再试一次。
    查看>>
    pipy国内镜像的网址
    查看>>
    quiver绘制python语言
    查看>>
    pip下载缓慢
    查看>>
    PIP使用SSH从BitBucket安装自定义软件包,无需输入SSH密码
    查看>>
    pip命令提示unknow or unsupported command install解决方法
    查看>>
    pip在安装模块时提示Read timed out
    查看>>
    pip更换源
    查看>>
    SpringBoot之Banner源码深度分解
    查看>>
    Pix2Pix如何工作?
    查看>>
    QuickBI助你成为分析师——搞定数据源
    查看>>
    pkl来存储python字典
    查看>>
    quick sort | 快速排序 C++ 实现
    查看>>
    pkpmbs 建设工程质量监督系统 Ajax_operaFile.aspx 文件读取漏洞复现
    查看>>
    pkpmbs 建设工程质量监督系统 文件上传漏洞复现
    查看>>
    pku 2400 Supervisor, Supervisee KM求最小权匹配+DFS回溯解集
    查看>>
    queue队列、deque双端队列和priority_queue优先队列
    查看>>
    PKUSC2018游记
    查看>>
    PK项目测试,做产品测试有这4大优势!
    查看>>