Main.pas
资源名称:delphi.rar [点击查看]
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:2k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit Main;
- interface
- uses Windows, Classes, Graphics, Forms, Controls,
- StyleD, ListD, StdCtrls, ExtCtrls;
- type
- TForm1 = class(TForm)
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label5: TLabel;
- Label6: TLabel;
- StyleButton: TButton;
- Bevel1: TBevel;
- procedure LabelDoubleClick(Sender: TObject);
- procedure LabelClick(Sender: TObject);
- procedure StyleButtonClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.DFM}
- procedure TForm1.LabelDoubleClick(Sender: TObject);
- begin
- with ListDial.Listbox1 do
- begin
- // select current the name in the listbox
- ItemIndex := Items.IndexOf ((Sender as TLabel).Caption);
- // show the modal dialog box, checking the return value
- if (ListDial.ShowModal = mrOk) and (ItemIndex >= 0) then
- // if OK, then copy the selected item of the list to the label
- (Sender as TLabel).Caption := Items [ItemIndex];
- end;
- end;
- procedure TForm1.LabelClick(Sender: TObject);
- var
- I: Integer;
- begin
- for I := 0 to ComponentCount - 1 do
- if (Components[I] is TLabel) and
- (Components[I].Tag = 1) then
- TLabel (Components[I]).Font.Color := clBlack;
- // set the color of the clicked label to red
- (Sender as TLabel).Font.Color := clRed;
- end;
- procedure TForm1.StyleButtonClick(Sender: TObject);
- begin
- // run modeless dialog
- StyleDial.Show;
- end;
- end.