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

    你可能感兴趣的文章
    pandas 按日期和年份分组,并汇总金额
    查看>>
    pandas 数据帧到PostgreSQL表中使用的是没有SQLAlChemy的心理复制2吗?
    查看>>
    pandas 数据帧多行查询
    查看>>
    Pandas 数据框:使用线性插值重新采样
    查看>>
    pandas 数据框将 INT64 列转换为布尔值
    查看>>
    pandas 数据框将列类型转换为字符串或分类
    查看>>
    pandas 数据框条件 .mean() 取决于特定列中的值
    查看>>
    pandas 数据框至海运分组条形图
    查看>>
    Pandas 数据透视表:列顺序和小计
    查看>>
    pandas 时序统计的高级用法!
    查看>>
    pandas 时间序列重新采样结束给定的一天
    查看>>
    pandas 根据不是常量的第三列的值将值从一列复制到另一列
    查看>>
    pandas 根据值从多列中的一列查找
    查看>>
    Pandas 根据布尔条件选择行和列
    查看>>
    pandas 滚动窗口 - datetime64[ns] 未实现
    查看>>
    pandas 版本兼容特定的蟒蛇和NumPy配置吗?
    查看>>
    pandas 生成excel多级表头
    查看>>
    Pandas 的 DataFrame 详解-ChatGPT4o作答
    查看>>
    pandas 读取excel数据,以字典形式输出
    查看>>
    Pandas 读取具有浮点值的 csv 文件会导致奇怪的舍入和小数位数
    查看>>