Writing text in a control's window 
Author Message
 Writing text in a control's window

Hi all,
    Is there a way to writing text at the center of a control's window using
the hwnd?

-Thanks...

-Nikhil



Mon, 26 Dec 2005 05:09:15 GMT  
 Writing text in a control's window

Quote:
>     Is there a way to writing text at the center of a control's window
using
> the hwnd?

Call GetDC() on the window to get the DC handle associated with it, then
TextOut() onto that - Make sure you call ReleaseDC() when you're done to
prevent resource leaks.  To centre the text, first get the size of it using
the currently selected font object with GetTextExtentPoint32(), then
position the text drawing to render where the top left coordinate of the
texts bounds rectangle will be:

X = (Surface.Width - Text.Width) \ 2
Y = (Surface.Height - Text.Height) \ 2

You can find out more about the GetTextExtentPoint32() call here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdif...
Hope this helps,

    Mike

 - Microsoft Visual Basic MVP -

WWW: Http://www.mvps.org/EDais/



Mon, 26 Dec 2005 05:17:51 GMT  
 Writing text in a control's window

Quote:

>     Is there a way to writing text at the center of a control's window using
> the hwnd?

(Already answered in another group)

Please avoid posting the same message to several different groups.
If more than one group applies, then include them all on the To line
in a single message.  Multiposting means the messages and replies
stay in the groups you posted to.  Crossposting means the message
and replies are shared across all included groups.

Avoid multiposting, use crossposting sparingly.

It is better for all involved if all the replies are made visible in all the groups
you posted to.  Also, avoid posting to non-relavent groups, please....

LFS



Mon, 26 Dec 2005 06:05:59 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. can't write to text file in Windows 7

2. Writing text with escape codes to a window or edit control

3. Needed text box for text written from write to left

4. Writing my own 'data control'

5. Writing a 'viewer' control

6. Can't write the string to the text file

7. Writing text to a file without quote's

8. Can't write to text file

9. Trouble reading-writing to text window

10. VB4-16bit Can't Make Text Control Text Property Empty

11. How to write one's own controls

12. File can't be written to directory controlled by IIS

 

 
Powered by phpBB® Forum Software