home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 25 / nopv25.iso / 040A / ISBTNDEM.ZIP / UNIT1.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1997-03-17  |  2.5 KB  |  104 lines

  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   WinProcs, WinTypes, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   shpbtn, StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     isShapeButton1: TisShapeButton;
  12.     cbxBtnShape: TComboBox;
  13.     cbxColor: TComboBox;
  14.     cbxBrush: TComboBox;
  15.     Memo1: TMemo;
  16.     procedure cbxBtnShapeChange(Sender: TObject);
  17.     procedure FormActivate(Sender: TObject);
  18.     procedure FormCreate(Sender: TObject);
  19.     procedure cbxColorChange(Sender: TObject);
  20.     procedure cbxBrushChange(Sender: TObject);
  21.   private
  22.     procedure AddColor(const s: string);
  23.   public
  24.     { Public declarations }
  25.   end;
  26.  
  27. var
  28.   Form1: TForm1;
  29.  
  30. implementation
  31.  
  32. {$R *.DFM}
  33. uses
  34.   TypInfo;
  35.  
  36. procedure TForm1.cbxBtnShapeChange(Sender: TObject);
  37. var
  38.   tmp: TButtonShape;
  39. begin
  40.   tmp := Low(TButtonShape);
  41.   Inc(tmp, cbxBtnShape.ItemIndex);
  42.   isShapeButton1.ButtonShape := tmp;
  43. end;
  44.  
  45. procedure TForm1.FormActivate(Sender: TObject);
  46. var
  47.   i: integer;
  48. begin
  49.   cbxBtnShape.ItemIndex := Ord(isShapeButton1.ButtonShape);
  50.   for i := 0 to cbxColor.Items.Count do
  51.     if cbxColor.Items[i] = ColorToString(isShapeButton1.Color) then
  52.       begin
  53.         cbxColor.ItemIndex := i;
  54.         Break;
  55.       end;
  56.   cbxBrush.ItemIndex := Ord(isShapeButton1.BrushStyle);
  57. end;
  58.  
  59. procedure TForm1.AddColor(const s: string);
  60. begin
  61.   cbxColor.Items.Add(s);
  62. end;
  63.  
  64. procedure TForm1.FormCreate(Sender: TObject);
  65. var
  66.   i: integer;
  67.   PropInf: PPropInfo;
  68.   col: TColor;
  69. begin
  70.   PropInf := GetPropInfo(isShapeButton1.ClassInfo, 'ButtonShape');
  71.   if PropInf <> nil then
  72.     for i := Ord(Low(TButtonShape)) to Ord(High(TButtonShape)) do
  73.       {$IFDEF VER80}
  74.       cbxBtnShape.Items.Add(GetEnumName(PropInf^.PropType, i)^);
  75.       {$ELSE}
  76.       cbxBtnShape.Items.Add(GetEnumName(PropInf^.PropType, i));
  77.       {$ENDIF}
  78.   GetColorValues(AddColor);
  79.   PropInf := GetPropInfo(isShapeButton1.ClassInfo, 'BrushStyle');
  80.   if PropInf <> nil then
  81.     for i := Ord(Low(TBrushStyle)) to Ord(High(TBrushStyle)) do
  82.       {$IFDEF VER80}
  83.       cbxBrush.Items.Add(GetEnumName(PropInf^.PropType, i)^);
  84.       {$ELSE}
  85.       cbxBrush.Items.Add(GetEnumName(PropInf^.PropType, i));
  86.       {$ENDIF}
  87. end;
  88.  
  89. procedure TForm1.cbxColorChange(Sender: TObject);
  90. begin
  91.   isShapeButton1.Color := StringToColor(cbxColor.Text);
  92. end;
  93.  
  94. procedure TForm1.cbxBrushChange(Sender: TObject);
  95. var
  96.   tmp: TBrushStyle;
  97. begin
  98.   tmp := Low(TBrushStyle);
  99.   Inc(tmp, cbxBrush.ItemIndex);
  100.   isShapeButton1.BrushStyle := tmp;
  101. end;
  102.  
  103. end.
  104.