System Delphi

Title: A Farsi And Arabid Message Dialog
Question: I Make Message Dialogs For Arbic And Persion Windows
And I Want To Khnow That How I Can Make A Persion Calender
Please Help Me
Answer:
unit HbtMessageDialog;
interface
uses
SysUtils, Classes,Forms,Buttons,StdCtrls,Graphics,HbtFlashinglabel,Messages,
Controls,ExtCtrls,Windows,SizeAndPosition;
type
ThbtMessageType=(HbtWarning, HbtError, HbtInformation, HbtConfirmation, HbtCustom);
DialogsBiDiMode=Set of TBiDiMode;
MessageAliment=Set of TAlignment;
THbtMessageDialogs= class(TComponent)
private
DialogsFrm:Tform;
FDialogFont:TFont;
MessageButtons:TButton;
MessageLabels:THbtFlashinglabel;
FDialogcaption:String;
FButtonCaption:String;
FButtonSize:Tsize;
FButtonPosition:TPosition;
FFlashRate:Integer;
FFlashEnable:Boolean;
FDialogsColor:Tcolor;
FFlashLimit:Integer;
FMessageColor:Tcolor;
FButtonFlat:Boolean;
FMessageAlignment:TAlignment;
FDialogsBiDiMode:TBiDiMode;
FMessageTransparent:Boolean;
FmessageWordWrap:Boolean;
FmessageAutoSize:Boolean;
FMessageSize:TSize;
FmessagePosition:Tposition;
FDialogsSize:TSize;
FMessageFont:Tfont;
FMessageButtonFont:Tfont;
FIconPosition:TPosition;
{ Private declarations }
protected
Procedure SetDialogCaption(Acaption:String);
Procedure SetDialogsBiDiMode(ADialogsBiDiMode:TBiDiMode);
Procedure SetDialogFont(Value:Tfont);
Procedure SetDialogScolor(AdialogsColor:Tcolor);
Procedure SetDialogsSize(ADialogsSize:Tsize);
//-----------------------------------------------------------
Procedure SetButtonCaption(AbuttonCaption:String);
Procedure SetButtonSize(AButtonSize:Tsize);
Procedure SetButtonPosition(AButtonPosition:TPosition);
Procedure SetMessageButtonFont(Value:Tfont);
Procedure MessageButtonClick(Sender: TObject);
//-----------------------------------------------------------
Procedure SetFlashRate(AflashRate:Integer);
Procedure SetFlashEnable(AFlashEnable:Boolean);
Procedure SetFlashLimit(AflashLimit:Integer);
Procedure SetMessageColor(AMessageColor:Tcolor);
Procedure SetMessageAligment(AMessageAlignment:TAlignment);
Procedure OnLimitReached(Sender:Tobject;Var Stop:Boolean);
Procedure SetMessageTransparent(AmessageTransparent:Boolean);
Procedure SetMessageWordWrap(AmessageWordWrap:Boolean);
Procedure SetMessageAutoSize(AmessageAutoSize:Boolean);
Procedure SetMessageSize(AMessageSize:TSize);
Procedure SetMessagePosition(AMessagePosition:Tposition);
Procedure SetMessageFont(Value:Tfont);
Procedure SetIconPosition(Value:Tposition);
Procedure OnCanResize(Sender: TObject; var NewWidth,
NewHeight: Integer; var Resize: Boolean);
{ Protected declarations }
public
Constructor Create(AOwner:Tcomponent);override;
destructor Destroy;Override;
Procedure Show(Amsg:String;MessageType:THbtMessageType=HbtWarning);
procedure DialogsClose(Sender: TObject; var Action: TCloseAction);
{ Public declarations }
published
Property DialogSize:Tsize
Read FDialogsSize Write SetDialogsSize;
property DialogCaption:String
Read FDialogCaption Write SetDialogCaption;
Property DialogsBiDiMode:TBiDiMode
Read FDialogsBiDiMode Write SetDialogsBiDiMode Default BdRightToLeft;
Property MessageButtonCaption:String
Read FButtonCaption Write SetButtonCaption;
Property MessageButtonSize:Tsize
Read FButtonSize Write SetButtonSize;
Property MessageButtonPosition:Tposition
Read FButtonPosition Write SetButtonPosition;
Property MessageFlashRate:Integer
Read FFlashRate Write SetFlashRate Default 1000;
Property FlashEnable:Boolean
Read FFlashEnable Write SetFlashEnable Default True;
Property DialogsColor:Tcolor
Read FDialogsColor Write SetDialogsColor Default ClBtnFace;
Property MessageColor:Tcolor
Read FMessageColor Write SetMessageColor Default ClBtnFace;
Property MessageFlashLimit:Integer
Read FFlashLimit Write SetFlashLimit Default 5;
Property MessageAlignment:TAlignment
Read FMessageAlignment Write SetMessageAligment Default Tacenter;
Property MessageTransparent:Boolean
Read FMessageTransParent Write SetMessageTransparent Default False;
Property MessageWordWarp:Boolean
Read FmessageWordWrap Write SetMessageWordWrap Default False;
Property MessageAutoSize:Boolean
Read FMessageAutoSize write SetMessageAutoSize Default False;
Property MessageSize:TSize
Read FMessageSize Write SetMessageSize;
Property MessagePosition:Tposition
Read FMessagePosition Write SetMessagePosition;
Property DialogFont:Tfont
Read FDialogFont Write SetDialogFont;
property MessageFont:Tfont
Read FMessageFont Write SetMessageFont;
Property MessageButtonFont:Tfont
Read FMessageButtonFont Write SetMessageButtonFont;
Property MessageIconPosition:Tposition
Read FIconPosition Write SetIconPosition;
{ Published declarations }
end;
THbtDialog = class(Tcomponent)
private
DialogsFrm:Tform;
OkButton:TButton;
CancelButton:TButton;
MessageLabels:THbtFlashinglabel;
FDialogcaption:String;
FokButtonCaption:String;
FCancelButtonCaption:String;
FButtonsSize:Tsize;
FOkButtonPosition:TPosition;
FCancelButtonPosition:TPosition;
FFlashRate:Integer;
FFlashEnable:Boolean;
FDialogsColor:Tcolor;
FFlashLimit:Integer;
FMessageColor:Tcolor;
FButtonsFlat:Boolean;
FMessageAlignment:TAlignment;
FDialogsBiDiMode:TBiDiMode;
FMessageTransparent:Boolean;
FmessageWordWrap:Boolean;
FmessageAutoSize:Boolean;
FMessageSize:TSize;
FmessagePosition:Tposition;
FDialogsSize:TSize;
FMessageFont:Tfont;
FDialogFont:TFont;
FMessageButtonsFont:Tfont;
FResult:Boolean;
FIconPosition:TPosition;
{ Private declarations }
protected
Procedure SetDialogCaption(Acaption:String);
Procedure SetDialogsSize(ADialogsSize:Tsize);
Procedure SetDialogScolor(AdialogsColor:Tcolor);
Procedure SetDialogsBiDiMode(ADialogsBiDiMode:TBiDiMode);
Procedure SetDialogFont(Value:Tfont);
//------------------------------------------------------------
Procedure SetOkButtonCaption(AOkbuttonCaption:String);
Procedure SetCancelButtonCaption(ACancelbuttonCaption:String);
Procedure SetButtonsSize(AButtonsSize:Tsize);
Procedure SetOkButtonPosition(AOkButtonPosition:TPosition);
Procedure SetCancelButtonPosition(ACancelButtonPosition:TPosition);
procedure SetMessageButtonsFont(Value: Tfont);
Procedure OkButtonClick(Sender: TObject);
Procedure CancelButtonClick(Sender: TObject);
//------------------------------------------------------------
Procedure SetFlashRate(AflashRate:Integer);
Procedure SetFlashEnable(AFlashEnable:Boolean);
Procedure SetFlashLimit(AflashLimit:Integer);
Procedure SetMessageColor(AMessageColor:Tcolor);
Procedure SetMessageAligment(AMessageAlignment:TAlignment);
Procedure OnLimitReached(Sender:Tobject;Var Stop:Boolean);
Procedure SetMessageTransparent(AmessageTransparent:Boolean);
Procedure SetMessageWordWrap(AmessageWordWrap:Boolean);
Procedure SetMessageAutoSize(AmessageAutoSize:Boolean);
Procedure SetMessageSize(AMessageSize:TSize);
Procedure SetMessagePosition(AMessagePosition:Tposition);
Procedure SetMessageFont(Value:Tfont);
Procedure SetIconPosition(Value:Tposition);
Procedure OnCanResize(Sender: TObject; var NewWidth,
NewHeight: Integer; var Resize: Boolean);
{ Protected declarations }
public
Constructor Create(AOwner:Tcomponent);override;
destructor Destroy;Override;
Function Show(Amsg:String;MessageType:THbtMessageType=HbtWarning):Boolean;
procedure DialogsClose(Sender: TObject; var Action: TCloseAction);
{ Public declarations }
published
Property DialogSize:Tsize
Read FDialogsSize Write SetDialogsSize;
property DialogCaption:String
Read FDialogCaption Write SetDialogCaption;
Property DialogsBiDiMode:TBiDiMode
Read FDialogsBiDiMode Write SetDialogsBiDiMode Default BdRightToLeft;
Property OkButtonCaption:String
Read FOkButtonCaption Write SetOkButtonCaption;
Property CancelButtonCaption:String
Read FCancelButtonCaption Write SetCancelButtonCaption;
Property MessageButtonsSize:Tsize
Read FButtonsSize Write SetButtonsSize;
Property OkButtonPosition:Tposition
Read FOkButtonPosition Write SetOkButtonPosition;
Property CancelButtonPosition:Tposition
Read FCancelButtonPosition Write SetCancelButtonPosition;
Property MessageFlashRate:Integer
Read FFlashRate Write SetFlashRate Default 1000;
Property FlashEnable:Boolean
Read FFlashEnable Write SetFlashEnable Default True;
Property DialogsColor:Tcolor
Read FDialogsColor Write SetDialogsColor Default ClBtnFace;
Property MessageColor:Tcolor
Read FMessageColor Write SetMessageColor Default ClBtnFace;
Property MessageFlashLimit:Integer
Read FFlashLimit Write SetFlashLimit Default 5;
Property MessageAlignment:TAlignment
Read FMessageAlignment Write SetMessageAligment Default Tacenter;
Property MessageTransparent:Boolean
Read FMessageTransParent Write SetMessageTransparent Default False;
Property MessageWordWarp:Boolean
Read FmessageWordWrap Write SetMessageWordWrap Default False;
Property MessageAutoSize:Boolean
Read FMessageAutoSize write SetMessageAutoSize Default False;
Property MessageSize:TSize
Read FMessageSize Write SetMessageSize;
Property MessagePosition:Tposition
Read FMessagePosition Write SetMessagePosition;
Property DialogFont:Tfont
Read FDialogFont Write SetDialogFont;
property MessageFont:Tfont
Read FMessageFont Write SetMessageFont;
Property MessageButtonsFont:Tfont
Read FMessageButtonsFont Write SetMessageButtonsFont;
Property MessageIconPosition:Tposition
Read FIconPosition Write SetIconPosition;
{ Published declarations }
end;
var
MessageDialogs:ThbtMessageDialogs;
Size:Tsize;
IconIds:array[ThbtMessageType] of PChar = (IDI_EXCLAMATION, IDI_HAND,
IDI_ASTERISK, IDI_QUESTION, nil);
procedure Register;
implementation
//------------------------------------------------------------------------------
Constructor THbtMessageDialogs.Create;
begin
FDialogFont:=Tfont.Create;
FMessageFont:=Tfont.Create;
FMessageButtonFont:=Tfont.Create;
//------------------------------------------
FDialogFont.Name:='Microsoft Sans Serif';
FDialogFont.Size:=8;
FMessageButtonFont.Name:='Microsoft Sans Serif';
FMessageButtonFont.Size:=8;
FMessageFont.Name:='Microsoft Sans Serif';
FMessageFont.Size:=8;
//------------------------------------------
FDialogsSize:=TSize.Create;
FdialogsSize.Height:=150;
FDialogsSize.Width:=400;
FDialogCaption:='';
FDialogsBiDiMode:=BdRightToLeft;
FdialogsColor:=clbtnFace;
//-----------------------------------------
FButtonPosition:=Tposition.Create;
FButtonPosition.Top:=90;
FButtonPosition.Left:=155;
FbuttonCaption:='';
FbuttonFlat:=True;
//------------------------
FbuttonSize:=Tsize.Create;
FButtonSize.Height:=21;
FButtonSize.Width:=90;
//-----------------------------------------
FMessagePosition:=Tposition.Create;
FmessagePosition.Top:=40;
FMessagePosition.Left:=0;
FMessageColor:=ClBtnFace;
FFlashLimit:=5;
FFlashRate:=800;
FFLashEnable:=True;
FMessageAlignment:=TaCenter;
FmessageTransparent:=False;
FmessageWordwrap:=False;
FMessageAutoSize:=False;
//---------------------------
FMessageSize:=Tsize.Create;
FmessageSize.Height:=17;
FMessageSize.Width:=FDialogsSize.Width-8;
//-----------------------------------------
FIconPosition:=TPosition.Create;
FIconPosition.Top:=4;
FIconPosition.Left:=FdialogsSize.width-42;
Inherited;
end;
//------------------------------------------------------------------------------
Destructor THbtMessageDialogs.Destroy;
begin
MessageButtons.Free;
MessageLabels.Free;
Dialogsfrm.Free;
FMessageSize.Free;
FButtonSize.Free;
FDialogsSize.Free;
FDialogfont.Free;
FmessageButtonFont.Free;
FMessagePosition.Free;
FButtonPosition.Free;
FIconPosition.Free;
FmessageFont.Free;
Inherited;
end;
//------------------------------------------------------------------------------
Procedure THbtMessageDialogs.Show;
var
IconID: PChar;
begin
//-----------------Dialogs Form-------------------------------------------
DialogsFrm:=Tform.Create(Self);
DialogsFrm.Height:=FDialogsSize.Height;
DialogsFrm.Width:=FDialogsSize.Width;
DialogsFrm.FormStyle:=fsStayOnTop;
DialogsFrm.Position:=PoMainFormCenter;
DialogsFrm.Caption:=FdialogCaption;
DialogsFrm.BorderIcons:=[biSystemMenu];
DialogsFrm.BorderStyle:=BsSingle;
DialogsFrm.OnCanResize:=OnCanResize;
DialogsFrm.BiDiMode:=FDialogsBiDiMode;
DialogsFrm.VertScrollBar.Visible:=False;
DialogsFrm.HorzScrollBar.Visible:=False;
DialogsFrm.Color:=FDialogsColor;
DialogsFrm.Font:=FDialogFont;
DialogsFrm.KeyPreview:= True;
//------Message Buttons---------------------------------------------------
MessageButtons:=TButton.Create(Self);
MessageButtons.Parent:=DialogsFrm;
MessageButtons.Caption:=FbuttonCaption;
MessageButtons.Anchors:=[akBottom];
MessageButtons.Height:=FbuttonSize.Height;
MessageButtons.Width:=FbuttonSize.Width;
MessageButtons.Top:=FbuttonPosition.Top;
MessageButtons.Left:=FbuttonPosition.Left;
MessageButtons.OnClick:=MessageButtonClick;
MessageButtons.Font:=FMessageButtonFont;
//------Message Lables----------------------------------------------------
MessageLabels:=ThbtFlashingLabel.Create(Self);
MessageLabels.Parent:=DialogsFrm;
Messagelabels.AutoSize:=False;
Messagelabels.FlashRate:=FFLashRate;
MessageLabels.Alignment:=FMessageAlignment;
MessageLabels.Transparent:=FMessageTransparent;
Messagelabels.FlashEnable:=FFlashEnable;
MessageLabels.FLashLimit:=FFlashLimit;
MessageLabels.OnLimitReached:=OnLimitReached;
Messagelabels.Width:=FmessageSize.Width;
Messagelabels.Height:=FMessageSize.Height;
MessageLabels.Left:=FMessagePosition.Left;
MessageLabels.Top:=FmessagePosition.Top;
MessageLabels.Caption:=Amsg;
MessageLabels.Color:=FMessageColor;
MessageLabels.WordWrap:=FMessageWordWrap;
MessageLabels.AutoSize:=FMessageAutoSize;
MessageLabels.Left:=FMessagePosition.Left;
MessageLabels.Top:=FMessagePosition.Top;
MessageLabels.Font:=FMessageFont;
//----Message Icon--------------------------------------------------------
IconID := IconIDs[MessageType];
if IconID nil then
with TImage.Create(DialogsFrm) do
begin
Name := 'Image';
Parent :=DialogsFrm ;
Picture.Icon.Handle := LoadIcon(0, IconID);
DialogsFrm.Icon.Handle:=LoadIcon(0, IconID);
SetBounds(FiconPosition.Left,FiconPosition.Top,32,32);
end;
//------------------------------------------------------------------------
Dialogsfrm.ShowModal;
DialogsFrm.OnClose:=DialogsClose;
//------------------------------------------------------------------------
end;
//------------------------------------------------------------------------------
procedure THbtMessageDialogs.DialogsClose;
begin
Inherited;
Free;
end;
//------------------------------------------------------------------------------
Procedure THbtMessageDialogs.SetDialogCaption;
begin
FDialogCaption:=Acaption;
end;
//------------------------------------------------------------------------------
Procedure THbtMessageDialogs.SetButtonCaption;
begin
FbuttonCaption:=AbuttonCaption;
end;
//------------------------------------------------------------------------------
Procedure THbtMessageDialogs.SetFlashRate;
begin
FFlashRate:=AflashRate;
end;
//------------------------------------------------------------------------------
Procedure THbtMessageDialogs.SetFlashEnable;
begin
FFlashEnable:=AflashEnable;
end;
//------------------------------------------------------------------------------
procedure THbtMessageDialogs.SetDialogScolor;
begin
FDialogsColor:=AdialogsColor;
end;
//------------------------------------------------------------------------------
Procedure THbtMessageDialogs.SetMessageColor;
begin
FMessageColor:=AMessageColor;
end;
//------------------------------------------------------------------------------
procedure THbtMessageDialogs.SetFlashLimit;
begin
FFlashLimit:=AflashLimit;
end;
//------------------------------------------------------------------------------
Procedure THbtMessageDialogs.SetMessageAligment;
begin
FMessageAlignment:=AMessageAlignment;
end;
//------------------------------------------------------------------------------
Procedure THbtMessageDialogs.MessageButtonClick;
begin
Inherited;
DialogsFrm.Close;
end;
//------------------------------------------------------------------------------
Procedure THbtMessageDialogs.OnLimitReached;
begin
Inherited;
Stop:=True;
end;
//------------------------------------------------------------------------------
Procedure THbtMessageDialogs.SetDialogsBiDiMode;
begin
FDialogsBiDiMode:=ADialogsBiDiMode;
end;
//------------------------------------------------------------------------------
Procedure THbtMessageDialogs.SetMessageTransparent;
begin
FMessageTransparent:=AmessageTransparent;
end;
//------------------------------------------------------------------------------
Procedure THbtMessageDialogs.SetMessageWordWrap;
begin
FmessageWordWrap:=AmessageWordWrap;
end;
//------------------------------------------------------------------------------
Procedure ThbtMessageDialogs.SetMessageAutoSize;
begin
FMessageAutoSize:=AMessageAutoSize;
end;
//------------------------------------------------------------------------------
procedure THbtMessageDialogs.SetMessageSize(AMessageSize: TSize);
begin
FmessageSize.Height:=AmessageSize.Height;
FmessageSize.Width:=AmessageSize.Width;
end;
//------------------------------------------------------------------------------
procedure THbtMessageDialogs.SetButtonSize(AButtonSize: Tsize);
begin
FButtonSize.Height:=AbuttonSize.Height;
FButtonSize.Width:=AbuttonSize.Width;
end;
//------------------------------------------------------------------------------
procedure THbtMessageDialogs.SetButtonPosition(AButtonPosition: TPosition);
begin
FButtonPosition.Top:=AbuttonPosition.Top;
FButtonPosition.Left:=AbuttonPosition.Left;
end;
//------------------------------------------------------------------------------
procedure THbtMessageDialogs.SetDialogsSize(ADialogsSize: Tsize);
begin
FDialogsSize.Height:=AdialogsSize.Height;
FDialogsSize.Width:=ADialogsSize.Width;
end;
//------------------------------------------------------------------------------
procedure THbtMessageDialogs.SetMessagePosition(
AMessagePosition: Tposition);
begin
FMessagePosition.Top:=AMessagePosition.Top;
FMessagePosition.Left:=AMessagePosition.Left;
end;
//------------------------------------------------------------------------------
procedure THbtMessageDialogs.SetDialogFont(Value: Tfont);
begin
FDialogFont.Assign(Value);
end;
//------------------------------------------------------------------------------
procedure THbtMessageDialogs.SetMessageButtonFont(Value: Tfont);
begin
FmessageButtonfont.Assign(Value);
end;
//------------------------------------------------------------------------------
procedure THbtMessageDialogs.SetMessageFont(Value: Tfont);
begin
FMessageFont.Assign(Value);
end;
//------------------------------------------------------------------------------
procedure THbtMessageDialogs.SetIconPosition(Value: Tposition);
begin
FiconPosition.Top:=Value.Top;
FiconPosition.Left:=Value.Left;
end;
procedure THbtMessageDialogs.OnCanResize(Sender: TObject; var NewWidth,
NewHeight: Integer; var Resize: Boolean);
begin
Resize:=False;
Inherited;
end;
{HbtDialog}
constructor THbtDialog.Create(AOwner: Tcomponent);
begin
FDialogFont:=Tfont.Create;
FMessageFont:=Tfont.Create;
FMessageButtonsFont:=Tfont.Create;
//------------------------------------------
FDialogFont.Name:='Microsoft Sans Serif';
FDialogFont.Size:=8;
//-------------------
FMessageButtonsFont.Name:='Microsoft Sans Serif';
FMessageButtonsFont.Size:=8;
//-------------------
FMessageFont.Name:='Microsoft Sans Serif';
FMessageFont.Size:=8;
//------------------------------------------
FDialogsSize:=TSize.Create;
FdialogsSize.Height:=150;
FDialogsSize.Width:=400;
FDialogCaption:='';
FDialogsBiDiMode:=BdRightToLeft;
FdialogsColor:=clbtnFace;
//-----------------------------------------
FOkButtonPosition:=Tposition.Create;
FOkButtonPosition.Top:=90;
FOkButtonPosition.Left:=106;
FOkbuttonCaption:='';
//------------------------------------------
FCancelButtonposition:=TPosition.Create;
FCancelButtonPosition.top:=90;
FCancelButtonPosition.left:=10;
FCancelButtonCaption:='';
//-------------------------------------------
FbuttonsFlat:=True;
FbuttonsSize:=Tsize.Create;
FButtonsSize.Height:=21;
FButtonsSize.Width:=90;
//-----------------------------------------
FMessagePosition:=Tposition.Create;
FmessagePosition.Top:=40;
FMessagePosition.Left:=0;
FMessageColor:=ClBtnFace;
FFlashLimit:=5;
FFlashRate:=800;
FFLashEnable:=True;
FMessageAlignment:=TaCenter;
FmessageTransparent:=False;
FmessageWordwrap:=False;
FMessageAutoSize:=False;
//---------------------------
FMessageSize:=Tsize.Create;
FmessageSize.Height:=17;
FMessageSize.Width:=FDialogsSize.Width-8;
//-----------------------------------------
FIconPosition:=TPosition.Create;
FIconPosition.Top:=2;
FIconPosition.Left:=FDialogsSize.Width-42;
inherited;
end;
//------------------------------------------------------------------------------
destructor THbtDialog.Destroy;
begin
OkButton.Free;
CancelButton.Free;
MessageLabels.Free;
Dialogsfrm.Free;
FMessageSize.Free;
FButtonsSize.Free;
FDialogsSize.Free;
FDialogfont.Free;
FMessagePosition.Free;
FOkButtonPosition.Free;
FCancelButtonPosition.Free;
FIconPosition.Free;
FmessageButtonsFont.Free;
FmessageFont.Free;
inherited;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.DialogsClose(Sender: TObject;
var Action: TCloseAction);
begin
Inherited;
Free;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.OkButtonClick(Sender: TObject);
begin
Inherited;
FResult:=True;
DialogsFrm.Close;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.OnLimitReached(Sender: Tobject; var Stop: Boolean);
begin
Inherited;
Stop:=True;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetOkButtonCaption(AOkbuttonCaption: String);
begin
FOkButtonCaption:=AOkButtonCaption;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetButtonsSize(AButtonsSize: Tsize);
begin
FButtonsSize.Height:=AButtonsSize.Height;
FButtonsSize.Width:=AButtonsSize.Width;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetCancelButtonPosition(
ACancelButtonPosition: TPosition);
begin
FcancelButtonPosition.Top:=ACancelButtonPosition.Top;
FCancelButtonPosition.Left:=ACancelButtonPosition.Left;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetCancelButtonCaption(ACancelbuttonCaption: String);
begin
FCancelButtonCaption:=ACancelButtonCaption;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.CancelButtonClick(Sender: TObject);
begin
Inherited;
FResult:=False;
DialogsFrm.Close;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetDialogCaption(Acaption: String);
begin
FDialogCaption:=Acaption;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetDialogFont(Value: Tfont);
begin
FdialogFont.Assign(Value);
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetDialogsBiDiMode(ADialogsBiDiMode: TBiDiMode);
begin
FDialogsBiDiMode:=ADialogsBiDiMode;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetDialogScolor(AdialogsColor: Tcolor);
begin
FDialogsColor:=AdialogsColor;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetDialogsSize(ADialogsSize: Tsize);
begin
FDialogsSize.Height:=AdialogsSize.Height;
FDialogsSize.Width:=ADialogsSize.Width;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetFlashEnable(AFlashEnable: Boolean);
begin
FFlashEnable:=AflashEnable;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetFlashLimit(AflashLimit: Integer);
begin
FFlashLimit:=AflashLimit;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetFlashRate(AflashRate: Integer);
begin
FFlashRate:=AflashRate;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetMessageAligment(AMessageAlignment: TAlignment);
begin
FMessageAlignment:=AMessageAlignment;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetMessageAutoSize(AmessageAutoSize: Boolean);
begin
FMessageAutoSize:=AMessageAutoSize;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetMessageButtonsFont(Value: Tfont);
begin
FMessageButtonsFont.Assign(Value);
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetMessageColor(AMessageColor: Tcolor);
begin
FmessageColor:=AMessageColor;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetMessageFont(Value: Tfont);
begin
FMessageFont.Assign(Value);
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetMessagePosition(AMessagePosition: Tposition);
begin
FMessagePosition.Top:=AMessagePosition.Top;
FMessagePosition.Left:=AMessagePosition.Left;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetMessageSize(AMessageSize: TSize);
begin
FmessageSize.Height:=AmessageSize.Height;
FmessageSize.Width:=AmessageSize.Width;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetMessageTransparent(AmessageTransparent: Boolean);
begin
FMessageTransparent:=AmessageTransparent;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetMessageWordWrap(AmessageWordWrap: Boolean);
begin
FmessageWordWrap:=AmessageWordWrap;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetOkButtonPosition(AOkButtonPosition: TPosition);
begin
FOkButtonPosition.Top:=AOkButtonPosition.Top;
FOkButtonPosition.Left:=AOkButtonPosition.Left;
end;
//------------------------------------------------------------------------------
function THbtDialog.Show;
var
IconID: PChar;
begin
DialogsFrm:=Tform.Create(Self);
DialogsFrm.Height:=FDialogsSize.Height;
DialogsFrm.Width:=FDialogsSize.Width;
DialogsFrm.FormStyle:=fsStayOnTop;
DialogsFrm.Position:=PoMainFormCenter;
DialogsFrm.Caption:=FdialogCaption;
DialogsFrm.BorderIcons:=[biSystemMenu];
DialogsFrm.BorderStyle:=BsSingle;
DialogsFrm.OnCanResize:=OncanResize;
DialogsFrm.KeyPreview:=True;
DialogsFrm.BiDiMode:=FDialogsBiDiMode;
DialogsFrm.VertScrollBar.Visible:=False;
DialogsFrm.HorzScrollBar.Visible:=False;
DialogsFrm.Color:=FDialogsColor;
DialogsFrm.Font:=FDialogFont;
//------------------------------------------------------------------------
OkButton:=TButton.Create(Self);
OkButton.Parent:=DialogsFrm;
OkButton.Anchors:=[akBottom];
OkButton.Caption:=FOkbuttonCaption;
OkButton.Height:=FbuttonsSize.Height;
OkButton.Width:=FbuttonsSize.Width;
OkButton.Top:=FOkbuttonPosition.Top;
OkButton.Left:=FOkbuttonPosition.Left;
OkButton.OnClick:=OkButtonClick;
OkButton.Font:=FMessageButtonsFont;
//------------------------------------------------------------------------
CancelButton:=TButton.Create(Self);
CancelButton.Parent:=DialogsFrm;
CancelButton.Caption:=FCancelbuttonCaption;
CancelButton.Anchors:=[akBottom];
CancelButton.Height:=FbuttonsSize.Height;
CancelButton.Width:=FbuttonsSize.Width;
CancelButton.Top:=FCancelbuttonPosition.Top;
CancelButton.Left:=FCancelbuttonPosition.Left;
CancelButton.OnClick:=CancelButtonClick;
CancelButton.Font:=FMessageButtonsFont;
//------------------------------------------------------------------------
MessageLabels:=ThbtFlashingLabel.Create(Self);
MessageLabels.Parent:=DialogsFrm;
Messagelabels.AutoSize:=False;
Messagelabels.FlashRate:=FFLashRate;
MessageLabels.Alignment:=FMessageAlignment;
MessageLabels.Transparent:=FMessageTransparent;
Messagelabels.FlashEnable:=FFlashEnable;
MessageLabels.FLashLimit:=FFlashLimit;
MessageLabels.OnLimitReached:=OnLimitReached;
Messagelabels.Width:=FmessageSize.Width;
Messagelabels.Height:=FMessageSize.Height;
MessageLabels.Left:=FMessagePosition.Left;
MessageLabels.Top:=FmessagePosition.Top;
MessageLabels.Caption:=Amsg;
MessageLabels.Color:=FMessageColor;
MessageLabels.WordWrap:=FMessageWordWrap;
MessageLabels.AutoSize:=FMessageAutoSize;
MessageLabels.Left:=FMessagePosition.Left;
MessageLabels.Top:=FMessagePosition.Top;
MessageLabels.Font:=FMessageFont;
//------------------------------------------------------------------------
IconID := IconIDs[MessageType];
if IconID nil then
with TImage.Create(DialogsFrm) do
begin
Name := 'Image';
Stretch:=True;
Parent :=DialogsFrm ;
Picture.Icon.Handle := LoadIcon(0, IconID);
DialogsFrm.Icon.Handle:=LoadIcon(0, IconID);
SetBounds(FiconPosition.Left,FiconPosition.Top, 32,32);
end;
Dialogsfrm.ShowModal;
DialogsFrm.OnClose:=DialogsClose;
//------------------------------------------------------------------------
Result:=FResult;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.OnCanResize(Sender: TObject; var NewWidth,
NewHeight: Integer; var Resize: Boolean);
begin
Resize:=False;
Inherited;
end;
//------------------------------------------------------------------------------
procedure THbtDialog.SetIconPosition(Value: Tposition);
begin
FiconPosition.Top:=Value.Top;
FIconPosition.Left:=Value.Left
end;
//------------------------------------------------------------------------------
procedure Register;
begin
RegisterComponents('Hbt Component',[THbtMessageDialogs]);
RegisterComponents('Hbt Component', [THbtDialog]);
end;
//------------------------------------------------------------------------------
end.
You need To This Unit Too----------------------------------------------------
unit SizeAndPosition;
interface
Uses
SysUtils, Classes;
Type
TSize = Class(TPersistent)
Private
FHeight:Integer;
FWidth:Integer;
Protected
Function GetHeight:Integer;
Procedure SetHeight(Value:Integer);
Function GetWidth:Integer;
Procedure SetWidth(Value:Integer);
Public
Constructor Create;
Destructor Destroy;Override;
Published
Property Height:Integer
Read GetHeight Write SetHeight Default 21;
Property Width:Integer
Read GetWidth Write SetWidth Default 90;
end;
//------------------------------------------------------------------------------
TPosition = Class(TPersistent)
Private
FTop:Integer;
FLeft:Integer;
Protected
Function GetTop:Integer;
Procedure Settop(Value:Integer);
Function Getleft:Integer;
Procedure Setleft(Value:Integer);
Public
Constructor Create;
Destructor Destroy;Override;
Published
Property Top:Integer
Read GetTop Write SetTop Default 21;
Property Left:Integer
Read GetLeft Write SetLeft Default 90;
end;
//------------------------------------------------------------------------------
implementation
constructor TSize.Create;
begin
Inherited;
end;
//------------------------------------------------------------------------------
destructor TSize.Destroy;
begin
inherited;
end;
//------------------------------------------------------------------------------
function TSize.GetHeight: Integer;
begin
Result:=FHeight;
end;
//------------------------------------------------------------------------------
function TSize.GetWidth: Integer;
begin
Result:=FWidth;
end;
//------------------------------------------------------------------------------
procedure TSize.SetHeight(Value: Integer);
begin
FHeight:=Value;
end;
//------------------------------------------------------------------------------
procedure TSize.SetWidth(Value: Integer);
begin
FWidth:=Value;
end;
//------------------------------------------------------------------------------
{ TPosition }
constructor TPosition.Create;
begin
Inherited;
end;
//------------------------------------------------------------------------------
destructor TPosition.Destroy;
begin
inherited;
end;
//------------------------------------------------------------------------------
function TPosition.Getleft: Integer;
begin
Result:=Fleft;
end;
//------------------------------------------------------------------------------
function TPosition.GetTop: Integer;
begin
Result:=Ftop;
end;
//------------------------------------------------------------------------------
procedure TPosition.Setleft(Value: Integer);
begin
FLeft:=Value;
end;
//------------------------------------------------------------------------------
procedure TPosition.Settop(Value: Integer);
begin
FTop:=Value;
end;
//------------------------------------------------------------------------------
end.

