🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.tools.owl
Article #10

Re: help! How to get current DC ?

#10
From: Paul A. Billings
Date: Fri, 20 Oct 1995 19:27
29 lines
1570 bytes
wleong@sfsu.edu ("2 Wise"-King) wrote:
>void TMyWindow::ShowText()
>{
>	char *s="Text";
>	TClientDC dc(*this);
>
>	dc.TextOut(10,10,s,strlen(s));
>}
>
>And guess what, the text appear OUTSIDE the client window.

Huh?  It should go in the client area.....  Yep, went into the client 
area on my test.  Have you done anything funny with the mapping mode or 
fonts?  BTW, you should do painting in Paint() which is automatically 
called when the window needs painting.  You are passed a DC to use.  
Typically you call functions such as your ShowText, but pass them the 
provided DC to use.

>Also, is there any where I can scale the text to any size/font type I
>want, instead of just getting a small tiny printout of the text.
Check out TFont.  You specify a name and point size (can leave the rest 
default).
 
  TFont font("Arial", 72);  // you should be able to read this!
  dc.SelectObject(font);
  dc.TextOut(10, 10, "Hello world");  // length not needed
  dc.RestoreFont();

Paul
Technical Details
Message-ID: <468t7v$fsg@waena.maui.com>
Path: arc1-ca.pugleaf.net!news.maui.com!news
References: <45p8gg$if5@news.csus.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.maui.com!news
From: "Paul A. Billings" <pab@maui.com>
Newsgroups: comp.os.ms-windows.programmer.tools.owl,comp.lang.c++
Subject: Re: help! How to get current DC ?
Date: 20 Oct 1995 19:27:59 GMT
Organization: Maui Analysis and Synthesis Technologies
Message-ID: <468t7v$fsg@waena.maui.com>
References: <45p8gg$if5@news.csus.edu>
NNTP-Posting-Host: mr9-040.diagsoft.maui.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 1.2N (Windows; I; 32bit)
To: wleong@sfsu.edu