zoukankan      html  css  js  c++  java
  • 用户界面设计(7)- 窗体上的状态栏应用(StatusBar)

    状态栏(StatusBar)一般用来提示系统和用户有用的信息,比如当前系统日期、软件版本、操作状态等。通常显示在窗口底部。

    1、窗体上添加状态栏,主要属性为Panels属性,TStatusPanels是一个TstatusPanel对象的集合,Panels属性可以为状态栏创建多个Panel,Panel之间会被分割显示。

     

    2、AutoHint属性用来确定状态栏的文本是否被自动设置成为当前的提示信息。

    例子:设置StatusBar属性AutoHint为True,Hint键入提示信息,运行程序鼠标悬停就可以看到提示信息出现在状态栏,不过状态栏Panels[x] 内容会被洗掉(固定不会,也就是showhint)。

    3、SimplePanel属性为单面板状态栏,设置为True后,状态栏只有一个面板,SimpleText属性可以设置单面板状态栏显示内容。

    4、SizeGrip属性设置为True后,官方说明在状态栏右下方会显示三角形标志可调整状态栏大小(设置之后的确出现标志,但是实际是调整窗体大小)。

    5、手动设置Panels的Text内容:

    StatusBar1.Panels[0].Text:= '**科技有限公司';
      StatusBar1.Panels[1].Text:= '当前状态:';
      StatusBar1.Panels[2].Text:= (Sender as TToolButton).Caption;//将工具栏按钮caption赋值

    6、为状态栏添加图标,Delphi并没有像工具栏那样给状态栏添加图标的功能,所以我们需要代码实现。

      image1.Parent:= StatusBar1;
      Image1.Left:= StatusBar1.Panels[0].Width+ StatusBar1.Panels[1].Width+2 ;
      Image1.Top:= 10;
      //Image1.Picture.LoadFromFile('');//手动添加图片

    7、在状态栏上添加进度条

    窗体上添加TAnimate组件,设置ConmmonAVI属性为aviCopyFiles。添加TStatusBar,TButtoon组件,TGauge组件。

    begin
      Statusbar1.Panels[0].Text:= '当前操作为:文件复制';
      Gauge1.Parent:= StatusBar1;
      Gauge1.Left:= StatusBar1.Panels[0].Width+3;
      Gauge1.top:= 3;
      Gauge1.Width:= StatusBar1.Width - StatusBar1.Panels[0].Width-3;
      Gauge1.Height:= StatusBar1.Height-3;
      Gauge1.MinValue:= 0;
      Gauge1.MaxValue:= 100;
      Animate1.Active:= True;
      for i:= 0 to 100 do
      begin
        Gauge1.Progress:= i;
        Application.ProcessMessages;
        Sleep(200);
      end;
      Animate1.Active:= False;
    end;

    8、在状态栏上显示时钟及日期

    窗体上添加TStatusBar组件和TTimer组件,设置TTimer组件的 Intervar属性为500,放一个按钮。

    statusbar1.Panels[0].Text:= '当前日期';
      StatusBar1.Panels[1].Text:= FormatDateTime('yyyy 年 mm 月 dd 日  hh 点 nn 分 ddd',now)
  • 相关阅读:
    高精度计算
    高精度除以低精度
    P1258 小车问题
    POJ 2352 stars (树状数组入门经典!!!)
    HDU 3635 Dragon Balls(超级经典的带权并查集!!!新手入门)
    HDU 3938 Portal (离线并查集,此题思路很强!!!,得到所谓的距离很巧妙)
    POJ 1703 Find them, Catch them(确定元素归属集合的并查集)
    HDU Virtual Friends(超级经典的带权并查集)
    HDU 3047 Zjnu Stadium(带权并查集,难想到)
    HDU 3038 How Many Answers Are Wrong(带权并查集,真的很难想到是个并查集!!!)
  • 原文地址:https://www.cnblogs.com/fansizhe/p/12782535.html
Copyright © 2011-2022 走看看