Click here to Skip to main content
15,888,401 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionEmbedding a CDialog in a CMFCOutlookbar Pin
UrbanBlues9-Jan-12 11:16
UrbanBlues9-Jan-12 11:16 
AnswerRe: Embedding a CDialog in a CMFCOutlookbar Pin
«_Superman_»9-Jan-12 14:40
professional«_Superman_»9-Jan-12 14:40 
GeneralRe: Embedding a CDialog in a CMFCOutlookbar Pin
UrbanBlues10-Jan-12 7:01
UrbanBlues10-Jan-12 7:01 
QuestionProblem with resizing window Pin
blackbolek9-Jan-12 4:45
blackbolek9-Jan-12 4:45 
QuestionRe: Problem with resizing window Pin
Albert Holguin9-Jan-12 4:58
professionalAlbert Holguin9-Jan-12 4:58 
AnswerRe: Problem with resizing window Pin
blackbolek9-Jan-12 10:01
blackbolek9-Jan-12 10:01 
AnswerRe: Problem with resizing window Pin
Albert Holguin9-Jan-12 10:18
professionalAlbert Holguin9-Jan-12 10:18 
GeneralRe: Problem with resizing window Pin
blackbolek9-Jan-12 22:01
blackbolek9-Jan-12 22:01 
I'm calling it from push button event.
I moved the resizing code to the OnInitDialog() and the window was resized without any problems. I'm drawing a graph in this window. I do that in InitGraph() function which is called from InitDialog. So if I place the SetWindowPos() before call to InitGraph() then it works. If I place it after, then I have an error.

Looks to me that I do something wrong with DC in InitGraph():
C++
void CGraphDlg::InitGraph()
{
	
        CRect rectControl5;		// area of control being moved - divider line above controls
	CBitmap image;			// bitmap with logo

	// This functions sets up the bitmap in memory. Called from OnInitDialog.

	CDC * pDC = GetDC();
	
	if (!not_first_paint)
	{
		image.LoadBitmap(IDB_GRAPHBLANK);	// load in a blank BMP of the desired size
		dcGraphMem.CreateCompatibleDC(pDC);
		// Select the bitmap into the new DC in memory.
		dcGraphMem.SelectObject(&image);
	}

	// save window size
  	GetClientRect(GraphWindow);
	YSCALE = GraphWindow.Height() - 191;		
	graphx = GraphWindow.Width() - 212;		// current graph working area width
	
	// adjust size of the bitmap to the actual window size
	StretchBlt (dcGraphMem, 0, 0, GraphWindow.Width(), GraphWindow.Height()-25, dcGraphMem, 0, 0, 1600, 1044 , SRCCOPY);

	
	ReleaseDC(pDC) ;


	m_divline.GetParent()->GetClientRect(GraphWindow);
	m_divline.GetWindowRect(rectControl5);
	m_divline.MoveWindow(0, GraphWindow.Height()-BOTTOMCONTROLS-2, rectControl5.Width(), rectControl5.Height());

	image.DeleteObject();


	// now we know we went through graph initialization, 
	not_first_paint = true;


	return;
}

GeneralRe: Problem with resizing window Pin
Albert Holguin10-Jan-12 3:27
professionalAlbert Holguin10-Jan-12 3:27 
GeneralRe: Problem with resizing window Pin
blackbolek9-Jan-12 23:30
blackbolek9-Jan-12 23:30 
GeneralRe: Problem with resizing window Pin
Richard MacCutchan10-Jan-12 2:31
mveRichard MacCutchan10-Jan-12 2:31 
GeneralRe: Problem with resizing window Pin
Albert Holguin10-Jan-12 3:29
professionalAlbert Holguin10-Jan-12 3:29 
GeneralRe: Problem with resizing window Pin
blackbolek10-Jan-12 20:52
blackbolek10-Jan-12 20:52 
GeneralRe: Problem with resizing window Pin
Albert Holguin11-Jan-12 7:55
professionalAlbert Holguin11-Jan-12 7:55 
AnswerRe: Problem with resizing window Pin
Richard MacCutchan9-Jan-12 5:50
mveRichard MacCutchan9-Jan-12 5:50 
GeneralRe: Problem with resizing window Pin
Albert Holguin9-Jan-12 7:26
professionalAlbert Holguin9-Jan-12 7:26 
GeneralRe: Problem with resizing window Pin
blackbolek9-Jan-12 10:14
blackbolek9-Jan-12 10:14 
AnswerRe: Problem with resizing window Pin
Luc Pattyn9-Jan-12 11:07
sitebuilderLuc Pattyn9-Jan-12 11:07 
GeneralRe: Problem with resizing window Pin
Richard MacCutchan9-Jan-12 21:19
mveRichard MacCutchan9-Jan-12 21:19 
QuestionTop level menu - Message on losing focus Pin
RavishB9-Jan-12 3:22
RavishB9-Jan-12 3:22 
AnswerRe: Top level menu - Message on losing focus Pin
Code-o-mat9-Jan-12 6:14
Code-o-mat9-Jan-12 6:14 
QuestionLog event message Pin
_Flaviu8-Jan-12 22:58
_Flaviu8-Jan-12 22:58 
AnswerRe: Log event message Pin
Chandrasekharan P8-Jan-12 23:38
Chandrasekharan P8-Jan-12 23:38 
QuestionWinSNMP Pin
msr_codeproject8-Jan-12 19:40
msr_codeproject8-Jan-12 19:40 
AnswerRe: WinSNMP Pin
Richard MacCutchan8-Jan-12 22:55
mveRichard MacCutchan8-Jan-12 22:55 

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.