Marco Web Center

[an error occurred while processing this directive]

Home: Code Repository: Mastering Delphi 6

Chapter 06 - Project StylesDemo

Project Structure

StylesDemo.dpr
program StylesDemo;

uses
QForms,
StylesForm in 'StylesForm.pas' {Form1};

{$R *.res}

begin
Application.Initialize;
Application.CreateForm(TForm1,Form1);
Application.Run;
end.
StylesForm.pas
unit StylesForm;

interface

uses
SysUtils,Types,Classes,Variants, QGraphics, QControls, QForms, QDialogs,
 QStdCtrls, QStyle, QComCtrls, QMenus, QTypes;

type
TForm1= class(TForm)
   Button1: TButton;
   ListBox1: TListBox;
   CheckBox1: TCheckBox;
   ComboBox1: TComboBox;
   ScrollBar1: TScrollBar;
   TrackBar1: TTrackBar;
   Edit1: TEdit;
   GroupBox1: TGroupBox;
   RadioButton1: TRadioButton;
   RadioButton2: TRadioButton;
   TreeView1: TTreeView;
   ListBox2: TListBox;
   procedure ListBox1DblClick(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }
 end;

var
Form1:TForm1;

implementation

{$R *.xfm}

procedureTForm1.ListBox1DblClick(Sender:TObject);
begin
Application.Style.DefaultStyle:=
TDefaultStyle (ListBox1.ItemIndex);
end;

end.
StylesForm.xfm
object Form1: TForm1
  Left = 242
  Top = 142
  Width = 570
  Height = 363
  VertScrollBar.Range = 301
  HorzScrollBar.Range = 489
  ActiveControl = Button1
  Caption = 'StylesDemo'
  Color = clBackground
  PixelsPerInch = 75
  TextHeight = 13
  TextWidth = 6
  object Button1: TButton
    Left = 184
    Top = 56
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 0
  end
  object ListBox1: TListBox
    Left = 24
    Top = 24
    Width = 129
    Height = 137
    Items.Strings = (
      'dsWindows'
      'dsMotif'
      'dsMotifPlus'
      'dsCDE'
      'dsQtSGI'
      'dsPlatinum'
      'dsSystemDefault')
    Rows = 7
    TabOrder = 1
    OnDblClick = ListBox1DblClick
  end
  object CheckBox1: TCheckBox
    Left = 184
    Top = 104
    Width = 100
    Height = 30
    Caption = 'CheckBox1'
    TabOrder = 2
  end
  object ComboBox1: TComboBox
    Left = 184
    Top = 176
    Width = 140
    Height = 21
    ItemHeight = 15
    TabOrder = 3
    Text = 'ComboBox1'
  end
  object ScrollBar1: TScrollBar
    Left = 184
    Top = 216
    Width = 121
    Height = 18
    TabOrder = 4
  end
  object TrackBar1: TTrackBar
    Left = 184
    Top = 256
    Width = 150
    Height = 45
    TabOrder = 5
  end
  object Edit1: TEdit
    Left = 184
    Top = 24
    Width = 101
    Height = 21
    TabOrder = 6
    Text = 'Edit1'
  end
  object GroupBox1: TGroupBox
    Left = 328
    Top = 40
    Width = 161
    Height = 89
    Caption = 'GroupBox1'
    TabOrder = 7
    object RadioButton1: TRadioButton
      Left = 16
      Top = 24
      Width = 113
      Height = 17
      Caption = 'RadioButton1'
      TabOrder = 0
    end
    object RadioButton2: TRadioButton
      Left = 16
      Top = 48
      Width = 113
      Height = 17
      Caption = 'RadioButton2'
      TabOrder = 1
    end
  end
  object TreeView1: TTreeView
    Left = 360
    Top = 160
    Width = 129
    Height = 105
    Columns = <>
    Items.Data = {
      040000001C000000FFFFFFFFFFFFFFFF8C292902000000000000000000000000
      036161611C000000FFFFFFFFFFFFFFFF8C292902000000000000000000000000
      036262621C000000FFFFFFFFFFFFFFFF8C292902000000000000000002000000
      036464641C000000FFFFFFFFFFFFFFFF8C292902000000000000000002000000
      036666661C000000FFFFFFFFFFFFFFFF8C292902000000000000000000000000
      036666661C000000FFFFFFFFFFFFFFFF8C292902000000000000000000000000
      036666661C000000FFFFFFFFFFFFFFFF8C292902000000000000000000000000
      036464641C000000FFFFFFFFFFFFFFFF8C292902000000000000000001000000
      036767671C000000FFFFFFFFFFFFFFFF8C292902000000000000000002000000
      036666661C000000FFFFFFFFFFFFFFFF8C292902000000000000000000000000
      036868681C000000FFFFFFFFFFFFFFFF8C292902000000000000000000000000
      036A6A6A}
    TabOrder = 8
  end
  object ListBox2: TListBox
    Left = 24
    Top = 208
    Width = 121
    Height = 57
    Items.Strings = (
      '1'
      '2'
      '3'
      '4'
      '5'
      '6'
      '7'
      '8'
      '9'
      '0')
    Rows = 10
    TabOrder = 9
  end
end