You Need To This Unit Too-------------------------------------------------------
unit hbtFlashingLabel;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, StdCtrls,ExtCtrls;
type
TlimitReachedEvent=Procedure(Sender:Tobject;Var Stop:Boolean) of Object;
ThbtFlashingLabel = class(TLabel)
private
FAbout:String;
FFlashEnabled:Boolean;
FFlashLimit:Integer;
FFlashRate:Integer;
FOnlimitReached:TlimitReachedEvent;
FlashCount:Integer;
Timer:TTimer;
{ Private declarations }
protected
Procedure SetFlashEnabled(AflashEnabled:Boolean);
Procedure SetFlashRate(AflashRate:Integer);
Procedure DoLimitReached;Virtual;
Procedure Click;Override;
Procedure onTimer(Sender:Tobject);Virtual;
{ Protected declarations }
public
Constructor Create(Aowner:Tcomponent);Override;
Destructor Destroy;override;
{ Public declarations }
published
Property FlashEnable:Boolean
Read FFlashEnabled Write SetFlashEnabled Default True;
property FlashRate:Integer
Read FFlashRate Write SetFlashRate Default 800;
Property FLashLimit:Integer
Read FFlashLimit Write FFlashLimit Default 0;
Property OnLimitReached :TlimitReachedEvent
Read FonLimitReached Write FonlimitReached;
Property Align;
Property Alignment;
Property AutoSize;
Property BiDiMode;
Property Caption;
Property Color;
Property Constraints;
Property DragCursor;
Property DragKind;
Property DragMode;
Property Enabled;
Property FocusControl;
Property Font;
Property ParentBidiMode;
Property ParentColor;
Property ParentFont;
Property ParentShowHint;
Property PopupMenu;
Property ShowAccelChar;
Property ShowHint;
Property Transparent;
Property LayOut;
Property Visible;
Property WordWrap;
Property OnClick;
Property OnDblClick;
Property OndragDrop;
Property OnDragOver;
Property OnEndDock;
Property OnEndDrag;
Property OnMouseMove;
Property OnMouseUp;
Property OnMouseDown;
Property OnstartDock;
Property OnStartDrag;
{ Published declarations }
end;
procedure Register;
implementation
Constructor ThbtFlashingLabel.Create(AOwner:Tcomponent);
Begin
Inherited;
FAbout:='Powered By Hossein Bagherzadegan';
FFlashEnabled:=True;
FFlashRate:=800;
FFlashLimit:=0;
FlashCount:=0;
Timer:=TTimer.Create(Self);
Timer.Interval:=FFlashRate;
Timer.OnTimer:=OnTimer;
end;
Procedure THbtFlashingLabel.SetFlashEnabled(AflashEnabled:Boolean);
Begin
FFlashEnabled:=AflashEnabled;
If CsDesigning In ComponentState Then
Exit;
TImer.Enabled:=FFlashEnabled;
If Not FFlashEnabled Then
Visible:=True;
End;
Procedure ThbtFlashingLabel.SetFlashRate;
Begin
FFlashRate:=AflashRate;
Timer.Interval:=AflashRate;
end;
Procedure ThbtFlashingLabel.onTimer;
begin
if Csdesigning In ComponentState Then Begin
Timer.Enabled:=False;
Exit;
end;
Visible:=Not Visible;
if (FFlashLimit0) And Visible Then Begin
Inc(FlashCount);
If FlashCount=FFlashLimit Then Begin
FlashCount:=0;
DolimitReached;
end;
end;
end;
Procedure ThbtFlashingLabel.DoLimitReached;
Var
Stop:Boolean;
Begin
Stop:=False;
if Assigned(FonlimitReached) Then
FOnlimitReached(Self,Stop);
FlashEnable:=Not Stop;
End;
procedure THbtflashingLabel.Click;
Begin
MessageBeep(5);
Inherited;
end;
procedure Register;
begin
RegisterComponents('Hbt Component', [ThbtFlashingLabel]);
end;
destructor ThbtFlashingLabel.Destroy;
begin
Timer.Free;
inherited;
end;
end.