![]() |
Button-Glyph aus 2 ImageLists
Wenn man 2 ImageLists verwendet wovon eine die aktiven und die andere die inaktiven Images beinhaltet, kann man diese auch verwenden um Glyphs für BitBtn bzw. Speedbuttons zu erzeugen.
Delphi-Quellcode:
Anwendung:
function GlyphFromImageLists(Source1, Source2: TImageList; Index: integer;
BkColor: TColor): TBitmap; overload; var bmp1, bmp2: TBitmap; R1, R2: TRect; bColor1, bColor2: TColor; begin bColor1 := Source1.BkColor; bColor2 := Source2.BkColor; Source1.BkColor := BkColor; Source2.BkColor := BkColor; bmp1 := TBitmap.Create; bmp2 := TBitmap.Create; Result := TBitmap.Create; try Source1.GetBitmap(Index, bmp1); Source2.GetBitmap(Index, bmp2); R1.Left := 0; R1.Top := 0; R1.Right := bmp1.Width; R1.Bottom := bmp1.Height; R2.Left := bmp1.Width; R2.Top := 0; R2.Right := bmp1.Width * 2; R2.Bottom := bmp1.Height; Result.Width := bmp1.Width * 2; Result.Height := bmp1.Height; Result.Canvas.CopyRect(R1, bmp1.Canvas, R1); Result.Canvas.CopyRect(R2, bmp2.Canvas, R1); finally bmp1.Free; bmp2.Free; Source1.BkColor := bColor1; Source2.BkColor := bColor2; end; end; function GlyphFromImageLists(Source1, Source2: TImageList; Index: integer): TBitmap; overload; begin Result := GlyphFromImageLists(Source1, Source2, Index, clBtnFace); end;
Delphi-Quellcode:
BitBtn1.Glyph.Assign(GlyphFromImageLists(ImageList1, ImageList2, 21));
BitBtn1.NumGlyphs := 2; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:32 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