Click here to Skip to main content
15,913,722 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMFC in VS.NET 2003 Pin
paulb14-May-03 13:09
paulb14-May-03 13:09 
GeneralRe: MFC in VS.NET 2003 Pin
Wes Aday14-May-03 13:41
professionalWes Aday14-May-03 13:41 
Generalcontrol styles Pin
emrosa14-May-03 13:05
emrosa14-May-03 13:05 
GeneralRe: control styles Pin
John R. Shaw14-May-03 13:31
John R. Shaw14-May-03 13:31 
GeneralRe: control styles Pin
Renjith Ramachandran15-May-03 5:10
Renjith Ramachandran15-May-03 5:10 
GeneralWSAAccept query Pin
noxon14-May-03 13:03
noxon14-May-03 13:03 
GeneralRe: WSAAccept query Pin
Renjith Ramachandran15-May-03 5:19
Renjith Ramachandran15-May-03 5:19 
GeneralDrawing, and text with an angle Pin
Jorgen E.14-May-03 13:00
Jorgen E.14-May-03 13:00 
OK, I am newbie, writing a MFC SDI-app, and I want to write text to my view.

Besides the text, there is a lot of drawing in the view, primarily lines and rectangles which I draw, basically this way:

<br />
	CClientDC ClientDC(this);<br />
	CRect area;<br />
<br />
	area.SetRect( 10, 10, 250, 400);<br />
	DrawRectangle(&ClientDC, area, 2);<br />
<br />
	area.SetRect( 10, 10, 40, 399);<br />
	DrawRectangle(&ClientDC, area, 1);<br />
<br />
        ...<br />


And DrawRectangle is the following:

<br />
void CITPAView::DrawRectangle(CDC *pdc, CRect rect, int width)<br />
{<br />
	COLORREF penn, bakgrunn;<br />
	penn = RGB(0, 0, 0);<br />
	bakgrunn = RGB( 255, 255, 255);<br />
<br />
	CBrush Pensel( bakgrunn);<br />
	CPen Penn( PS_SOLID, width, penn);<br />
<br />
	pdc->SelectObject(&Penn);<br />
	pdc->SelectObject(&Pensel);<br />
<br />
	// Takes care of drawing lines<br />
	pdc->MoveTo( rect.left, rect.top);<br />
	pdc->Rectangle( rect.left, rect.top, rect.right, rect.bottom);<br />
}<br />


This drawing works just fine as far as I can see, but it gets me to another question:
- Memory cleanup, how should I go about here? And if anyone got a more efficient way to do this, go right ahead and tell me, please!

I have found out how to write plain text with the CDC-class, but how do I output it in a certain angle? Is there some smart way to do this?

------------------------------
The great successful men of the world have used their imagination...they think ahead and create their mental picture in all its details, filling in here, adding a little there, altering this a bit and that a bit, but steadily building-steadily buildings. (Robert Collier)
GeneralRe: Drawing, and text with an angle Pin
J. Dunlap14-May-03 13:05
J. Dunlap14-May-03 13:05 
Generalmessage handler Pin
K. Shaffer14-May-03 11:11
K. Shaffer14-May-03 11:11 
GeneralRe: message handler Pin
Neville Franks14-May-03 11:26
Neville Franks14-May-03 11:26 
GeneralRe: message handler Pin
Toni7815-May-03 5:43
Toni7815-May-03 5:43 
GeneralNovell & NT Service Pin
Ed K14-May-03 10:41
Ed K14-May-03 10:41 
QuestionHow to automatically perform function when dialog appears? Pin
modernrelativist14-May-03 10:35
modernrelativist14-May-03 10:35 
AnswerRe: How to automatically perform function when dialog appears? Pin
David Crow14-May-03 11:00
David Crow14-May-03 11:00 
AnswerRe: How to automatically perform function when dialog appears? Pin
desantos14-May-03 11:11
desantos14-May-03 11:11 
AnswerRe: How to automatically perform function when dialog appears? Pin
John R. Shaw14-May-03 13:23
John R. Shaw14-May-03 13:23 
Generalambiguous symbol Pin
Unplugged14-May-03 10:22
Unplugged14-May-03 10:22 
GeneralRe: ambiguous symbol Pin
Ed K14-May-03 11:17
Ed K14-May-03 11:17 
GeneralRe: ambiguous symbol Pin
Unplugged20-May-03 4:35
Unplugged20-May-03 4:35 
GeneralVS integration of my common control Pin
compiler14-May-03 9:37
compiler14-May-03 9:37 
GeneralDialog :o) Pin
MemLeak14-May-03 9:21
MemLeak14-May-03 9:21 
GeneralRe: Dialog :o) Pin
JayP14-May-03 9:27
JayP14-May-03 9:27 
GeneralRe: Dialog :o) Pin
Nitron14-May-03 14:28
Nitron14-May-03 14:28 
GeneralPlacing a control in an edit control's NC area Pin
Diarrhio14-May-03 9:15
Diarrhio14-May-03 9:15 

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.