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

    你可能感兴趣的文章
    php微信公众号开发access_token获取
    查看>>
    php微信公众号开发微信认证开发者
    查看>>
    php微信公众号开发用户基本信息
    查看>>
    php怎么将对象变成数组,php怎么将对象转换成数组
    查看>>
    RabbitMQ - 消息堆积问题的最佳解决方案?惰性队列
    查看>>
    php怎样比较两数大小,jquery如何判断两个数值的大小
    查看>>
    PHP性能监控 - 开启xhprof(一)
    查看>>
    PHP性能监控 - 怎么看xhprof报告(二)
    查看>>
    php截取字符串代码,PHP字符串截取_php
    查看>>
    php截取字符串,无乱码
    查看>>
    php手冊,php手冊之變量范圍
    查看>>
    PHP手机号码归属地查询API接口
    查看>>
    PHP执行耗时脚本实时输出内容
    查看>>
    PHP扩展安装
    查看>>
    PHP扩展数据库连接参数说明详解
    查看>>
    php把get参数放入数组_php怎么将数组转为url参数?
    查看>>
    PHP投票小程序
    查看>>
    php拆分数组不改变key值
    查看>>
    php接口返回数据 用echo 还是return?
    查看>>
    php接口返回状态,大家一般怎么规范接口返回内容
    查看>>