Click here to Skip to main content
15,921,990 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Help me please! Release mode optimizations are screwing up my program! :( Pin
Julia Larson16-Feb-02 18:57
Julia Larson16-Feb-02 18:57 
GeneralRe: Help me please! Release mode optimizations are screwing up my program! :( Pin
Julia Larson16-Feb-02 19:09
Julia Larson16-Feb-02 19:09 
GeneralRe: Help me please! Release mode optimizations are screwing up my program! :( Pin
Shog916-Feb-02 19:39
sitebuilderShog916-Feb-02 19:39 
GeneralRe: Help me please! Release mode optimizations are screwing up my program! :( Pin
Julia Larson16-Feb-02 20:12
Julia Larson16-Feb-02 20:12 
GeneralIt slowly dawns on me Pin
Julia Larson16-Feb-02 19:16
Julia Larson16-Feb-02 19:16 
GeneralCDialogBar Pin
16-Feb-02 16:28
suss16-Feb-02 16:28 
GeneralRe: CDialogBar Pin
Derek Waters17-Feb-02 11:27
Derek Waters17-Feb-02 11:27 
GeneralDrawing Controls Problem Pin
John Clump16-Feb-02 16:13
John Clump16-Feb-02 16:13 
Hi everyone. I have some code which centers a series of buttons on a dialog, which is in OnSize(). Problem I have is, as the user resizes the control, the buttons are drawn twice (?), and there are "artifacts" of the original draw are still there. If the window is minimized and brought back up again, the buttons draw properly and the "artifacts" are gone. The buttons do center and adjust properly as the window is resized, but leave those "artifacts" for some reason. It doesn't happen when the window is maximized and normalized, but do occur when the user drags the window frame and resizes that way.

I am also using Paul Wendt's CControlPos class which is found on Codeproject, which moves all the other controls (I had to move the buttons manually to achieve the centering with a series of buttons).

Anyone have any ideas? Any help is greatly appreciated!

<br />
void CDlgMain::OnSize(UINT nType, int cx, int cy) <br />
{<br />
	CDialog::OnSize(nType, cx, cy);<br />
<br />
	CRect rcButtonRect;<br />
<br />
	// size once window is created, then move buttons appropriately<br />
	if(::IsWindow(GetDlgItem(IDC_BTN_ADD)->GetSafeHwnd()))<br />
	{<br />
           // resizing calculations done here<br />
<br />
		bool bDrawAgain = true;<br />
<br />
		// draw add button<br />
		GetDlgItem(IDC_BTN_ADD)->MoveWindow(rcButtonRect, bDrawAgain);<br />
<br />
		// draw edit button<br />
		rcButtonRect.left = ((cx - iParentWidth)/2) + iButtonLeft;<br />
		rcButtonRect.right = rcButtonRect.left + iButtonWidth;<br />
		GetDlgItem(IDC_BTN_EDIT)->MoveWindow(rcButtonRect, bDrawAgain);<br />
<br />
		// draw delete button<br />
	        rcButtonRect.left = ((cx - iParentWidth)/2) + iButtonLeft;<br />
		rcButtonRect.right = rcButtonRect.left + iButtonWidth;<br />
		GetDlgItem(IDC_BTN_DELETE)->MoveWindow(rcButtonRect, bDrawAgain);<br />
<br />
		// draw copy button<br />
		iButtonLeft = 391;<br />
		rcButtonRect.left = ((cx - iParentWidth)/2) + iButtonLeft;<br />
		rcButtonRect.right = rcButtonRect.left + iButtonWidth;<br />
		GetDlgItem(IDC_BTN_COPY)->MoveWindow(rcButtonRect, bDrawAgain);<br />
	}<br />
    // Paul Wendt's CControlPos class, this moves all other<br />
    // controls<br />
    // this class calls the following code to draw each<br />
    // control<br />
    // m_pParent->ScreenToClient(rcBounds);<br />
    // pControl->MoveWindow(rcBounds);<br />
<br />
    m_cControlPos.MoveControls();<br />
}<br />

GeneralRe: Drawing Controls Problem Pin
Shog916-Feb-02 16:25
sitebuilderShog916-Feb-02 16:25 
GeneralRe: Drawing Controls Problem Pin
John Clump16-Feb-02 18:00
John Clump16-Feb-02 18:00 
GeneralRe: Drawing Controls Problem Pin
Shog916-Feb-02 18:30
sitebuilderShog916-Feb-02 18:30 
GeneralRe: Drawing Controls Problem Pin
Ravi Bhavnani16-Feb-02 19:19
professionalRavi Bhavnani16-Feb-02 19:19 
GeneralRe: Drawing Controls Problem Pin
John Clump16-Feb-02 19:47
John Clump16-Feb-02 19:47 
GeneralHelp on Designing Tictactoe in VC++ Pin
John Cruz16-Feb-02 15:38
John Cruz16-Feb-02 15:38 
GeneralRe: Help on Designing Tictactoe in VC++ Pin
Shog916-Feb-02 16:18
sitebuilderShog916-Feb-02 16:18 
GeneralRe: Help on Designing Tictactoe in VC++ Pin
alex.barylski16-Feb-02 22:28
alex.barylski16-Feb-02 22:28 
GeneralRe: Help on Designing Tictactoe in VC++ Pin
John Cruz18-Feb-02 12:43
John Cruz18-Feb-02 12:43 
GeneralRe: Help on Designing Tictactoe in VC++ Pin
Christian Graus18-Feb-02 12:47
protectorChristian Graus18-Feb-02 12:47 
GeneralRe: Help on Designing Tictactoe in VC++ Pin
Andrew Peace18-Feb-02 13:09
Andrew Peace18-Feb-02 13:09 
GeneralRe: Help on Designing Tictactoe in VC++ Pin
alex.barylski18-Feb-02 14:49
alex.barylski18-Feb-02 14:49 
GeneralRe: Help on Designing Tictactoe in VC++ Pin
John Cruz19-Feb-02 1:19
John Cruz19-Feb-02 1:19 
GeneralRe: Help on Designing Tictactoe in VC++ Pin
Member 139425924-Dec-04 20:17
Member 139425924-Dec-04 20:17 
GeneralMDI - How do I set or activate a view Pin
RobJones16-Feb-02 14:29
RobJones16-Feb-02 14:29 
GeneralRe: MDI - How do I set or activate a view Pin
Derek Waters17-Feb-02 11:35
Derek Waters17-Feb-02 11:35 
GeneralRe: MDI - How do I set or activate a view Pin
RobJones17-Feb-02 12:22
RobJones17-Feb-02 12:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.