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

    你可能感兴趣的文章
    Node.js之async_hooks
    查看>>
    Node.js初体验
    查看>>
    Node.js升级工具n
    查看>>
    Node.js卸载超详细步骤(附图文讲解)
    查看>>
    Node.js卸载超详细步骤(附图文讲解)
    查看>>
    Node.js基于Express框架搭建一个简单的注册登录Web功能
    查看>>
    node.js学习之npm 入门 —8.《怎样创建,发布,升级你的npm,node模块》
    查看>>
    Node.js安装与配置指南:轻松启航您的JavaScript服务器之旅
    查看>>
    Node.js安装及环境配置之Windows篇
    查看>>
    Node.js安装和入门 - 2行代码让你能够启动一个Server
    查看>>
    node.js安装方法
    查看>>
    Node.js官网无法正常访问时安装NodeJS的方法
    查看>>
    node.js模块、包
    查看>>
    node.js的express框架用法(一)
    查看>>
    Node.js的交互式解释器(REPL)
    查看>>
    Node.js的循环与异步问题
    查看>>
    Node.js高级编程:用Javascript构建可伸缩应用(1)1.1 介绍和安装-安装Node
    查看>>
    nodejs + socket.io 同时使用http 和 https
    查看>>
    NodeJS @kubernetes/client-node连接到kubernetes集群的方法
    查看>>
    NodeJS API简介
    查看>>