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

    你可能感兴趣的文章
    Qt笔记——QToolBox开发简易QQ聊天界面
    查看>>
    poj3307
    查看>>
    Qt笔记——QString与隐式共享、MVC架构
    查看>>
    Qt笔记——QSemaphore处理生产者/消费者模式
    查看>>
    Qt笔记——QMutex&QWaitCondition处理生产者消费者模式
    查看>>
    Qt笔记——QLable+QPixmap图片缩放踩坑
    查看>>
    Qt笔记——foreach与forever
    查看>>
    QT程序怎么挪到Linux下,linux+Qt程序如何打包发布
    查看>>
    Qt知识:视图框架QGraphicsWidget详解
    查看>>
    SpringBoot中项目启动及定时任务缓存数据库常用数据至内存变量并转换后高频调用
    查看>>
    Qt知识: 画刷风格
    查看>>
    QT的OpenGL渲染窗QOpenGLWidget Class
    查看>>
    QT的C++程序加载动态链接库DLL(Linux下是so)的方式
    查看>>
    QT界面操作1:如何跟踪鼠标位置?
    查看>>
    Qt环境搭建(Visual Studio)
    查看>>
    QT点击"X"按钮,调用closeEvent()函数来实现调用特定事件(附:粗略介绍QT的信号与槽的使用方法)...
    查看>>
    QT样式表——url路径
    查看>>
    QT数据库(三):QSqlQuery使用
    查看>>
    QT教程5:消息框
    查看>>
    SpringBoot中集成阿里开源缓存访问框架JetCache实现声明式实例和方法缓存
    查看>>