<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Paint funktion]]></title><description><![CDATA[<p>Hallo zusammen!</p>
<p>Ich sitze gerade noch an einem C-Projekt als Windowsprogramm, in dem sich Punkte über den Bildschirm bewegen sollen. Ich soll hier die Timer- mit der Paint- Funtion kombinieren.</p>
<p>Um eine Beliebige Anzahl von Punkten mit den gleichen Bewegungsformeln darzustellen will ich je Timersignal eine for-schleife ablaufen lassen.</p>
<p>Jetzt mein Problem:<br />
Am ende der for-schleife steht mein unterprogramm, das die werte in eine grafik umwandelt. allerdings bleibt im endeffekt nur das bild des letzten durchlaufs der for- schleife stehen. Wie kann ich denn verhindern, dass er bei jedem durchlauf des zeichen unterprogrammes den bildschirm erst löscht?</p>
<p>Hier noch der Quelltext:</p>
<p>case WM_TIMER:<br />
switch (wParam)<br />
{<br />
case IDT_TIMER1:</p>
<p>t=t+0.1;<br />
xa = (xbeschl<em>t);<br />
ya = (ybeschl</em>t);</p>
<p>for (i=1; i&lt;=anzahl; i++)<br />
{<br />
xres = x[i]+xa;<br />
start_xl_a[i] = start_xl_a[i]+xres;<br />
start_xl[i] = round(start_xl_a[i]);</p>
<p>yres = y[i]+ya;<br />
start_yo_a[i] = start_yo_a[i]+yres;<br />
start_yo[i] = round(start_yo_a[i]);</p>
<p>zeichnen (hwnd, &amp;start_xl[i] , &amp;start_yo[i]);<br />
}</p>
<p>Zeichenprogramm:</p>
<p>BOOL zeichnen (HWND hwnd, int *start_xl, int *start_yo)//, int xr, int yo )<br />
{<br />
int ScreenColor;<br />
int xl,yo;</p>
<p>HDC hdc ;<br />
PAINTSTRUCT ps ;<br />
RECT Rect ;</p>
<p>InvalidateRect (hwnd, NULL, TRUE) ;<br />
hdc = BeginPaint (hwnd, &amp;ps) ;<br />
SetBkMode(hdc, TRANSPARENT);</p>
<p>ScreenColor = RGB(0, 0, 255);<br />
SelectBrush(hdc, CreateSolidBrush(ScreenColor));</p>
<p>xl=*start_xl;<br />
yo=*start_yo;</p>
<p>Ellipse(hdc, (xl), (yo), (xl+8), (yo+8));</p>
<p>EndPaint (hwnd, &amp;ps) ;<br />
UpdateWindow(hwnd);<br />
return 1;<br />
}</p>
<p>vielen dank im voraus,<br />
christian</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/150892/paint-funktion</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Jul 2026 00:05:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/150892.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 21 Jun 2006 09:38:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Paint funktion on Wed, 21 Jun 2006 09:38:00 GMT]]></title><description><![CDATA[<p>Hallo zusammen!</p>
<p>Ich sitze gerade noch an einem C-Projekt als Windowsprogramm, in dem sich Punkte über den Bildschirm bewegen sollen. Ich soll hier die Timer- mit der Paint- Funtion kombinieren.</p>
<p>Um eine Beliebige Anzahl von Punkten mit den gleichen Bewegungsformeln darzustellen will ich je Timersignal eine for-schleife ablaufen lassen.</p>
<p>Jetzt mein Problem:<br />
Am ende der for-schleife steht mein unterprogramm, das die werte in eine grafik umwandelt. allerdings bleibt im endeffekt nur das bild des letzten durchlaufs der for- schleife stehen. Wie kann ich denn verhindern, dass er bei jedem durchlauf des zeichen unterprogrammes den bildschirm erst löscht?</p>
<p>Hier noch der Quelltext:</p>
<p>case WM_TIMER:<br />
switch (wParam)<br />
{<br />
case IDT_TIMER1:</p>
<p>t=t+0.1;<br />
xa = (xbeschl<em>t);<br />
ya = (ybeschl</em>t);</p>
<p>for (i=1; i&lt;=anzahl; i++)<br />
{<br />
xres = x[i]+xa;<br />
start_xl_a[i] = start_xl_a[i]+xres;<br />
start_xl[i] = round(start_xl_a[i]);</p>
<p>yres = y[i]+ya;<br />
start_yo_a[i] = start_yo_a[i]+yres;<br />
start_yo[i] = round(start_yo_a[i]);</p>
<p>zeichnen (hwnd, &amp;start_xl[i] , &amp;start_yo[i]);<br />
}</p>
<p>Zeichenprogramm:</p>
<p>BOOL zeichnen (HWND hwnd, int *start_xl, int *start_yo)//, int xr, int yo )<br />
{<br />
int ScreenColor;<br />
int xl,yo;</p>
<p>HDC hdc ;<br />
PAINTSTRUCT ps ;<br />
RECT Rect ;</p>
<p>InvalidateRect (hwnd, NULL, TRUE) ;<br />
hdc = BeginPaint (hwnd, &amp;ps) ;<br />
SetBkMode(hdc, TRANSPARENT);</p>
<p>ScreenColor = RGB(0, 0, 255);<br />
SelectBrush(hdc, CreateSolidBrush(ScreenColor));</p>
<p>xl=*start_xl;<br />
yo=*start_yo;</p>
<p>Ellipse(hdc, (xl), (yo), (xl+8), (yo+8));</p>
<p>EndPaint (hwnd, &amp;ps) ;<br />
UpdateWindow(hwnd);<br />
return 1;<br />
}</p>
<p>vielen dank im voraus,<br />
christian</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1081913</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1081913</guid><dc:creator><![CDATA[das_chris]]></dc:creator><pubDate>Wed, 21 Jun 2006 09:38:00 GMT</pubDate></item><item><title><![CDATA[Reply to Paint funktion on Wed, 21 Jun 2006 09:47:55 GMT]]></title><description><![CDATA[<p>Jedesmal, wenn dein Prog die Funktion &quot;zeichnen&quot; aufruft, führt sie erstmal &quot;InvalidateRect()&quot; aus. Damit wird der Bildschirm für ungültig erklärt und gelöscht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1081922</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1081922</guid><dc:creator><![CDATA[Elektronix]]></dc:creator><pubDate>Wed, 21 Jun 2006 09:47:55 GMT</pubDate></item><item><title><![CDATA[Reply to Paint funktion on Wed, 21 Jun 2006 10:06:46 GMT]]></title><description><![CDATA[<p>vielen vielen Dank, ich hab die zeile jetzt einfach vor meine for- schleife gezogen und sie in dem zeichenprogramm auf TRUE gesetzt jetzt tut's wunderschön!</p>
<p>Danke, nochmal!</p>
<p>Christian</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1081941</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1081941</guid><dc:creator><![CDATA[das_chris]]></dc:creator><pubDate>Wed, 21 Jun 2006 10:06:46 GMT</pubDate></item><item><title><![CDATA[Reply to Paint funktion on Thu, 22 Jun 2006 08:20:05 GMT]]></title><description><![CDATA[<p>Aus der MSDN:</p>
<blockquote>
<p>An application <strong>should not</strong> call BeginPaint except in response to a WM_PAINT message.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1082717</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1082717</guid><dc:creator><![CDATA[WebFritzi]]></dc:creator><pubDate>Thu, 22 Jun 2006 08:20:05 GMT</pubDate></item></channel></rss>