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

    你可能感兴趣的文章
    oncopy和onpaste
    查看>>
    onCreate中的savedInstanceState作用
    查看>>
    onCreate()方法中的参数Bundle savedInstanceState 的意义用法
    查看>>
    One good websit for c#
    查看>>
    One-Shot学习/一次学习(One-shot learning)
    查看>>
    OneASP 安全公开课,深圳站, Come Here, Feel Safe!
    查看>>
    OneBlog Shiro 反序列化漏洞复现
    查看>>
    oneM2M
    查看>>
    Oneplus5重装攻略
    查看>>
    one_day_one--mkdir
    查看>>
    ONI文件生成与读取
    查看>>
    Vue 项目中实现高效的消息提示与确认对话框功能(模版)
    查看>>
    Online PDF to PNG、JPEG、WEBP、 TXT - toolfk
    查看>>
    onlstm时间复杂度_CRF和LSTM 模型在序列标注上的优劣?
    查看>>
    onlyoffice新版5.1.2版解决中文汉字输入重复等问题
    查看>>
    onnx导出动态输入
    查看>>
    onnx导出动态输入
    查看>>
    onScrollStateChanged无效
    查看>>
    onTouchEvent构造器
    查看>>
    on_member_join 和删除不起作用.如何让它发挥作用?
    查看>>