Einzelnen Beitrag anzeigen

sebhen

Registriert seit: 21. Sep 2006
1 Beiträge
 
Delphi 7 Professional
 
#1

Delphi 7: ActionBand Glyph Schatten

  Alt 21. Sep 2006, 19:14
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;
Angehängte Dateien
Dateityp: zip actionbandtest_453.zip (303,0 KB, 20x aufgerufen)
  Mit Zitat antworten Zitat