//------------------------------------------------------- // //------------------------------------------------------- unit ColorDialog; //------------------------------------------------------- // //------------------------------------------------------- interface uses //---------------------------------------------------------------------------- //local //----------------------------------------------------------------------------
GenDefs,OwnUtils,OptionClass,utilities,language, //---------------------------------------------------------------------------- //global //----------------------------------------------------------------------------
Forms,StdCtrls,Graphics,Dialogs,Controls,Classes; //------------------------------------------------------- // //------------------------------------------------------- type
TColorForm= class(TForm)
Label1:TLabel;
Label2:TLabel;
Label3:TLabel;
Label4:TLabel;
Label5:TLabel;
Label6:TLabel;
Label7:TLabel;
Label8:TLabel;
Label9:TLabel;
Label10:TLabel;
Button1:TButton;
Button2:TButton;
Button3:TButton; procedure BitBtn1Click(Sender:TObject); procedure BitBtnAllClick(Sender:TObject); procedure FormShow(Sender:TObject); procedure Button1Click(Sender:TObject); procedure Button3Click(Sender:TObject); procedure Button2Click(Sender:TObject); procedure ShowHighlites(); procedure FormCreate(Sender: TObject); private
{ Private-Deklarationen } public
{ Public-Deklarationen }
BackColor:TColor;
Colordialog1:TColordialog;
Changed:boolean; end; //------------------------------------------------------- // //------------------------------------------------------- implementation
{$R *.dfm} uses //------------------------------------------------------- //specific //-------------------------------------------------------
Windows,Messages,SysUtils,Variants,Buttons,ComCtrls,ExtCtrls; //------------------------------------------------------- // //------------------------------------------------------- procedure TColorForm.BitBtn1Click(Sender:TObject); begin
Colordialog1.Color:=opt.R.BackgroundColor; if Colordialog1.Execute thenbegin
Opt.r.BackgroundColor:=bgrtocolor(Colordialog1.Color);
Label1.Color:=ColorDialog1.Color;
ShowHighlites(); end; end; //------------------------------------------------------- // //------------------------------------------------------- procedure TColorForm.BitBtnAllClick(Sender:TObject); var Lab:TLabel; begin
Lab:=(Sender as TLabel);
Colordialog1.Color:=Lab.Color; if Colordialog1.Execute thenbegin if Lab=Label2 then Opt.r.HighLites[H_Keyword]:=bgrtocolor(Colordialog1.Color); if Lab=Label3 then Opt.r.HighLites[H_String]:=bgrtocolor(Colordialog1.Color); if Lab=Label4 then Opt.r.HighLites[H_Numeric]:=bgrtocolor(Colordialog1.Color); if Lab=Label5 then Opt.r.HighLites[H_Identifier]:=bgrtocolor(Colordialog1.Color); if Lab=Label6 then Opt.r.HighLites[H_Foreignkeyword]:=bgrtocolor(Colordialog1.Color); if Lab=Label7 then Opt.r.HighLites[H_Comment]:=bgrtocolor(Colordialog1.Color); if Lab=Label8 then Opt.r.HighLites[H_Foreignidentifier]:=bgrtocolor(Colordialog1.Color); if Lab=Label9 then Opt.r.HighLites[H_Label]:=bgrtocolor(Colordialog1.Color); if Lab=Label10 then Opt.r.HighLites[H_Lexelem]:=bgrtocolor(Colordialog1.Color);
Lab.Color:=Colordialog1.Color;
ShowHighlites(); end; end; //------------------------------------------------------- // //------------------------------------------------------- procedure TColorForm.Button1Click(Sender:TObject); begin
Close;
modalresult:=mrOk; end; //------------------------------------------------------- // //------------------------------------------------------- procedure TColorForm.Button2Click(Sender:TObject); begin //restore end; //------------------------------------------------------- // //------------------------------------------------------- procedure TColorForm.Button3Click(Sender:TObject); begin
Opt.r.BackgroundColor:=clWhite;
Opt.r.HighLites[H_Keyword]:=clblue;
Opt.r.HighLites[H_String]:=clred;
Opt.r.HighLites[H_Numeric]:=clMaroon;
Opt.r.HighLites[H_identifier]:=clblack;
Opt.r.HighLites[H_Foreignkeyword]:=clNavy;
Opt.r.HighLites[H_Comment]:=clgreen;
Opt.r.HighLites[H_Foreignidentifier]:=clgray;
Opt.r.HighLites[H_Label]:=clPurple;
Opt.r.HighLites[H_Lexelem]:=clFuchsia;
ShowHighlites(); end; //------------------------------------------------------- // //------------------------------------------------------- procedure TColorForm.ShowHighlites(); //swap red und blue because of windows procedure setcol(var Lab:TLabel;Col:TColor); var
bgr:TColor; begin
bgr:=colortobgr(Col);
Lab.font.color:=bgr end; begin //Label1 is Background only
setcol(Label2,Opt.r.HighLites[H_Keyword]);
setcol(Label3,Opt.r.HighLites[H_String]);
setcol(Label4,Opt.r.HighLites[H_Numeric]);
setcol(Label5,Opt.r.HighLites[H_Identifier]);
setcol(Label6,Opt.r.HighLites[H_Foreignkeyword]);
setcol(Label7,Opt.r.HighLites[H_Comment]);
setcol(Label8,Opt.r.HighLites[H_Foreignidentifier]);
setcol(Label9,Opt.r.HighLites[H_Label]);
setcol(Label10,Opt.r.HighLites[H_Lexelem]); //
Label1.color:=opt.R.BackgroundColor;
Label2.color:=opt.R.BackgroundColor;
Label3.color:=opt.R.BackgroundColor;
Label4.color:=opt.R.BackgroundColor;
Label5.color:=opt.R.BackgroundColor;
Label6.color:=opt.R.BackgroundColor;
Label7.color:=opt.R.BackgroundColor;
Label8.color:=opt.R.BackgroundColor;
Label9.color:=opt.R.BackgroundColor;
Label10.color:=opt.R.BackgroundColor; // with Label1 do
Hint:=Caption; with Label2 do
Hint:=Caption; with Label3 do
Hint:=Caption; with Label4 do
Hint:=Caption; with Label5 do
Hint:=Caption; with Label6 do
Hint:=Caption; with Label7 do
Hint:=Caption; with Label8 do
Hint:=Caption; with Label9 do
Hint:=Caption; with Label10 do
Hint:=Caption; end; //------------------------------------------------------- // //------------------------------------------------------- procedure TColorForm.FormCreate(Sender: TObject); begin
Colordialog1:=TColorDialog.Create(self); end; //------------------------------------------------------- // //------------------------------------------------------- procedure TColorForm.FormShow(Sender:TObject); begin
ShowHighlites(); end; end. //------------------------------------------------------- //Ende dieser Quelle //-------------------------------------------------------
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.