Einzelnen Beitrag anzeigen

Delphiturbo
(Gast)

n/a Beiträge
 
#19

Re: Button besonderes markieren

  Alt 31. Mai 2008, 23:16
Es funktioniert und die alte Markierung wird auch gelöscht
Das Problem die Farbe in Highlight2 spielt keine Rolle
die Farbe in Highlight2 ist nicht meine Form-HG-Farbe totzdem wird nicht angezeigt !
Delphi-Quellcode:
procedure TForm1.Highlight(Control: TWinControl);
var
  Btn: TControl;
begin
  Btn := TControl(FindComponent('BitBtn' + Edit1.Text));
   if Btn is TControl then
    begin
      with canvas do
      begin
        Brush.Style := bsClear;
        with Pen do
        begin
          Width := 2;
          Color := clRed;
        end;
        Rectangle(Btn.Left-2, Btn.Top-2,
          Btn.Left + Btn.Width + 2, Btn.Top + Btn.Height + 2);
      end;
    end;
end;


procedure TForm1.Highlight2(Control: TWinControl);
begin
  if PtInRect(GetRect(Control, ABorder), ScreenToClient(Mouse.CursorPos)) then
        Canvas.Brush.Color :=clblue // egal welche farbe !
      
  else
    Canvas.Brush.Color := clBtnFace;
       Canvas.FillRect(GetRect(Control, ABorder));
    
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
Highlight2(BitBtn1);
Highlight2(BitBtn2);
Highlight2(BitBtn3);
Highlight(Btn);
end;
  Mit Zitat antworten Zitat