![]() |
TTouchKeyboard Button Farbe ändern
Hallo,
wie kann ich in 10.2 Tokyo die Farbe der Buttons (und des Textes der Buttons) eines TTouchKeyboards ändern? In der Hilfe habe ich bisher die Klassen TCustomKeyboardButton und TKeyboardButton gefunden, die haben aber keine Properties für Farbe oder Schrift. Irgendwo hab' ich auch etwas von subclassing der TKeyboardButton Klasse oder so gelesen um dann die Draw Methode überschreiben zu können. Aber wie geht das? Ich mach' normalerweise keine Komponentenentwicklung... Grüße TurboMagic |
AW: TTouchKeyboard Button Farbe ändern
Delphi-Quellcode:
unit Unit1;
interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Touch.Keyboard; type TTouchKeyboard = class(Vcl.Touch.Keyboard.TTouchKeyboard) end; TMyKeyboardButton = class(Vcl.Touch.Keyboard.TCustomKeyboardButton) public procedure Paint(Canvas: TCustomCanvas = nil); override; end; TForm1 = class(TForm) TouchKeyboard1: TTouchKeyboard; procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} { TKeyboardButton } procedure TMyKeyboardButton.Paint(Canvas: TCustomCanvas); var LCanvas: TCanvas; LRect: TRect; begin inherited Paint(Canvas); // optional, wenn man nicht alles selber machen möchte if Canvas <> nil then LCanvas := Canvas as TCanvas else LCanvas := TTouchKeyboard(Parent).Canvas; // ab hier kann wild drauflos gemalt werden. LRect := ClientRect; LCanvas.Ellipse(LRect.Left, LRect.Top, LRect.Width, LRect.Bottom); end; procedure TForm1.FormCreate(Sender: TObject); begin TouchKeyboard1.DefaultButtonClass := TMyKeyboardButton; // eigene Buttonableitung als zu erzeugene "Tastatur"-Buttons anmelden end; end. |
AW: TTouchKeyboard Button Farbe ändern
Danke! Werde ich probieren!
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:19 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz