Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Delphi 7: ActionBand Glyph Schatten (https://www.delphipraxis.net/77606-delphi-7-actionband-glyph-schatten.html)

sebhen 21. Sep 2006 19:14


Delphi 7: ActionBand Glyph Schatten
 
Liste der Anhänge anzeigen (Anzahl: 1)
Meine Konfiguration:

Delphi 7
+ Update 1
+ 19151_delphi_7.0_actionbands_patch_all_languages


Mein Problem:

Ich setze in einer Anwendung eine ActionToolBar ein. Auf der Toolbar befindet sich ein Button mit einem Image aus einer ImageList. Wird das Programm unter Windows XP SP 2 ausgeführt, wird anstatt einem Schatten des Button-Images ein Viereck angezeigt. Die Darstellung unter Windows XP SP 1 sowie Windows 2000 ist dagegend in Ordnung.

Kennt jemand das Problem und hat ein Lösung?

Danke im Vorraus

Sebastian


Edit (Lösung):

Nachdem ich in den Quellen von TurboDelphi wo der Fehler nicht aufritt nachgesehen habe hier die Lösung.

In der Datei XPActnCtrls.pas muss in der Prozedur TXPStyleButton.DrawGlyph(const Location: TPoint) folgende Änderung gemacht werden:

Delphi-Quellcode:
procedure TXPStyleButton.DrawGlyph(const Location: TPoint);
var
  OldBrushColor: TColor;
  SelBmp: TBitmap;
  NewLocation: TPoint;
  ActionList: TCustomActionList;
begin
  NewLocation := Location;
  if not ActionBar.DesignMode and MouseInControl and
     not IsChecked and Enabled and ActionClient.HasGlyph then
  begin
    OldBrushColor := Canvas.Brush.Color;
    SelBmp := TBitmap.Create;
    try
      ActionList := ActionClient.Action.ActionList;
      if ActionList.Images.GetBitmap(ActionClient.ImageIndex, SelBmp) then
      begin
        Canvas.Brush.Color := GetShadowColor(ActionBar.ColorMap.SelectedColor);
        SelBmp.Width := ActionList.Images.Width;
        SelBmp.Height := ActionList.Images.Width;
        ActionList.Images.Draw(SelBmp.Canvas, 0, 0, ActionClient.ImageIndex, dsNormal, itMask); // Eingefüge Zeile
        DrawState(Canvas.Handle, Canvas.Brush.Handle, nil, SelBmp.Handle, 0,
          NewLocation.X + 1, NewLocation.Y + 1, 0, 0, DST_BITMAP or DSS_MONO);
      end;
    finally
      SelBmp.Free;
      Canvas.Brush.Color := OldBrushColor;
    end;
    if not IsChecked then
    begin
      Dec(NewLocation.X);
      Dec(NewLocation.Y);
    end;
  end;
  if not (csDesigning in ComponentState) and ((FState = bsDown) and not IsChecked)
     and IsMouseButtonPressed then
  begin
    Inc(NewLocation.X);
    Inc(NewLocation.Y);
  end;
  inherited DrawGlyph(NewLocation);
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:08 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