Label "Benutzerdefinierte Farben" im Colordialog ä
dank dem Programmiertip Swissdelphicenter / ...die Standard Windows Dialoge verändern? habe ich gelernt, wie man die Beschriftung innerhalb des Öffnen/Speichern/Drucken-Dialog ändert. Geht das auch irgendwie beim Colordialog ?
mfG Georg |
Re: Beschriftung im Colordialog ändern?
Irgendwie geht der Link nicht :-?
Aber du könntest per FindWindow und SetWindowText einiges erreichen, wenns dir so reicht. :-) |
Re: Beschriftung im Colordialog ändern?
Hi Ultimator :???: .. bei mir geht der Link.. :?: komisch
so etwa siehts aus beim OpenDialog:
Code:
damit konnte ich zumindest mal den Titel des Dialogs ändern .. aber alles andere bekomme ich nicht geändert :(
procedure TForm1.OpenDialog1Show(Sender: TObject);
{First, we need to determine identifiers of dialog's controls, they are following:} const LB_FILETYPES_ID = 1089; // "File types:" label LB_FILENAME_ID = 1090; // "File name:" label LB_DRIVES_ID = 1091; // "Look in:" label var hOpenDialog: HWND; Str1,Str2,Str3,Str4,Str5:string; begin Str1:=GetText('MainMenu','Main_Oeffnen','&Öffnen'); Str2:=GetText('Subforms','Sub_Abbruch','&Abbruch'); Str3:=GetText('Subforms','Sub_Dateityp','Dateityp')+':'; Str4:=GetText('MainMenu','Main_Datei','&Datei')+':'; Str5:=GetText('Subforms','Sub_Suchen_in','Suchen in')+':'; hOpenDialog := GetParent(OpenDialog1.Handle); SendMessage(hOpenDialog, CDM_SETCONTROLTEXT, idOk, Longint(PChar(Str1))); SendMessage(hOpenDialog, CDM_SETCONTROLTEXT, idCancel, Longint(PChar(Str2))); SendMessage(hOpenDialog, CDM_SETCONTROLTEXT, LB_FILETYPES_ID, Longint(PChar(Str3))); SendMessage(hOpenDialog, CDM_SETCONTROLTEXT, LB_FILENAME_ID, Longint(PChar(Str4))); SendMessage(hOpenDialog, CDM_SETCONTROLTEXT, LB_DRIVES_ID, Longint(PChar(Str5))); end;
Code:
SetWindowText(ColorDialog1.Handle,PChar('Hallo Das ist ein neuer Text'));
|
Re: Beschriftung im Colordialog ändern?
Zitat:
Geht doch:
Delphi-Quellcode:
...
procedure TForm1.ColorDialog1Show(Sender: TObject); begin SetWindowText(GetDlgItem(ColorDialog1.Handle, idOk), '&Fertig'); SetWindowText(GetDlgItem(ColorDialog1.Handle, idCancel), '&Wegmache'); SetWindowText(ColorDialog1.Handle, 'Bunt'); end; procedure TForm1.BitBtn1Click(Sender: TObject); begin ColorDialog1.Execute end; ... |
Re: Beschriftung im Colordialog ändern?
@MaBuSE :idea: danke schonmal für die Anregung.. jetzt fehlen nur noch der Text für Benutzerdefinierte Farben.. die anderen habe ich jetzt :P
|
Re: Beschriftung im Colordialog ändern?
Zitat:
(das Label "Benutzerdefinierte Farben:" habe ich nicht herausgefunden)
Delphi-Quellcode:
procedure TForm1.ColorDialog1Show(Sender: TObject);
var i: word; begin SetWindowText(ColorDialog1.Handle, 'Mein Farbendialog'); SetWindowText(GetDlgItem(ColorDialog1.Handle, 1), '&Ok'); SetWindowText(GetDlgItem(ColorDialog1.Handle, 2), '&Cancel'); SetWindowText(GetDlgItem(ColorDialog1.Handle, 719), 'Farben wählen'); SetWindowText(GetDlgItem(ColorDialog1.Handle, 712), 'Farben hinzufügen'); SetWindowText(GetDlgItem(ColorDialog1.Handle, 723), 'Farbt.'); SetWindowText(GetDlgItem(ColorDialog1.Handle, 724), 'Sätt.'); SetWindowText(GetDlgItem(ColorDialog1.Handle, 725), 'Hell.'); SetWindowText(GetDlgItem(ColorDialog1.Handle, 726), 'Rot'); SetWindowText(GetDlgItem(ColorDialog1.Handle, 727), 'Grün'); SetWindowText(GetDlgItem(ColorDialog1.Handle, 728), 'Blau'); SetWindowText(GetDlgItem(ColorDialog1.Handle, 730), 'Farbe'); SetWindowText(GetDlgItem(ColorDialog1.Handle, 731), '|Basis'); SetWindowText(GetDlgItem(ColorDialog1.Handle, 65535), 'Grundfarben'); // hiermit kann man leicht die Nummern herausfinden ;-) // for i := 0 to high(i) do SetWindowText(GetDlgItem(ColorDialog1.Handle, i), PChar(intToStr(i))); end; procedure TForm1.BitBtn1Click(Sender: TObject); begin ColorDialog1.Execute end; |
Re: Beschriftung im Colordialog ändern?
@MaBuSE - genauso hatte ich es auch gemacht :???: und festgestellt, dass das einzige was fehlt das Label "Benutzerdefinierte Farben:" ist :?
Wie kann man denn das noch rausfinden? :roll: Die Control ID 65535 ist wohl OK - nur das ColorDialog1.Handle stimmt offenbar nicht. Hilft das vielleicht jemandem hier weiter? http://www.ego-creations.de/pics/winspy.gif |
Re: Beschriftung im Colordialog ändern?
Zitat:
Aber es gibt ja noch andere Alternativen: Zitat:
Die Komponente funktionierte aber auch ohne Probleme in Delphi 7. Da der Sourcecode dabei ist, kann der Dialog individuell angepasst werden. Viel Spaß |
Re: Label "Benutzerdefinierte Farben" im Colordial
@MaBuSE - Thx für den Tip - habe übrigens bei diesem Projekt Delphi 4 mit Tonnenweise Freeware Komponenten verwendet :roll: aber egal kann ich ja notfalls umstricken. Aber ich bekomme die Komponente nicht installiert. Einmal kennt Delphi 4 scheinbar die Direktive {$ALIGN 8} nicht. Wenn ich die weglösche, dann meckert er über rtl.dpk nicht gefunden - gehört da noch was zu?
Viele Grüße Georg |
Re: Label "Benutzerdefinierte Farben" im Colordial
Zitat:
Diese Komponente ist mit Delphi 6 geschrieben, es kann sein, dass dort Dinge verwendet wurden, die nicht in Delphi 4 funktionieren. Delphi 7 hat in den *.dpk Dateien meist {$ALIGN 8} stehen, bei Delphi 5 ist es: {$ALIGN ON} Ab Delphi 6 steht in den requires nur noch rtl, vcl, ... Bei Delphi 5 war das noch rtl50, vcl50, ... Versuch also mal das rtl in rtl40 zu ändern. (vcl = vcl40, vclsmp = vclsmp40) Dann könnte es klappen. |
Re: Label "Benutzerdefinierte Farben" im Colordial
.. vielen dank nochmal..
Das mit {$ALIGN ON} und vcl40 haut hin... jetzt meckert er über rtl40 - eine solche Datei habe ich gar nicht auf meinem Rechner.. ist wohl doch nicht so easy die Komponente umzuschreiben :( Update: Ich habe soeben eine Lösung für das Problem im API-Forum bekommen :bounce2: Für diejenigen, die es später mal interessiert:
Code:
vielen Dank nochmal :cheers:
procedure TForm1.ColorDialog1Show(Sender: TObject);
const COLOR_ADD = 712; COLOR_MIX = 719; COLOR_HUEACCEL = 723; COLOR_SATACCEL = 724; COLOR_LUMACCEL = 725; COLOR_REDACCEL = 726; COLOR_GREENACCEL = 727; COLOR_BLUEACCEL = 728; COLOR_SOLID_LEFT = 730; COLOR_SOLID_RIGHT = 731; COLOR_BASIC_COLORS = 65535; var ChildHWnd: HWND; begin // Fensterhandle für "Grundfarben" ermitteln // ist das erste Control auf dem Dialog ChildHWnd := GetWindow((Sender as TColorDialog).Handle, GW_CHILD); // Handle gefunden? if IsWindow(ChildHWnd) then begin // Fensterhandle für "Benutzerdefinierte Farben" finden // ist das dritte Control ChildHWnd := GetWindow(ChildHWnd, GW_HWNDNEXT); // Zweites Control gefunden? if IsWindow(ChildHWnd) then begin // weiter machen... um drittes Control zu ermitteln ChildHWnd := GetWindow(ChildHWnd, GW_HWNDNEXT); // Handle gefunden? if IsWindow(ChildHWnd) then // Text für "Benutzerdefinierte Farben" ändern SendMessage(ChildHWnd, WM_SETTEXT, 0, Longint(PChar('Custom Colors:'))); end; {end if} end; {end if} SetWindowText(ColorDialog1.Handle,PChar('Colors')); SetWindowText(GetDlgItem(ColorDialog1.Handle, idOk), PChar('OK')); SetWindowText(GetDlgItem(ColorDialog1.Handle, idCancel), PChar('Cancel')); SetWindowText(GetDlgItem(ColorDialog1.Handle, COLOR_BASIC_COLORS), PChar('Basic Colors:')); SetWindowText(GetDlgItem(ColorDialog1.Handle, COLOR_MIX), PChar('Define Custom Colors >>')); SetWindowText(GetDlgItem(ColorDialog1.Handle, COLOR_ADD), PChar('Add to Custom Colors')); SetWindowText(GetDlgItem(ColorDialog1.Handle, COLOR_HUEACCEL), PChar('Hue:')); SetWindowText(GetDlgItem(ColorDialog1.Handle, COLOR_SATACCEL), PChar('Sat:')); SetWindowText(GetDlgItem(ColorDialog1.Handle, COLOR_LUMACCEL), PChar('Lum:')); SetWindowText(GetDlgItem(ColorDialog1.Handle, COLOR_REDACCEL), PChar('Red:')); SetWindowText(GetDlgItem(ColorDialog1.Handle, COLOR_GREENACCEL), PChar('Green:')); SetWindowText(GetDlgItem(ColorDialog1.Handle, COLOR_BLUEACCEL), PChar('Blue:')); SetWindowText(GetDlgItem(ColorDialog1.Handle, COLOR_SOLID_LEFT), PChar('Color|')); SetWindowText(GetDlgItem(ColorDialog1.Handle, COLOR_SOLID_RIGHT), PChar('Solid')); end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:23 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz