Home All Groups Group Topic Archive Search About
Author
13 Oct 2005 10:47 PM
Saucer Man
How can I get the Font Dialog Box to show only Fontname, Size and Color?  I
don't want those other options such as Script, Understrike, etc.

--

Thanks.

Author
14 Oct 2005 3:08 AM
Jeff Johnson [MVP: VB]
"Saucer Man" <saucerman@nospam.net> wrote in message
news:6pGdnUDcZueOedPeRVn-vw@adelphia.com...

> How can I get the Font Dialog Box to show only Fontname, Size and Color?
> I don't want those other options such as Script, Understrike, etc.

Looks like you're screwed. The cdlCFEffects flag "specifies that the dialog
box enables strikethrough, underline, and color effects." Therefore you
can't directly turn off two of these items and yet have the third one stay.
This is not a VB thing; cdlCFEffects maps directly to the CF_EFFECTS flag
that is part of the Flags member of the CHOOSEFONT structure, which is what
the Windows API function ChooseFont() uses.
Author
14 Oct 2005 4:07 AM
MikeD
"Saucer Man" <saucerman@nospam.net> wrote in message
news:6pGdnUDcZueOedPeRVn-vw@adelphia.com...
> How can I get the Font Dialog Box to show only Fontname, Size and Color?
> I don't want those other options such as Script, Understrike, etc.


As Jeff said, you can't.  However, creating your own "choose font" dialog
box with just those 3 things should not be that difficult.  You could even
use a ImageCombo for the font name and include the same icons for types of
fonts.

