zoukankan      html  css  js  c++  java
  • 为StatusStrip 添加分割线

    想要在页面底部添加StatusStrip, 里面包含一个显示状态的label 和一个显示进度的progressbar。为了看着好看一点儿,想把他们分割开来,google了半天也没找到合适的办法,默认在页面上可以添加四种StatusStrip的控件。但都不能实现想要的分割开的效果:

    最后想了个办法,把label的宽度设置成固定,然后加一个ToolStripSeparator,然后设置ToolStripSeparator的left margin,譬如20,就实现了分割的效果。

    代码如下:

    View Code
     1  // 
     2             // toolStripStatusLabel1
     3             // 
     4             this.toolStripStatusLabel1.AutoSize = false;
     5             this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
     6             this.toolStripStatusLabel1.Size = new System.Drawing.Size(250, 18);
     7             this.toolStripStatusLabel1.Text = "Idle";
     8             this.toolStripStatusLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
     9             // 
    10             // toolStripSeparator1
    11             // 
    12             this.toolStripSeparator1.Margin = new System.Windows.Forms.Padding(30, 0, 0, 0);
    13             this.toolStripSeparator1.Name = "toolStripSeparator1";
    14             this.toolStripSeparator1.Size = new System.Drawing.Size(6, 23);
    15             // 
    16             // toolStripProgressBar1
    17             // 
    18             this.toolStripProgressBar1.Name = "toolStripProgressBar1";
    19             this.toolStripProgressBar1.Size = new System.Drawing.Size(120, 17);
    20             // 

    大功告成,效果图如下

  • 相关阅读:
    C# 杂活
    常用 SQL Server 规范集锦
    C# 文件操作
    使用Git 本地代码提交到 GitHub
    Numpy的小总结
    C#最佳工具集合:IDE、分析、自动化工具等
    Web服务器、应用服务器、Web容器、反向代理服务器区别与联系
    Platt SMO 和遗传算法优化 SVM
    Pycharm配置(三)
    Pycharm配置(二)
  • 原文地址:https://www.cnblogs.com/lin2yatou/p/2749987.html
Copyright © 2011-2022 走看看