Einzelnen Beitrag anzeigen

neolithos

Registriert seit: 31. Jul 2003
Ort: Dresden
1.386 Beiträge
 
Delphi 7 Architect
 
#1

CreateIcon mit DrawState! Was ist falsch?

  Alt 30. Sep 2003, 11:13
Ich will ein Symbol zeichnen.
Ist der das Control Disabled dann soll das Symbol grau werden.

So sieht mein Code aus...

Delphi-Quellcode:
  procedure DrawImg(ax, ay : Integer);
  const
    cdwDisabled : array [Boolean] of Cardinal = (DSS_DISABLED, DSS_NORMAL);
  var hIco : HICON;
      bAnd,
      bXOr : Windows.TBitmap;
  begin
    if not bmpGlyph.Empty then
       begin
         bmpGlyph.Transparent := true;

         GetObject(bmpGlyph.Handle, SizeOf(bAnd), @bAnd);
         GetObject(bmpGlyph.MaskHandle, SizeOf(bXOr), @bXOr);

         hIco := CreateIcon(HInstance, bAnd.bmWidth, bAnd.bmHeight,
           bAnd.bmPlanes, bAnd.bmBitsPixel, bAnd.bmBits,
           bXOr.bmBits);
         try
           DrawState(afCanvas.Handle, 0, nil,
             hIco, 0,
             ax, ay, 0, 0,
             DST_ICON or cdwDisabled[Enabled]);
         finally
           DestroyIcon(hIco);
         end;
       end;
  end;
Leider erstellt er das Icon nicht korrekt.
Warum?
- ciao neo -
Es gibt niemals dumme Fragen, sondern nur dumme Antworten!
  Mit Zitat antworten Zitat