-
January 14th, 2008, 11:53 PM
#1
font size RTB control
I am working with an RTB control,
Does anyone know how to get the current font size using an API? or a means other than rtb.selfontsize?
rtb.selfontsize only contains font size AFTER the character was typed or cursor moved. I need to know the fontsize BEFORE the user types, so if the fontsize changes, before the user types a character...i want to know what the font size is.
-
January 15th, 2008, 12:34 AM
#2
Re: font size RTB control
What are you trying to do? RTB's have a default font, if there's nothing in it. Each character can be different, so how would you know what one was before it was set?
-
January 15th, 2008, 02:29 AM
#3
Re: font size RTB control
DG: i already explained what i wanted to do in the first post. And since i mentioned using .selfontsize, that should of been your hint that i alreadly knew any character could have its own height AND that i was not trying to get the default font since that is an entirely different property.
Anyway...
in case anyone wants to know...its em_getcharformat, yHeight
Last edited by vb_lover; January 15th, 2008 at 02:32 AM.
-
January 15th, 2008, 02:39 AM
#4
Re: font size RTB control
You mean sendmessage? I was thinking that, but what is the fontsize of an empty rtb?
-
January 15th, 2008, 05:28 AM
#5
Re: font size RTB control
AFAIK, the current font size is represented by the SelFontSize property. i think his referring to the character/font height in pixel which is different since SelFontSize is in Points.
Busy
-
January 15th, 2008, 09:26 AM
#6
Re: font size RTB control
Lovely SendMessage()
@vb_lover: Could you post the complete call required here?
-
January 15th, 2008, 03:17 PM
#7
Re: font size RTB control
DG: i never said i had an empty RTB, not sure why you thought this. But BTW, an empty RTB can have a fontsize set of the next character that is going to be typed! There can be conditions in an RTB that when a font changes the .selfontsize property does not reflect the fontsize of the character that is going to be typed. The .selfontsize only shows the current current font size after the character was typed, or the cursor was moved over another character.
The call is sendmessage(rtb.hwnd, em_getcharformat2, scf_selection)
its simple to convert to points: yHeight \ 20
Last edited by vb_lover; January 15th, 2008 at 03:24 PM.
-
January 16th, 2008, 03:33 PM
#8
Re: font size RTB control
Sorry, I don't quite understand.
What is the fourth parameter, because Sendmessage() always takes four, and where is the result goin' ta come out? What is scf_selection?
-
February 1st, 2008, 10:16 AM
#9
Re: font size RTB control
corrected: sendmessage(rtb.hwnd, em_getcharformat, scf_selection,cf2)
-
February 1st, 2008, 11:02 AM
#10
Re: font size RTB control
Ok, SCF_SELECTION tells to get the format of the current selection.
And what is cf2? What data type is the result?
Sorry for asking. Pure curiousity.
-
February 1st, 2008, 11:15 AM
#11
Re: font size RTB control
cf2 is a type structure as CHARFORMAT2
and the results of the sendmessage are returned within the structure.
In this case yHeight.
-
February 1st, 2008, 12:09 PM
#12
Re: font size RTB control
I see. Thanks for the info.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|