Profile Picture

NContextMenu NCommand Font property not working

Posted By Brad Swearingen 13 Years Ago
Author
Message
Brad Swearingen
Posted 13 Years Ago
View Quick Profile
Forum Guru

Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 53, Visits: 3

I've created an NContextMenu that shows as expected.  I'd like to specify a different font for just one of my NCommands on the menu to indicate that it is the "default" menu item.  (The command which will issue during a double click.  Often shown using the current font but bold.)  I'm trying to set the font (NCommand.Properties.Font) but it doesn't use it though the menu seems to be reserving space for the font change.  Seems like something is preventing the font from being used when drawing it.

Sounds like I'm missing some understanding.  I'm using Win7 with the 11.1.17.12 build.  How can a default menu item like this be implemented?



Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)

Group: Forum Members
Last Active: Yesterday @ 3:37 AM
Posts: 3,043, Visits: 3,774
Hello Brad,

Have you tried to set the font as follows:

NCommand nCommand = new NCommand();

...

nCommand.Properties.Font = new Font(Font, FontStyle.Bold);


Best Regards,
Nevron Support Team



Brad Swearingen
Posted 13 Years Ago
View Quick Profile
Forum Guru

Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 53, Visits: 3

Right, I've tried things like:

cmd.Properties.Font = new Font(frm.Font, FontStyle.Bold);

cmd.Properties.Font = new Font("Times New Roman", 20.0F, FontStyle.Bold);

Nothing seems to help.  When I set the 20.0F I can see the extra space in the context menu command height that it has reserved for the font but the font is not being used when drawing the text.  Its the same font as the other menu items just centered within that larger space.

I've tried both in code and the VS designer properties box.  I also noticed I have the same problem on a NDockingToolbar's text only NCommand.  It will reserve the space on the button for the larger font but not draw with it.  Changing the font on an NButton or NTextBox works as expected, however.



Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)

Group: Forum Members
Last Active: Yesterday @ 3:37 AM
Posts: 3,043, Visits: 3,774
Hello Brad,

Could you send us an example application with the problem, because we cannot replicated on our site.
What I did was to drop a NContextMenu, add a new command, set its Font value as you described and add it to the context menu Commands collection.
When I display the context menu, the text of the command is displayed bold.

Best Regards,
Nevron Support Team



Brad Swearingen
Posted 13 Years Ago
View Quick Profile
Forum Guru

Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 53, Visits: 3
That sounds like what I've done as well.  Here's a test program that a double click on the form displays the NContextMenu after first setting the font on the "bold" menu item.  I've not tried this on the latest build so perhaps its fixed.

Attachments
NevronTest.zip (206 views, 26.00 KB)
Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)

Group: Forum Members
Last Active: Yesterday @ 3:37 AM
Posts: 3,043, Visits: 3,774
Hi Brad,

Indeed, this should work correctly in the latest version.

Best Regards,
Nevron Support Team



Brad Swearingen
Posted 12 Years Ago
View Quick Profile
Forum Guru

Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 53, Visits: 3
I just downloaded the latest build and tested this and this can still be reproduced.  Once I apply any one of the skins (e.g., like "MacOS") the problem happens.  When there is no skin specified it works fine and it uses the expected font.  Is there a workaround when using a skin?

Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)Supreme Being (4,350 reputation)

Group: Forum Members
Last Active: Yesterday @ 3:37 AM
Posts: 3,043, Visits: 3,774

Hello Brad,

We missed to fix this issue for the case when skin is applied.

In the next release it should be ok.

Please, excuse us for the inconvenience.



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic