Farbverfäschungen - Warum?
-
bool Line(HDC &hdc, int x1, int y1, int x2, int y2, COLORREF rcColor, int size) { HPEN hPen; hPen = CreatePen(PS_SOLID, size, rcColor); HGDIOBJ old = SelectObject(hdc, hPen); MoveToEx(hdc, x1, y1, NULL); LineTo(hdc, x2, y2); DeleteObject(hPen); SelectObject(hdc, old); return true; } bool VVect(HDC &hdc, int x1, int y1, int y2, COLORREF rcColor, int size) { HPEN hPen; hPen = CreatePen(PS_SOLID, size, rcColor); HGDIOBJ old = SelectObject(hdc, hPen); MoveToEx(hdc, x1, y2, NULL); LineTo(hdc, x1, y1); if(y1 < y2){ MoveToEx(hdc, x1, y2, NULL); LineTo(hdc, x1-5, y2-5); MoveToEx(hdc, x1, y2, NULL); LineTo(hdc, x1+5, y2-5); } else{ MoveToEx(hdc, x1, y2, NULL); LineTo(hdc, x1-5, y2+5); MoveToEx(hdc, x1, y2, NULL); LineTo(hdc, x1+5, y2+5); } DeleteObject(hPen); SelectObject(hdc, old); return true; } bool HVect(HDC &hdc, int x1, int x2, int y, COLORREF rcColor, int size) { HPEN hPen; hPen = CreatePen(PS_SOLID, size, rcColor); HGDIOBJ old = SelectObject(hdc, hPen); MoveToEx(hdc, x1, y, NULL); LineTo(hdc, x2, y); if(x1 < x2){ MoveToEx(hdc, x2-5, y+5, NULL); LineTo(hdc, x2, y); MoveToEx(hdc, x2-5, y-5, NULL); LineTo(hdc, x2, y); } else{ MoveToEx(hdc, x2+5, y-5, NULL); LineTo(hdc, x2, y); MoveToEx(hdc, x2+5, y+5, NULL); LineTo(hdc, x2, y); } DeleteObject(hPen); SelectObject(hdc, old); return true; }
Das ist erstmal die Korrigierte version
So dann des mit dem Timer und Paint: bei der zweiten Simulation is alles in Paint aber hier is es egal, weil der timer sowieso permanent läuft und auch ALLES neu gezeichnet wird d.h. wenn sich was über den Clientbereich bewegt is es sofort wieder da!(das bild)
cu> Endy <<
*verzweifel*
-
Ach und das ich irgentwo was nicht deselektiere kann im prinzip nedd sein, weil außer in den 3 funktionen gibts kein einziges mal select in dem programm!
-
DeleteObject(hPen); SelectObject(hdc, old);
Oha! Wie soll der der Pen (hPen) gelöscht werden können, solange er in einen DC (hdc) eingesetzt ist? Falsche Reihenfolge!
[ Dieser Beitrag wurde am 09.01.2003 um 14:36 Uhr von -King- editiert. ]
-
*g* jetz gehts
Ich bin ja dermaßen eingerostet das gibts nedd
Naja... Ich mach jetz halt erstma Abi
und dann wird wieder programmiert bis es raucht
-
Und dann auch bitte die Fehler im Tutorial beheben.