Canvas Zeichnung Rückgängig machen
-
Hi!
Ich bekomm einen Strich ,den ich beim Überfliegen eines Labels mit der Maus zeichne, nicht weg...void TForm4::paintThrow(TCanvas *c, int top, int left, int opt_throw) { c->Brush->Color = clBlue; c->MoveTo(100+left,50+top); c->LineTo(100+left,110+top); } //--------------------------------------------------------------------------- void TForm4::unpaintThrow(TCanvas *c, int top, int left, int opt_throw) { c->Brush->Color = clGray; c->MoveTo(100+left,50+top); c->LineTo(100+left,110+top); } //--------------------------------------------------------------------------- void __fastcall TForm4::ThrowMouseEnter(TObject *Sender) { TCanvas *canv = new TCanvas(); canv->Handle = GetDC(Ansicht->Handle); paintThrow(canv,5,2,20); ReleaseDC(Ansicht->Handle, canv->Handle); } //--------------------------------------------------------------------------- void __fastcall TForm4::ThrowMouseLeave(TObject *Sender) { TCanvas *canv = new TCanvas(); canv->Handle = GetDC(Ansicht->Handle); unpaintThrow(canv,5,2,20); ReleaseDC(Ansicht->Handle, canv->Handle); } //---------------------------------------------------------------------------thx

-
Kleine Ergänzung, egal welche Farbe ich mit c->Brush->Color = ...
setze, die Farbe ist immer schwarz...
-
Das setzten der Farbe brush wirkt ja auch nicht auf die Linienfarbe sondern ist ja die Füllfarbe, und da du nichts füllst siehst du die Farbe nicht.
Wenn du die Linienfarbe ändern willst musst du die Pen->Color Farbe ändern
-
cool, funzt, thx!

-
Such mal hier im Forum nach *rubberbanding* bzw. *pmXOR*, um das ggf. etwas eleganter zu lösen.