home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: Shareware for Win 95
/
Chip-Shareware-Win95.bin
/
ostatni
/
delphi
/
ruzne
/
rzcomps.exe
/
DEMO
/
PANELFRM.PA_
/
PANELFRM.PA
Wrap
Text File
|
1996-10-18
|
6KB
|
234 lines
{===============================================================================
RzPnlEdt Unit
This unit implements a component editor for the RzPanel component. This
unit defines the TRzPanelEditor class and the TRzPanelEditDlg class. The
TRzPanelEditor displays the TRzPanelEditDlg form when the component is
double-clicked or the first context menu item is chosen. The form provides a
more visual way of editing the properties of the RzPanel component with
immediate visual feedback.
Copyright ⌐ 1995-1996 by Raize Software Solutions, Inc.
===============================================================================}
unit Panelfrm;
interface
uses
Forms, Controls, Classes, Graphics, StdCtrls, WinTypes, DsgnIntf, ExtCtrls,
RzCmboBx, RzPanel, RzTrkBar, RzLabel, RzRadGrp;
type
TFrmPanelEditor = class(TForm)
GrpBorder: TGroupBox;
LblOuter: TLabel;
LblInner: TLabel;
CbxOuter: TComboBox;
CbxInner: TComboBox;
GrpWidth: TGroupBox;
TrkWidth: TRzTrackBar;
GrpPreview: TGroupBox;
CbxBorderColor: TRzColorComboBox;
Label1: TLabel;
GrpBorderSides: TGroupBox;
GrpFrameSides: TGroupBox;
ChkLeftBorder: TCheckBox;
ChkTopBorder: TCheckBox;
ChkRightBorder: TCheckBox;
ChkBottomBorder: TCheckBox;
ChkLeftFrame: TCheckBox;
ChkTopFrame: TCheckBox;
ChkRightFrame: TCheckBox;
ChkBottomFrame: TCheckBox;
BtnOK: TButton;
PnlPreview: TRzPanel;
RzLabel1: TRzLabel;
GrpAlignment: TRzRadioGroup;
procedure TrkWidthDrawTick(TrackBar: TRzTrackBar; Canvas: TCanvas;
Location: TPoint; Index: Integer);
procedure ChkBorderClick(Sender: TObject);
procedure ChkFrameClick(Sender: TObject);
procedure CbxOuterChange(Sender: TObject);
procedure CbxInnerChange(Sender: TObject);
procedure TrkWidthChange(Sender: TObject);
procedure CbxBorderColorChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure GrpAlignmentClick(Sender: TObject);
private
procedure UpdateControls;
end;
var
FrmPanelEditor : TFrmPanelEditor;
implementation
{$R *.DFM}
uses
RzCommon, SysUtils, RzIntLst, RzStatus, RzDBStat, RzPrgres, Buttons;
{=============================}
{== TRzPanelEditDlg Methods ==}
{=============================}
procedure TFrmPanelEditor.UpdateControls;
begin
CbxOuter.ItemIndex := Ord( PnlPreview.BorderOuter );
CbxInner.ItemIndex := Ord( PnlPreview.BorderInner );
ChkLeftBorder.Checked := sdLeft in PnlPreview.BorderSides;
ChkTopBorder.Checked := sdTop in PnlPreview.BorderSides;
ChkRightBorder.Checked := sdRight in PnlPreview.BorderSides;
ChkBottomBorder.Checked := sdBottom in PnlPreview.BorderSides;
ChkLeftFrame.Checked := sdLeft in PnlPreview.FrameSides;
ChkTopFrame.Checked := sdTop in PnlPreview.FrameSides;
ChkRightFrame.Checked := sdRight in PnlPreview.FrameSides;
ChkBottomFrame.Checked := sdBottom in PnlPreview.FrameSides;
TrkWidth.Position := PnlPreview.BorderWidth;
CbxBorderColor.SelectedColor := PnlPreview.BorderColor;
end;
procedure TFrmPanelEditor.TrkWidthDrawTick(TrackBar: TRzTrackBar;
Canvas: TCanvas; Location: TPoint; Index: Integer);
var
W : Integer;
S : string;
begin
if Index mod 5 = 0 then
begin
Canvas.Brush.Color := Color;
Canvas.Font.Name := 'Small Fonts';
Canvas.Font.Size := 7;
Canvas.Font.Style := [];
S := IntToStr( Index );
W := Canvas.TextWidth( S );
Canvas.TextOut( Location.X - (W div 2), 1, S );
end;
end;
procedure TFrmPanelEditor.ChkBorderClick(Sender: TObject);
begin
if TCheckBox( Sender ).Checked then
PnlPreview.BorderSides := PnlPreview.BorderSides + [ TSide( TCheckBox( Sender ).Tag ) ]
else
PnlPreview.BorderSides := PnlPreview.BorderSides - [ TSide( TCheckBox( Sender ).Tag ) ];
end;
procedure TFrmPanelEditor.ChkFrameClick(Sender: TObject);
begin
if TCheckBox( Sender ).Checked then
PnlPreview.FrameSides := PnlPreview.FrameSides + [ TSide( TCheckBox( Sender ).Tag ) ]
else
PnlPreview.FrameSides := PnlPreview.FrameSides - [ TSide( TCheckBox( Sender ).Tag ) ];
end;
procedure TFrmPanelEditor.CbxOuterChange(Sender: TObject);
begin
PnlPreview.BorderOuter := TFrameStyle( CbxOuter.ItemIndex );
end;
procedure TFrmPanelEditor.CbxInnerChange(Sender: TObject);
begin
PnlPreview.BorderInner := TFrameStyle( CbxInner.ItemIndex );
end;
procedure TFrmPanelEditor.TrkWidthChange(Sender: TObject);
begin
PnlPreview.BorderWidth := TrkWidth.Position;
end;
procedure TFrmPanelEditor.CbxBorderColorChange(Sender: TObject);
begin
PnlPreview.BorderColor := CbxBorderColor.SelectedColor;
end;
procedure TFrmPanelEditor.FormCreate(Sender: TObject);
begin
UpdateControls;
end;
procedure TFrmPanelEditor.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TFrmPanelEditor.GrpAlignmentClick(Sender: TObject);
begin
case GrpAlignment.ItemIndex of
0:
begin
PnlPreview.Alignment := taLeftJustify;
PnlPreview.AlignmentVertical := avTop;
end;
1:
begin
PnlPreview.Alignment := taLeftJustify;
PnlPreview.AlignmentVertical := avCenter;
end;
2:
begin
PnlPreview.Alignment := taLeftJustify;
PnlPreview.AlignmentVertical := avBottom;
end;
3:
begin
PnlPreview.Alignment := taCenter;
PnlPreview.AlignmentVertical := avTop;
end;
4:
begin
PnlPreview.Alignment := taCenter;
PnlPreview.AlignmentVertical := avCenter;
end;
5:
begin
PnlPreview.Alignment := taCenter;
PnlPreview.AlignmentVertical := avBottom;
end;
6:
begin
PnlPreview.Alignment := taRightJustify;
PnlPreview.AlignmentVertical := avTop;
end;
7:
begin
PnlPreview.Alignment := taRightJustify;
PnlPreview.AlignmentVertical := avCenter;
end;
8:
begin
PnlPreview.Alignment := taRightJustify;
PnlPreview.AlignmentVertical := avBottom;
end;
end;
end;
end.