Other than that, just ignore the other choices if the user makes them
(although I suppose that could confuse the user or cause him/her to think
there's a "bug" if you do that).

--
Mike
Microsoft MVP Visual Basic
Author
14 Oct 2005 2:39 PM
Jeff Johnson [MVP: VB]
Show quote Hide quote
"MikeD" <nob***@nowhere.edu> wrote in message
news:e$hWCTH0FHA.164@TK2MSFTNGP10.phx.gbl...

>> How can I get the Font Dialog Box to show only Fontname, Size and Color?
>> I don't want those other options such as Script, Understrike, etc.
>
>
> As Jeff said, you can't.  However, creating your own "choose font" dialog
> box with just those 3 things should not be that difficult.  You could even
> use a ImageCombo for the font name and include the same icons for types of
> fonts.
>
> Other than that, just ignore the other choices if the user makes them
> (although I suppose that could confuse the user or cause him/her to think
> there's a "bug" if you do that).

I wonder if you can hook the font dialog like you can the Open/Save dialog
and simply make those controls invisible. [...] Well, phooey. I looked into
it and it appears that all the fancy hooking is for the Open/Save dialogs
only. I really thought I was on to something....
Author
14 Oct 2005 3:09 PM
Tom Esh
On Fri, 14 Oct 2005 10:39:40 -0400, "Jeff Johnson [MVP: VB]"
<i.get@enough.spam> wrote:

>
>I wonder if you can hook the font dialog like you can the Open/Save dialog
>and simply make those controls invisible. [...] Well, phooey. I looked into
>it and it appears that all the fancy hooking is for the Open/Save dialogs
>only. I really thought I was on to something....

I'm pretty sure it works with ChooseFont too, but seems it might look
sorta goofy with all that empty space on the dialog (unless you went
the whole 9 yards and also supplied your own RT_DIALOG custom
template). Might be better to simply disable them - wait for it to
init then flip the WS_DISABLED bits on those controls. Really wouldn't
even need a hook for that.


-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
Author
14 Oct 2005 3:19 PM
MikeD
"Jeff Johnson [MVP: VB]" <i.get@enough.spam> wrote in message
news:%233QEd0M0FHA.2884@TK2MSFTNGP09.phx.gbl...

>
> I wonder if you can hook the font dialog like you can the Open/Save dialog
> and simply make those controls invisible. [...] Well, phooey. I looked
> into it and it appears that all the fancy hooking is for the Open/Save
> dialogs only. I really thought I was on to something....


It looks to me like you can hook it.  There's an lpfnHook member of the
CHOOSEFONT structure and the callback procedure gets a WM_INITDIALOG
message.  During the processing of this message, it should then just be a
matter of making the unwanted controls invisible.  However, I'd bet that
it's probably easier to just create your own dialog.

--
Mike
Microsoft MVP Visual Basic
Author
14 Oct 2005 6:42 PM
Jeff Johnson [MVP: VB]
Show quote Hide quote
"MikeD" <nob***@nowhere.edu> wrote in message
news:e0dksKN0FHA.800@TK2MSFTNGP12.phx.gbl...

>> I wonder if you can hook the font dialog like you can the Open/Save
>> dialog and simply make those controls invisible. [...] Well, phooey. I
>> looked into it and it appears that all the fancy hooking is for the
>> Open/Save dialogs only. I really thought I was on to something....
>
>
> It looks to me like you can hook it.  There's an lpfnHook member of the
> CHOOSEFONT structure and the callback procedure gets a WM_INITDIALOG
> message.  During the processing of this message, it should then just be a
> matter of making the unwanted controls invisible.  However, I'd bet that
> it's probably easier to just create your own dialog.

Yeah, you can hook it, but I was going on the fact that the documentation
talks about things like the CDM_HIDECONTROL message only being for the Open
and Save dialogs. Without using something like Spy++ to determine the IDs of
the check boxes (if that's even possible) there's no easy way to hide these
controls that I can see.
Author
14 Oct 2005 7:30 PM
Tom Esh
On Fri, 14 Oct 2005 14:42:27 -0400, "Jeff Johnson [MVP: VB]"
<i.get@enough.spam> wrote:

>... Without using something like Spy++ to determine the IDs of
>the check boxes (if that's even possible) there's no easy way to hide these
>controls that I can see.

Entirely possible. They're defined in Dlgs.h, but the the naming
convention isn't very helpful (generic st1, cmb1, etc) unless you also
look at the actual template (Font.dlg). Way easier to grab them with
Spy IMO. Then just flip the bits in the WM_INITDIALOG handler / hook.
Of course that doesn't change the fact it's still going to look like
crap with all the empty space. <g>


-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
Author
14 Oct 2005 11:52 PM
MikeD
Show quote Hide quote
"Tom Esh" <tjeshGibber***@suscom.net> wrote in message
news:gk00l15mbkea5sq3bbp5j7iajkmtmalbu3@4ax.com...
> On Fri, 14 Oct 2005 14:42:27 -0400, "Jeff Johnson [MVP: VB]"
> <i.get@enough.spam> wrote:
>
>>... Without using something like Spy++ to determine the IDs of
>>the check boxes (if that's even possible) there's no easy way to hide
>>these
>>controls that I can see.
>
> Entirely possible. They're defined in Dlgs.h, but the the naming
> convention isn't very helpful (generic st1, cmb1, etc) unless you also
> look at the actual template (Font.dlg). Way easier to grab them with
> Spy IMO. Then just flip the bits in the WM_INITDIALOG handler / hook.
> Of course that doesn't change the fact it's still going to look like
> crap with all the empty space. <g>

I still say it'd be easier to create this dialog from your own form.  <g>

--
Mike
Microsoft MVP Visual Basic
Author
15 Oct 2005 1:48 AM
Tom Esh
On Fri, 14 Oct 2005 19:52:16 -0400, "MikeD" <nob***@nowhere.edu>
wrote:

>I still say it'd be easier to create this dialog from your own form.  <g>

Yep, unless you really enjoy hooks and Api hackery :-)


-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
Author
17 Oct 2005 9:19 PM
Saucer Man
Thanks for all the comments and suggestions.

--

Thanks.


Show quoteHide quote
"Tom Esh" <tjeshGibber***@suscom.net> wrote in message
news:1hn0l15fajn7c6qvo14a2lf73nbsvhr300@4ax.com...
> On Fri, 14 Oct 2005 19:52:16 -0400, "MikeD" <nob***@nowhere.edu>
> wrote:
>
>>I still say it'd be easier to create this dialog from your own form.  <g>
>
> Yep, unless you really enjoy hooks and Api hackery :-)
>
>
> -Tom
> MVP - Visual Basic
> (please post replies to the newsgroup)