The demo of the progress bar.

xiaoxiao2021-03-06  14

Unit unit1;

Interface

Uses Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Extctrls, Stdctrls, Comctrls

{================================================================================================================================================================================================================ ==== Design By: Harmony Month / Jade Side: http://www.eastrise.cn/quick2004 blog: http://blog.9cbs.net/jackie168 email: Joe-lu @ 163.com

The article is the author original. Please contact him before reprinting, reprint, please indicate the article, retain the author information, thank you for your support! ============================================================================================================================================================================================================= ===} type TFrm_PanelBar = class (TForm) Button1: TButton; Timer1: TTimer; Button2: TButton; BarFrame: TPanel; PanelBar: TImage; PanelLab: TLabel; CheckBox1: TCheckBox; ColorBox1: TColorBox; Label1: TLabel; Bevel1: TBevel ; procedure Timer1Timer (Sender: TObject); procedure Button1Click (Sender: TObject); procedure Button2Click (Sender: TObject); procedure FormCreate (Sender: TObject); procedure CheckBox1Click (Sender: TObject); procedure ColorBox1Change (Sender: TObject); private {Private declarations}} {public declarations} END;

Var FRM_PANELBAR: TFRM_PANELBAR;

IMPLEMENTATION

{$ R * .dfm}

Procedure tfrm_panelbar.timer1timer (sender: TOBJECT); VAR N, M: Integer; // Variable Begin // --------------------------- - Display progress strip status ------------------------------- panelbar.width: = panelbar.width 1; N : = Panelbar.width; m: = barframe.width-2; panellab.caption: = formatfloat ('0', n / m * 100) '%'; // ----------- ------------------ Cycle rolling progress bar ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---- if panelbar.width = barframe.width-2 Then Panelbar.width: = 0; end; procedure tfrm_panelbar.button1click (sender: TOBJECT); begin Timer1.enabled: = true;

Procedure tfrm_panelbar.Button2Click (sender: TOBJECT); begin Timer1.enabled: = false;

Procedure tfrm_panelbar.formcreate (sender: Tobject); begin // ----------------------------- Initialization data -------- ------------------------------ PANELBAR.LEFT: = 1; panelbar.top:=1; panelbar.width: = 0; panelbar.height: = barframe.height-2; panellab.top:=(Barframe.Height-Panellab.Height) Div 2; panellab.left: = (barframe.width-panellab.width) DIV 2;

// ------------------------------- Open Shuangshui ------------- ------------------------ Self.doubleBufffred: = true;

Procedure tfrm_panelbar.checkbox1click (sender: TOBIECT); begin // ------------------------------ Whether to display progress labels --- -------------------------- Panellab.visible: = NOT Panel.visible;

Procedure tfrm_panelbar.colorbox1change (sender: TOBIECT); begin // ----------------------------- Set background color ---- ---------------------------- Barframe.Color: = colorbox1.selected;

End.

***************** Form file content (Unit1.dfm): ******************

object Frm_PanelBar: TFrm_PanelBar Left = 374 Top = 263 BorderIcons = [biSystemMenu, biMinimize] BorderStyle = bsSingle Caption = # 36827 # 24230 # 26465 # 30340 # 28436 # 31034 ClientHeight = 144 ClientWidth = 393 Color = clBtnFace Font.Charset = ANSI_CHARSET Font. Color = clWindowText Font.Height = -12 Font.Name = # 23435 # 20307 Font.Style = [] OldCreateOrder = False Position = poScreenCenter OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 12 object Bevel1: TBevel Left = 8 Top = 8 Width = 377 Height = 81 Shape = bsFrame end object Label1: TLabel Left = 155 Top = 58 Width = 72 Height = 12 Caption = 'BrushColor' # 65306 end object BarFrame: TPanel Left = 24 Top = 24 Width = 347 Height = 17 BevelInner = Bvlowered Bevelouter = bvnone Taborder = 2 Object Panel: TIMAGE LEFT = 1 TOP = 1 Width = 25 Height = 15 Picture.Data =

{07544269746D61702E020000424D2E0200000000000036000000280000000C00 00000E0000000100180000000000F80100000000000000000000000000000000 0000FEE4C0FEE4C0FEE4C0FEE4C0FEE4C0FEE4C0FEE4C0FEE4C0FBE5BCFBE5BC FBE5BCFBE5BCFAE0B2FAE0B2FAE0B2FAE0B2FAE0B2FAE0B2FAE0B2FAE0B2FADF B3FADFB3FADFB3FADFB3F6D6A5F6D6A5F6D6A5F6D6A5F6D6A5F6D6A5F6D6A5F6 D6A5F8D7A6F8D7A6F8D7A6F8D7A6F6D6A5F6D6A5F6D6A5F6D6A5F6D6A5F6D6A5 F6D6A5F6D6A5F8D7A6F8D7A6F8D7A6F8D7A6F6CB98F6CB98F6CB98F6CB98F6CB 98F6CB98F6CB98F6CB98F6CC97F6CC97F6CC97F6CC97F5C18CF5C18CF5C18CF5 C18CF5C18CF5C18CF5C18CF5C18CF4C38BF4C38BF4C38BF4C38BF3BE7FF3BE7F F3BE7FF3BE7FF3BE7FF3BE7FF3BE7FF3BE7FF3BD80F3BD80F3BD80F3BD80F3BD 81F3BD81F3BD81F3BD81F3BD81F3BD81F3BD81F3BD81F3BD81F3BD81F3BD81F3 BD81F3CA99F3CA99F3CA99F3CA99F3CA99F3CA99F3CA99F3CA99F4CA9BF4CA9B F4CA9BF4CA9BF9D5B1F9D5B1F9D5B1F9D5B1F9D5B1F9D5B1F9D5B1F9D5B1F7D6 AFF7D6AFF7D6AFF7D6AFF9E5CCF9E5CCF9E5CCF9E5CCF9E5CCF9E5C CF9E5CCF9 E5CCFBE5CCFBE5CCFBE5CCFBE5CCFEEFDFFEEFDFFEEFDFFEEFDFFEEFDFFEEFDF FEEFDFFEEFDFFAEFE1FAEFE1FAEFE1FAEFE1FEEFDFFEEFDFFEEFDFFEEFDFFEEF DFFEEFDFFEEFDFFEEFDFFAEFE1FAEFE1FAEFE1FAEFE1FDEFE3FDEFE3FDEFE3FD EFE3FDEFE3FDEFE3FDEFE3FDEFE3FCEFE1FCEFE1FCEFE1FCEFE1} Stretch = True end object PanelLab: TLabel Left = 172 Top = 2 Width = 12 Height = 12 Caption = '0%' Transparent = True end end object Button1: TButton Left = 109 Top = 104 Width = 75 Height = 25 capen = 'start' taborder = 0 onclick = Button1click end Object Button2: tbutton left = 245 TOP =

转载请注明原文地址:https://www.9cbs.com/read-48781.html

New Post(0)