当前位置:   article > 正文

Winform控件问题收集_c# tablelayoutpanel最后一行比较高

c# tablelayoutpanel最后一行比较高

lable标签生成下划线

this.lbContinuousNote.Font = new Font(this.label1.Font.FontFamily, this.label1.Font.Size, FontStyle.Underline);

tableLayoutPanel设置特定行绝对行高

tableLayoutPanel1.RowStyles[1].SizeType = SizeType.Absolute;
tableLayoutPanel1.RowStyles[1].Height = 0;

tableLayoutPanel设置滚动条

如果tableLayoutPanel最后一行设置为百分比行高就算设置AutoScroll = True也不会显示滚动条;
tableLayoutPanel设置滚动条需要设置AutoScroll = True并且tableLayoutPanel最后一行设置为绝对值行高。

窗体位置和大小

        private void Form1_Load(object sender, EventArgs e)
        {
            /*
                System.Windows.Forms.SystemInformation.WorkingArea.Width //屏幕宽度
                System.Windows.Forms.SystemInformation.WorkingArea.Height //屏幕高度(去系统任务栏,当显示有任务栏的时候)
                this.Size.Width   //自己窗体的宽度,
                this.Size.Width   //自己窗体的高度
                this.ClientRectangle.Width  //工作区域宽度
                this.ClientRectangle.Height  //工作区域高度设置窗口初始位置
                this.StartPosition = FormStartPosition.Manual; //窗体的位置由Location属性决定
                this.StartPosition = FormStartPosition.CenterParent; //窗体在其父窗体中居中
                this.StartPosition = FormStartPosition.CenterScreen; //窗体在当前显示窗口中居中,尺寸在窗体大小中指定
                this.StartPosition = FormStartPosition.WindowsDefaultBounds; //窗体定位在windows默认位置,边界也由windows默认决定
                this.StartPosition = FormStartPosition.WindowsDefaultLocation; //窗体定位在windows默认位置,尺寸在窗体大小中指定
             */

            #region 居中显示
            //int x = (System.Windows.Forms.SystemInformation.WorkingArea.Width - this.Size.Width) / 2;
            //int y = (System.Windows.Forms.SystemInformation.WorkingArea.Height - this.Size.Height) / 2;
            //this.StartPosition = FormStartPosition.Manual; //窗体的位置由Location属性决定
            //this.Location = (Point)new Size(x, y);         //窗体的起始位置为(x,y)


            #endregion

            #region 全屏显示
            不包括任务栏、停靠窗口和停靠工具栏。
            //Rectangle rect = Screen.GetWorkingArea(this);//工作区是显示器的桌面区域,不包括任务栏、停靠窗口和停靠工具栏。
            Point p = new Point(rect.Width, rect.Height);
            this.Size = new Size(p);
            this.Location = (Point)new Size(0, 0);


            不包括任务栏、停靠窗口和停靠工具栏。
            //var x = System.Windows.Forms.SystemInformation.WorkingArea.Width; //屏幕宽度
            //var y = System.Windows.Forms.SystemInformation.WorkingArea.Height; //屏幕高度(去系统任务栏,当显示有任务栏的时候)
            //this.ClientSize = new System.Drawing.Size(x, y);
            //this.Location = (Point)new Size(0, 0);

            //全屏显示
            this.FormBorderStyle = FormBorderStyle.None;     //设置窗体边框样式
            this.WindowState = FormWindowState.Maximized;    //最大化窗体
            #endregion
        }
        private void MinBtn_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }
        private void NormalBtn_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Normal;
        }
        private void MaxBtn_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
        }
        private void ExitBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/729098
推荐阅读
相关标签
  

闽ICP备14008679号