Einzelnen Beitrag anzeigen

hoika

Registriert seit: 5. Jul 2006
Ort: Magdeburg
8.270 Beiträge
 
Delphi 10.4 Sydney
 
#5

AW: TCheckBox.Color über WM_CTLCOLOR

  Alt 2. Aug 2016, 08:10
Hm,
alles sehr merkwürdig.

aktueller Stand mit TMessage
Ohne das try except immer noch ein Bereichsfehler


Delphi-Quellcode:
procedure TForm101.WMCTLColor(var msg: TMessage);
var
  MyDC: HDC;
begin
  inherited ;

  //SetTextColor(Msg.ChildDC,RGB(0,$80,0));
  //Exit;

  //SetTextColor(Msg.wParam,RGB(0,$80,0));


  //if msg.ChildWnd=CheckBox2.Handle then
  if msg.lParam=CheckBox2.Handle then
  begin
    try
    //SetTextColor(Msg.ChildDC,RGB(0,$80,0));
      //SetTextColor(Msg.ChildDC,ColorToRGB(clRed));
      //msg.Result := CreateSolidBrush(RGB(0, $80, 0));
      //msg.Result := CreateSolidBrush(ColorToRGB(clRed));
      //msg.Result := CreateSolidBrush(RGB(255, 0, 0));

      MyDC := HDC(msg.wParam);

      //SetTextColor(MyDC, ColorToRGB(clRed));

      msg.Result := CreateSolidBrush(ColorToRGB(clRed));

    //msg.Result := GetStockObject(NULL_BRUSH);
    except

    end;
  end;
end;
Heiko
  Mit Zitat antworten Zitat