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

    你可能感兴趣的文章
    Nvidia 系列显卡大解析 B100、A40、A100、A800、H100、H800、V100 该如何选择,各自的配置详细与架构详细介绍,分别运用于哪些项目场景
    查看>>
    NVIDIA-cuda-cudnn下载地址
    查看>>
    nvidia-htop 使用教程
    查看>>
    nvidia-smi 参数详解
    查看>>
    Nvidia驱动失效,采用官方的方法重装更快
    查看>>
    nvmw安装node-v4.0.0之后版本的临时解决办法
    查看>>
    nvm切换node版本
    查看>>
    nvm安装 出现 Error retrieving “http://xxxx/SHASUMS256.txt“: HTTP Status 404 解决方法
    查看>>
    nvm安装以后,node -v npm 等命令提示不是内部或外部命令 node多版本控制管理 node多版本随意切换
    查看>>
    NXLog采集windows日志配置conf文件
    查看>>
    ny540 奇怪的排序 简单题
    查看>>
    NYOJ -216 A problem is easy
    查看>>
    NYOJ 1066 CO-PRIME(数论)
    查看>>
    NYOJ 737:石子合并(一)(区间dp)
    查看>>
    nyoj 91 阶乘之和(贪心)
    查看>>
    nyoj------203三国志
    查看>>
    NYOJ-525 一道水题
    查看>>
    NYOJ127星际之门(一)
    查看>>
    nyoj58 最少步数
    查看>>
    N皇后问题
    查看>>