Click here to Skip to main content
16,005,178 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDuuuuuude Pin
leckey29-Nov-07 10:01
leckey29-Nov-07 10:01 
QuestionRe: help regarding database update Pin
David Crow29-Nov-07 10:19
David Crow29-Nov-07 10:19 
AnswerRe: help regarding database update Pin
Maximilien29-Nov-07 9:19
Maximilien29-Nov-07 9:19 
AnswerRe: help regarding database update Pin
led mike29-Nov-07 9:40
led mike29-Nov-07 9:40 
GeneralRe: help regarding database update Pin
paresh_sarjani29-Nov-07 9:58
paresh_sarjani29-Nov-07 9:58 
QuestionHelp extracting specific icon index that is a resource Pin
Gunn31729-Nov-07 4:52
Gunn31729-Nov-07 4:52 
AnswerRe: Help extracting specific icon index that is a resource Pin
led mike29-Nov-07 5:05
led mike29-Nov-07 5:05 
QuestionMemory DC in OnMouseMove, still blink Pin
followait29-Nov-07 4:13
followait29-Nov-07 4:13 
The original screen is in MemDC

I copy MemDC to MemDC2 first, then draw cross lines in MemDC2,
at last copy MemDC2 to real dc.

Why is the screen still blink when moving the mouse?


The code are in OnMouseMove
<br />
		CClientDC dc(this);<br />
		<br />
		int OldDC=dc.SaveDC();<br />
		dc.SetMapMode(MM_ANISOTROPIC);<br />
		dc.SetWindowExt(m_WinXExt,-m_WinYExtTri);<br />
		dc.SetViewportExt(rt.Width()-m_LeftMargin-m_DeltaViewXExt,int(rt.Height()*0.5f)-m_DescH);<br />
		dc.SetWindowOrg(0,0);<br />
		dc.SetViewportOrg(m_LeftMargin,int(rt.Height()*0.5f));<br />
		<br />
		CPoint pt(point);<br />
		dc.DPtoLP(&pt);<br />
		pt.x=pt.x/m_UnitsPerHemline*m_UnitsPerHemline+int(m_UnitsPerHemline*0.5f);<br />
		UINT n=pt.x/m_UnitsPerHemline;<br />
		if (n>=m_CntDispGrp) return;<br />
<br />
		dc.LPtoDP(&pt);<br />
		dc.RestoreDC(OldDC);<br />
		<br />
		n=m_CntCandidateGrp-m_CntDispGrp+n;<br />
		m_pRs->Move(n,_variant_t(long(adBookmarkFirst)));<br />
		COleDateTime OleDT=m_pRs->GetCollect("时刻");<br />
		m_MemDC2.BitBlt(0,0,rt.Width(),rt.Height(),&m_MemDC,0,0,SRCCOPY);<br />
		m_MemDC2.SelectObject(&m_WPen);<br />
		m_MemDC2.SetROP2(R2_XORPEN);<br />
		m_MemDC2.MoveTo(m_LeftMargin,point.y);<br />
		m_MemDC2.LineTo(rt.Width(),point.y);<br />
		m_MemDC2.MoveTo(pt.x,0);<br />
		m_MemDC2.LineTo(pt.x,rt.Height()-m_BottomMargin);<br />
		m_MemDC2.SetROP2(R2_COPYPEN);<br />
		dc.BitBlt(0,0,rt.Width(),rt.Height(),&m_MemDC2,0,0,SRCCOPY);<br />
		CBrush BBr(RGB(0,0,255));<br />
		CString s=OleDT.Format();<br />
		CRect RtText(0,0,0,0);<br />
		m_MemDC2.SetBkMode(TRANSPARENT);<br />
		m_MemDC2.SetTextColor(RGB(255,0,0));<br />
		m_MemDC2.SelectObject(&m_RPen);<br />
		m_MemDC2.DrawText(s,&RtText,DT_CALCRECT);<br />
		RtText.InflateRect(2,0,2,0);<br />
		RtText.OffsetRect(pt.x-int(RtText.Width()*0.5f),int(rt.Height()-m_BottomMargin));<br />
		if (RtText.right>rt.Width()) {<br />
			RtText.OffsetRect(rt.Width()-RtText.right,0);<br />
		}<br />
		RtText.bottom=rt.Height();<br />
		RtText.top=RtText.bottom-m_BottomMargin+1;<br />
		m_MemDC2.FillRect(&RtText,&BBr);<br />
		m_MemDC2.DrawText(s,&RtText,DT_CENTER|DT_VCENTER|DT_SINGLELINE);<br />
		m_MemDC2.MoveTo(RtText.TopLeft());<br />
		m_MemDC2.LineTo(RtText.left,RtText.bottom);<br />
		m_MemDC2.MoveTo(RtText.right,RtText.top);<br />
		m_MemDC2.LineTo(RtText.BottomRight());<br />
		<br />
		float f;<br />
		if (pt.y<int(rt.Height()*0.5f)) {<br />
			f=m_DispMinVolt+(rt.Height()*0.5f-pt.y)*(m_DispMaxVolt-m_DispMinVolt)/(rt.Height()*0.5f-m_DescH);<br />
			s.Format("%.2f",f);<br />
			RtText.SetRect(0,0,0,0);<br />
			m_MemDC2.DrawText(s,&RtText,DT_CALCRECT);<br />
			RtText.InflateRect(0,1,0,1);<br />
			RtText.right=m_LeftMargin;<br />
			RtText.OffsetRect(0,pt.y-int(RtText.Height()*0.5f));<br />
			if (RtText.top<0) {<br />
				RtText.OffsetRect(0,-RtText.top);<br />
			}<br />
			m_MemDC2.FillRect(&RtText,&BBr);<br />
			m_MemDC2.DrawText(s,&RtText,DT_RIGHT|DT_VCENTER|DT_SINGLELINE);<br />
			m_MemDC2.MoveTo(RtText.TopLeft());<br />
			m_MemDC2.LineTo(RtText.right,RtText.top);<br />
			m_MemDC2.MoveTo(RtText.left,RtText.bottom);<br />
			m_MemDC2.LineTo(RtText.BottomRight());<br />
		} else if (pt.y<rt.Height()-int(m_BottomMargin)) {<br />
			if (m_AN_ZJY==1) {<br />
				f=m_DispMinAN+(rt.Height()-m_BottomMargin-pt.y)*(m_DispMaxAN-m_DispMinAN)/(rt.Height()*0.5f-m_BottomMargin-m_DescH);<br />
				s.Format("%.2f",f);<br />
				RtText.SetRect(0,0,0,0);<br />
				m_MemDC2.DrawText(s,&RtText,DT_CALCRECT);<br />
				RtText.InflateRect(0,1,0,1);<br />
				RtText.right=m_LeftMargin;<br />
				RtText.OffsetRect(0,pt.y-int(RtText.Height()*0.5f));<br />
				m_MemDC2.FillRect(&RtText,&BBr);<br />
				m_MemDC2.DrawText(s,&RtText,DT_RIGHT|DT_VCENTER|DT_SINGLELINE);<br />
				m_MemDC2.MoveTo(RtText.TopLeft());<br />
				m_MemDC2.LineTo(RtText.right,RtText.top);<br />
				m_MemDC2.MoveTo(RtText.left,RtText.bottom);<br />
				m_MemDC2.LineTo(RtText.BottomRight());<br />
			} else if (m_AN_ZJY==2) {<br />
				f=m_DispMinZJY+(rt.Height()-m_BottomMargin-pt.y)*(m_DispMaxZJY-m_DispMinZJY)/(rt.Height()*0.5f-m_BottomMargin-m_DescH);<br />
				s.Format("%.2f",f);<br />
				RtText.SetRect(0,0,0,0);<br />
				m_MemDC2.DrawText(s,&RtText,DT_CALCRECT);<br />
				RtText.InflateRect(0,1,0,1);<br />
				RtText.right=m_LeftMargin;<br />
				RtText.OffsetRect(0,pt.y-int(RtText.Height()*0.5f));<br />
				m_MemDC2.FillRect(&RtText,&BBr);<br />
				m_MemDC2.DrawText(s,&RtText,DT_RIGHT|DT_VCENTER|DT_SINGLELINE);<br />
				m_MemDC2.MoveTo(RtText.TopLeft());<br />
				m_MemDC2.LineTo(RtText.right,RtText.top);<br />
				m_MemDC2.MoveTo(RtText.left,RtText.bottom);<br />
				m_MemDC2.LineTo(RtText.BottomRight());<br />
			}<br />
		}<br />
		dc.BitBlt(0,0,rt.Width(),rt.Height(),&m_MemDC2,0,0,SRCCOPY);<br />
