<?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[Flackern &amp;amp; Striche]]></title><description><![CDATA[<p>Ich habe eine dialogfeldbasierende Anwendung über die einRechteck &quot;slided&quot;, allerdings gibt es Schmiereffekte: Striche und das Rechteck flackert.</p>
<p>Hat jemand einen Rat ?</p>
<pre><code>void CRechteckDlg::OnButtonRectangle() 
{
	CString cstrButtonText;
	GetDlgItem(IDC_BUTTON_RECTANGLE)-&gt;GetWindowText(cstrButtonText);
	if (cstrButtonText == &quot;Start&quot;) {
		m_iFlag = 1;
		bTimer = TRUE;	

		CWinThread* pThread = AfxBeginThread (threadFunction, this);
		GetDlgItem(IDC_BUTTON_RECTANGLE)-&gt;SetWindowText(&quot;Stop&quot;);
	}
	else{		
		m_iFlag = 0;
		bTimer = FALSE;
		GetDlgItem(IDC_BUTTON_RECTANGLE)-&gt;SetWindowText(&quot;Start&quot;);	
	}	
}

UINT CRechteckDlg::threadFunction(LPVOID pParam)
{
	CRechteckDlg* pDlg = (CRechteckDlg*) pParam;
	pDlg-&gt;threadRun();

	return 0;
}

VOID CRechteckDlg::threadRun()
{
	while (m_iFlag) {

		// Rechteck ausserhalb des definierten Bereichs ?
		if (rectdata.left &gt;= 400)
			SetRect();					

		// Device Kontext des Fensters holen
		CDC* pDC = GetDC();
		CBrush brush(RGB (255, 0, 0));

		pDC-&gt;SelectObject(&amp;brush);
		pDC-&gt;Rectangle(&amp;rectdata);
		pDC-&gt;DeleteDC();

	}
}

VOID CRechteckDlg::SetRect()
{
	rectdata.left = 10;
	rectdata.top = 10;
	rectdata.bottom = 40;
	rectdata.right = 80;
}

void CRechteckDlg::OnTimer(UINT nIDEvent) 
{
	if (bTimer) {

		RedrawWindow(&amp;rectdata, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE );
		rectdata.left++;
		rectdata.right++;		
	}

	CDialog::OnTimer(nIDEvent);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/53650/flackern-amp-striche</link><generator>RSS for Node</generator><lastBuildDate>Mon, 01 Jun 2026 09:35:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/53650.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 30 Oct 2003 22:26:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Flackern &amp;amp; Striche on Thu, 30 Oct 2003 22:26:26 GMT]]></title><description><![CDATA[<p>Ich habe eine dialogfeldbasierende Anwendung über die einRechteck &quot;slided&quot;, allerdings gibt es Schmiereffekte: Striche und das Rechteck flackert.</p>
<p>Hat jemand einen Rat ?</p>
<pre><code>void CRechteckDlg::OnButtonRectangle() 
{
	CString cstrButtonText;
	GetDlgItem(IDC_BUTTON_RECTANGLE)-&gt;GetWindowText(cstrButtonText);
	if (cstrButtonText == &quot;Start&quot;) {
		m_iFlag = 1;
		bTimer = TRUE;	

		CWinThread* pThread = AfxBeginThread (threadFunction, this);
		GetDlgItem(IDC_BUTTON_RECTANGLE)-&gt;SetWindowText(&quot;Stop&quot;);
	}
	else{		
		m_iFlag = 0;
		bTimer = FALSE;
		GetDlgItem(IDC_BUTTON_RECTANGLE)-&gt;SetWindowText(&quot;Start&quot;);	
	}	
}

UINT CRechteckDlg::threadFunction(LPVOID pParam)
{
	CRechteckDlg* pDlg = (CRechteckDlg*) pParam;
	pDlg-&gt;threadRun();

	return 0;
}

VOID CRechteckDlg::threadRun()
{
	while (m_iFlag) {

		// Rechteck ausserhalb des definierten Bereichs ?
		if (rectdata.left &gt;= 400)
			SetRect();					

		// Device Kontext des Fensters holen
		CDC* pDC = GetDC();
		CBrush brush(RGB (255, 0, 0));

		pDC-&gt;SelectObject(&amp;brush);
		pDC-&gt;Rectangle(&amp;rectdata);
		pDC-&gt;DeleteDC();

	}
}

VOID CRechteckDlg::SetRect()
{
	rectdata.left = 10;
	rectdata.top = 10;
	rectdata.bottom = 40;
	rectdata.right = 80;
}

void CRechteckDlg::OnTimer(UINT nIDEvent) 
{
	if (bTimer) {

		RedrawWindow(&amp;rectdata, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE );
		rectdata.left++;
		rectdata.right++;		
	}

	CDialog::OnTimer(nIDEvent);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/383100</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/383100</guid><dc:creator><![CDATA[seufz*]]></dc:creator><pubDate>Thu, 30 Oct 2003 22:26:26 GMT</pubDate></item><item><title><![CDATA[Reply to Flackern &amp;amp; Striche on Fri, 31 Oct 2003 07:58:46 GMT]]></title><description><![CDATA[<p>Errinnert mich an den Beitrag: <a href="http://www.c-plusplus.net/forum/viewtopic.php?t=53587" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic.php?t=53587</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/383204</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/383204</guid><dc:creator><![CDATA[estartu]]></dc:creator><pubDate>Fri, 31 Oct 2003 07:58:46 GMT</pubDate></item></channel></rss>