Click here to Skip to main content
15,892,643 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ question. Pin
WREY7-Sep-04 8:42
WREY7-Sep-04 8:42 
GeneralRe: C++ question. Pin
Bob Stanneveld7-Sep-04 9:57
Bob Stanneveld7-Sep-04 9:57 
QuestionUrgent!!How to limit used resources? Pin
mfc_surfer6-Sep-04 19:45
mfc_surfer6-Sep-04 19:45 
GeneralHelp voice chat tech :((( Pin
phamdoan6-Sep-04 18:38
phamdoan6-Sep-04 18:38 
QuestionHow to link the submenu and dialog in MFC dialog based application? Pin
anuchelvi6-Sep-04 17:18
anuchelvi6-Sep-04 17:18 
QuestionHow to disable device in 98/me Pin
max_xiayi6-Sep-04 14:56
max_xiayi6-Sep-04 14:56 
QuestionHow to disable device in 98/me Pin
max_xiayi6-Sep-04 14:56
max_xiayi6-Sep-04 14:56 
GeneralMapping Modes, and Font Size Pin
CoreyCooper6-Sep-04 13:56
CoreyCooper6-Sep-04 13:56 
I am trying to create an app that, among other things, uses an MFC Doc/View architecture to display RTF files. I have the editing and display and all the standard stuff from a library (LED) that does an excellent job. Now I have to have a second window open, that shows a portion of the text from another view (lets for argument say the top two lines) blown up (or zoomed in) large. However, I have to have the resolution higher, not just StretchBlt the smaller image up and get a pixelated image. I have a mechanizm to open a separate Frame Window and View, and to transfer the selected text to it.

I thought I could manimpulate the Mapping Mode along with the Viewport and Window Extents to in effect change the DPI of a memory mapped DC. Then, just like when you print, in my OnDraw routine, I pass the DC to my view, let it render to the DC, and then Blit it over to my window.

When I set up my DC, and change it's mapping mode to MM_ANISOTROPIC, and then modify the Extents, everything seems fine when I create a font and call GetOutputTextExtent(), I get a value, and when I double the ratio of the Window to the Viewport Extents, GetOutputTextExtent() reports a value that is double. HOWEVER, when I then use TextOut, the text is the same size, unaffected by the extents. How can GetOutputTextExtent()report a different value than TextOut produces?

Below is some sample code, note the second and third lines from the bottom get the size and create the text, but they do not match:


	CDC cdcScreen;<br />
	cdcScreen.CreateDC("DISPLAY", NULL, NULL, NULL); <br />
	ResizeableDC = new CDC;<br />
	ResizeableDC->CreateCompatibleDC(&cdcScreen);<br />
<br />
	int mode = ResizeableDC->SetMapMode(MM_ANISOTROPIC);<br />
	ASSERT(mode == MM_TEXT);<br />
// the next line can be changed to *40, and the GetOutputTextExtent() will vary appropriatly<br />
	ResizeableDC->SetWindowExt(1024*20, 768*20);<br />
	ResizeableDC->SetViewportExt(1024, 768);<br />
<br />
	CFont font;<br />
	{<br />
		LOGFONT lf;<br />
		memset(&lf, 0, sizeof(LOGFONT));       // zero out structure<br />
		lf.lfHeight = -MulDiv(12, ResizeableDC->GetDeviceCaps(LOGPIXELSY), 72);<br />
		strcpy(lf.lfFaceName, "Arial");        // request a face name "Arial"<br />
		VERIFY(font.CreateFontIndirect(&lf));  // create the font<br />
	}<br />
	<br />
	CFont* def_font = ResizeableDC->SelectObject(&font);<br />
    CSize Size = ResizeableDC->GetOutputTextExtent("Now is the time for all good men");<br />
<br />
	ResizeableDC->TextOut(Size.cx, Size.cy, "Now is the time for all good men");<br />
	ResizeableDC->SelectObject(def_font);



Any other ideas on how to get the results I need? The View class will render to a printer at a high DPI quite well, so I don't think I need to re-write the View code, I just have to figure out how to change the DPI of a DC!




Corey Cooper
GeneralListCtrl Stuff Pin
Grahamfff6-Sep-04 11:49
Grahamfff6-Sep-04 11:49 
GeneralRe: ListCtrl Stuff Pin
valikac6-Sep-04 16:50
valikac6-Sep-04 16:50 
GeneralCTreeCtrl and SortChildrenCB Pin
Al_Bundy6-Sep-04 11:08
Al_Bundy6-Sep-04 11:08 
GeneralRe: CTreeCtrl and SortChildrenCB Pin
Ryan Binns6-Sep-04 18:31
Ryan Binns6-Sep-04 18:31 
GeneralRe: CTreeCtrl and SortChildrenCB Pin
Al_Bundy7-Sep-04 7:14
Al_Bundy7-Sep-04 7:14 
GeneralDefragmenting Pin
gamitech6-Sep-04 10:23
gamitech6-Sep-04 10:23 
GeneralRe: Defragmenting Pin
Darren_vms6-Sep-04 10:49
Darren_vms6-Sep-04 10:49 
GeneralRe: Defragmenting Pin
gamitech6-Sep-04 10:51
gamitech6-Sep-04 10:51 
GeneralHelp Pin
Timothy Grabrian6-Sep-04 8:21
professionalTimothy Grabrian6-Sep-04 8:21 
GeneralRe: Help Pin
Jon Hulatt6-Sep-04 10:34
Jon Hulatt6-Sep-04 10:34 
GeneralAddFontResource + pfm &amp;&amp; pfb Pin
globus0006-Sep-04 5:02
globus0006-Sep-04 5:02 
GeneralRe: AddFontResource + pfm &amp;&amp; pfb Pin
Mike Dimmick6-Sep-04 13:01
Mike Dimmick6-Sep-04 13:01 
GeneralLibrary: converting to/from UTF-x Pin
peterchen6-Sep-04 4:34
peterchen6-Sep-04 4:34 
GeneralRe: Library: converting to/from UTF-x Pin
DrusTheAxe6-Sep-04 4:55
DrusTheAxe6-Sep-04 4:55 
GeneralRe: Library: converting to/from UTF-x Pin
peterchen6-Sep-04 7:23
peterchen6-Sep-04 7:23 
GeneralBlueTooth communication Pin
eli150219796-Sep-04 4:31
eli150219796-Sep-04 4:31 
GeneralRe: BlueTooth communication Pin
Trollslayer6-Sep-04 5:11
mentorTrollslayer6-Sep-04 5: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.