Click here to Skip to main content
15,887,477 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Clear text from a device context. Pin
Mark Salsbery12-Dec-07 7:31
Mark Salsbery12-Dec-07 7:31 
GeneralRe: Clear text from a device context. Pin
Mr Simple12-Dec-07 22:43
Mr Simple12-Dec-07 22:43 
GeneralRe: Clear text from a device context. Pin
Mark Salsbery13-Dec-07 5:48
Mark Salsbery13-Dec-07 5:48 
GeneralRe: Clear text from a device context. Pin
Mr Simple13-Dec-07 6:33
Mr Simple13-Dec-07 6:33 
GeneralRe: Clear text from a device context. Pin
Mark Salsbery13-Dec-07 7:44
Mark Salsbery13-Dec-07 7:44 
GeneralRe: Clear text from a device context. Pin
Mr Simple14-Dec-07 1:22
Mr Simple14-Dec-07 1:22 
GeneralRe: Clear text from a device context. Pin
Mark Salsbery14-Dec-07 4:47
Mark Salsbery14-Dec-07 4:47 
GeneralRe: Clear text from a device context. Pin
Mr Simple14-Dec-07 6:58
Mr Simple14-Dec-07 6:58 
Hi,
Everything in normal windows can be done in CE, sometimes you just need to go about it a bit differently.

I have cut out everything from my project and managed to write a non-working class if you are interested. I wont have access to CE again until monday so wont be able to test the dialog thing yet.

Below is the code, it is very simple as you can probably see. Just call the .CreateTransparent(this); and you should get a nice streak down the form.

Once again, thanks for your help!
MS.

The .H;
<br />
class CNotWorking :<br />
	public CWnd<br />
{<br />
public:<br />
	CNotWorking(void);<br />
	~CNotWorking(void);<br />
	void CreateTransparent(CWnd *pParent);<br />
<br />
	DECLARE_MESSAGE_MAP()<br />
	afx_msg void OnPaint();<br />
	afx_msg void OnTimer(UINT nIDEvent);<br />
<br />
private:<br />
	CRect rTextRect;<br />
	UINT tTicker;<br />
<br />
};


//////////
And the .CPP;
<br />
BEGIN_MESSAGE_MAP(CNotWorking, CWnd)<br />
ON_WM_PAINT()<br />
ON_WM_TIMER()<br />
END_MESSAGE_MAP()<br />
<br />
<br />
CNotWorking::CNotWorking(void)<br />
{<br />
	rTextRect.SetRect(0, 0, 40, 20);<br />
	tTicker = 0;<br />
<br />
}<br />
<br />
CNotWorking::~CNotWorking(void)<br />
{<br />
}<br />
<br />
void CNotWorking::CreateTransparent(CWnd *pParent)<br />
{<br />
		// Create & flag as existing.<br />
		CWnd::CreateEx(NULL, NULL, _T("Transparent"), WS_CHILD, 20, 20, 500, 500, pParent->GetSafeHwnd(), NULL);<br />
<br />
		tTicker = ::SetTimer(*this, (UINT_PTR)12345, 20, NULL);<br />
<br />
		ShowWindow(SW_SHOW);<br />
}<br />
<br />
void CNotWorking::OnPaint()<br />
{<br />
	CPaintDC dc(this); // device context for painting<br />
<br />
<br />
	dc.SetBkMode(TRANSPARENT);<br />
	CString textStr = "test";<br />
	dc.DrawText(textStr, &rTextRect, DT_LEFT | DT_TOP);<br />
<br />
<br />
}<br />
<br />
void CNotWorking::OnTimer(UINT nIDEvent)<br />
{<br />
	InvalidateRect(rTextRect);<br />
	rTextRect.OffsetRect(0, 2);<br />
	UpdateWindow();<br />
<br />
	CWnd::OnTimer(nIDEvent);<br />
}

GeneralRe: Clear text from a device context. Pin
Mark Salsbery14-Dec-07 8:52
Mark Salsbery14-Dec-07 8:52 
GeneralRe: Clear text from a device context. Pin
Mr Simple16-Dec-07 22:12
Mr Simple16-Dec-07 22:12 
GeneralRe: Clear text from a device context. Pin
Mark Salsbery17-Dec-07 5:50
Mark Salsbery17-Dec-07 5:50 
GeneralRe: Clear text from a device context. Pin
Mr Simple19-Dec-07 2:08
Mr Simple19-Dec-07 2:08 
GeneralRe: Clear text from a device context. Pin
Mark Salsbery19-Dec-07 6:14
Mark Salsbery19-Dec-07 6:14 
GeneralRe: Clear text from a device context. Pin
led mike12-Dec-07 7:47
led mike12-Dec-07 7:47 
GeneralRe: Clear text from a device context. Pin
Mark Salsbery12-Dec-07 7:58
Mark Salsbery12-Dec-07 7:58 
GeneralRe: Clear text from a device context. Pin
Nelek12-Dec-07 3:14
protectorNelek12-Dec-07 3:14 
QuestionUsing SendVirtualKey method? Pin
Benny_Lava12-Dec-07 1:03
Benny_Lava12-Dec-07 1:03 
GeneralMulti column combo box Pin
panthal12-Dec-07 0:33
panthal12-Dec-07 0:33 
QuestionRe: Multi column combo box Pin
Mark Salsbery12-Dec-07 6:33
Mark Salsbery12-Dec-07 6:33 
GeneralRe: Multi column combo box Pin
David Crow13-Dec-07 4:52
David Crow13-Dec-07 4:52 
GeneralRe: Multi column combo box Pin
Mark Salsbery13-Dec-07 5:49
Mark Salsbery13-Dec-07 5:49 
Questionhow the macro works Pin
George_George12-Dec-07 0:03
George_George12-Dec-07 0:03 
AnswerRe: how the macro works Pin
CPallini12-Dec-07 0:35
mveCPallini12-Dec-07 0:35 
GeneralRe: how the macro works Pin
George_George12-Dec-07 0:45
George_George12-Dec-07 0:45 
GeneralRe: how the macro works Pin
CPallini12-Dec-07 1:56
mveCPallini12-Dec-07 1:56 

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.