<br />

AnswerRe: Memory DC in OnMouseMove, still blink Pin
KarstenK29-Nov-07 4:21
mveKarstenK29-Nov-07 4:21 
JokeRe: Memory DC in OnMouseMove, still blink Pin
Nelek29-Nov-07 4:27
protectorNelek29-Nov-07 4:27 
QuestionRe: Memory DC in OnMouseMove, still blink Pin
followait29-Nov-07 4:44
followait29-Nov-07 4:44 
AnswerRe: Memory DC in OnMouseMove, still blink Pin
led mike29-Nov-07 5:01
led mike29-Nov-07 5:01 
GeneralRe: Memory DC in OnMouseMove, still blink Pin
followait29-Nov-07 5:34
followait29-Nov-07 5:34 
GeneralRe: Memory DC in OnMouseMove, still blink Pin
Cedric Moonen29-Nov-07 8:26
Cedric Moonen29-Nov-07 8:26 
AnswerRe: Memory DC in OnMouseMove, still blink Pin
Nelek29-Nov-07 23:43
protectorNelek29-Nov-07 23:43 
AnswerRe: Memory DC in OnMouseMove, still blink Pin
Nelek29-Nov-07 4:25
protectorNelek29-Nov-07 4:25 
AnswerMore: Memory DC in OnMouseMove, still blink Pin
followait29-Nov-07 4:51
followait29-Nov-07 4:51 
AnswerRe: Memory DC in OnMouseMove, still blink Pin
Mike Dimmick29-Nov-07 6:17
Mike Dimmick29-Nov-07 6:17 
QuestionAccessing USB-device: How to determine lpFileName in CreateFile call Pin
arnold_w29-Nov-07 3:28
arnold_w29-Nov-07 3:28 
AnswerRe: Accessing USB-device: How to determine lpFileName in CreateFile call Pin
Cedric Moonen29-Nov-07 3:32
Cedric Moonen29-Nov-07 3:32 
GeneralRe: Accessing USB-device: How to determine lpFileName in CreateFile call Pin
arnold_w29-Nov-07 3:36
arnold_w29-Nov-07 3:36 
GeneralRe: Accessing USB-device: How to determine lpFileName in CreateFile call Pin
Randor 29-Nov-07 3:57
professional Randor 29-Nov-07 3:57 
GeneralRe: Accessing USB-device: How to determine lpFileName in CreateFile call Pin
arnold_w29-Nov-07 21:46
arnold_w29-Nov-07 21:46 
GeneralRe: Accessing USB-device: How to determine lpFileName in CreateFile call Pin
arnold_w5-Dec-07 1:45
arnold_w5-Dec-07 1:45 
QuestionC++ Month Function Pin
sidkraft29-Nov-07 3:11
sidkraft29-Nov-07 3:11 

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.