Click here to Skip to main content
15,794,236 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Solving a repaint problem in VS2005 Pin
SimplCodr22-Oct-09 12:32
SimplCodr22-Oct-09 12:32 
GeneralRe: Solving a repaint problem in VS2005 Pin
theCPkid22-Oct-09 17:57
theCPkid22-Oct-09 17:57 
AnswerRe: Solving a repaint problem in VS2005 Pin
SimplCodr23-Oct-09 5:05
SimplCodr23-Oct-09 5:05 
GeneralRe: Solving a repaint problem in VS2005 Pin
theCPkid23-Oct-09 6:07
theCPkid23-Oct-09 6:07 
GeneralRe: Solving a repaint problem in VS2005 Pin
SimplCodr23-Oct-09 6:49
SimplCodr23-Oct-09 6:49 
GeneralRe: Solving a repaint problem in VS2005 Pin
CPallini23-Oct-09 6:41
mveCPallini23-Oct-09 6:41 
GeneralRe: Solving a repaint problem in VS2005 Pin
SimplCodr23-Oct-09 7:03
SimplCodr23-Oct-09 7:03 
QuestionRe: Solving a repaint problem in VS2005 Pin
SimplCodr23-Oct-09 9:21
SimplCodr23-Oct-09 9:21 
I thought I had it...

Here is what I got, it all compiles and runs great but I never see anything show up on the window.

What did I do wrong or not do?

void CComViewView::OnDraw(CDC* /*pDC*/)
{
	CComViewDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	// TODO: add draw code for native data here
	CPaintDC dc(this);

	if(m_show)
		ShowIt(dc);
}

void CComViewView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	pos = point;
	m_show = true;
	m_userIn = true;

	InvalidateRect(NULL);
	UpdateWindow();

	CView::OnLButtonDblClk(nFlags, point);
}

void CComViewView::ShowIt(CPaintDC & dc)
{
	if(!m_userIn)return;

	maxX = GetSystemMetrics(SM_CXSCREEN);
	maxY = GetSystemMetrics(SM_CYSCREEN);

	CDC memDC;
	CBitmap m_bmp;
	
	memDC.CreateCompatibleDC(&dc);
	m_bmp.CreateCompatibleBitmap(&dc, maxX, maxY);
	memDC.SelectObject(&m_bmp);

	memDC.SetTextColor(RGB(0, 200, 100));
	memDC.SetBkColor(RGB(0,0,0));	

	wsprintf(str, "Hello World");
	memDC.TextOutA(pos.x, pos.y, str, strlen(str));

	memDC.BitBlt(0, 0, maxX, maxY, &memDC, 0, 0, SRCCOPY);
	UpdateWindow();

	// Set this false to keep from executing draw code
	// on window update
	m_userIn = false;
}

AnswerRe: Solving a repaint problem in VS2005 Pin
CPallini23-Oct-09 11:05
mveCPallini23-Oct-09 11:05 
GeneralRe: Solving a repaint problem in VS2005 Pin
SimplCodr23-Oct-09 11:29
SimplCodr23-Oct-09 11:29 
GeneralRe: Solving a repaint problem in VS2005 Pin
CPallini23-Oct-09 11:50
mveCPallini23-Oct-09 11:50 
GeneralRe: Solving a repaint problem in VS2005 Pin
theCPkid23-Oct-09 20:00
theCPkid23-Oct-09 20:00 
GeneralRe: Solving a repaint problem in VS2005 Pin
SimplCodr24-Oct-09 6:12
SimplCodr24-Oct-09 6:12 
QuestionConvert BYTE* array (unmanaged) to SAFEARRAY Pin
TalSt22-Oct-09 7:13
TalSt22-Oct-09 7:13 
QuestionRe: Convert BYTE* array (unmanaged) to SAFEARRAY Pin
CPallini22-Oct-09 9:20
mveCPallini22-Oct-09 9:20 
AnswerRe: Convert BYTE* array (unmanaged) to SAFEARRAY Pin
Randor 22-Oct-09 17:13
professional Randor 22-Oct-09 17:13 
GeneralRe: Convert BYTE* array (unmanaged) to SAFEARRAY Pin
TalSt24-Oct-09 20:50
TalSt24-Oct-09 20:50 
GeneralRe: Convert BYTE* array (unmanaged) to SAFEARRAY Pin
Randor 26-Oct-09 10:59
professional Randor 26-Oct-09 10:59 
QuestionHow to read the characters in the EditTable of SysListView32 style control ? Pin
wangningyu22-Oct-09 6:41
wangningyu22-Oct-09 6:41 
QuestionRe: How to read the characters in the EditTable of SysListView32 style control ? Pin
David Crow22-Oct-09 7:23
David Crow22-Oct-09 7:23 
AnswerRe: if the edit listcontrol in other programs, how can I read the list ?[modified] Pin
wangningyu22-Oct-09 7:35
wangningyu22-Oct-09 7:35 
GeneralRe: if the edit listcontrol in other programs, how can I read the list Pin
David Crow22-Oct-09 8:08
David Crow22-Oct-09 8:08 
AnswerRe: How to read the characters in the EditTable of SysListView32 style control ? Pin
rand094122-Oct-09 16:01
rand094122-Oct-09 16:01 
AnswerRe: How to read the characters in the EditTable of SysListView32 style control ? Pin
nenfa19-Jan-10 1:21
nenfa19-Jan-10 1:21 
QuestionDeviceIoControl to lock drive is not working Pin
Patcher3222-Oct-09 6:09
Patcher3222-Oct-09 6:09 

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.