473,769 Members | 4,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DrawString - Drawing MenuItem Text with Underline Mnemonic?

Lex
I have a c# app that has a OwnerDrawn menu items.

Is there and easy way to use DrawString to draw the underline under
the mnemonic character?

BTW - I figured out how to detected if we should be showing the
underline or not from my draw method:

if ((e.State.Equal s(DrawItemState .None)) ||
(e.State.Equals (DrawItemState. Selected)))
acceleratorOn = true;

Regards
Nov 16 '05 #1
1 2943
pass a StringFormat (with HotkeyPrefix set to Show) to the DrawString
method.

--
Mick Doherty
http://homepage.ntlworld.com/mdaudi1...nate/home.html
"Lex" <de**@homerlex. mailshell.com> wrote in message
news:c5******** *************** **@posting.goog le.com...
I have a c# app that has a OwnerDrawn menu items.

Is there and easy way to use DrawString to draw the underline under
the mnemonic character?

BTW - I figured out how to detected if we should be showing the
underline or not from my draw method:

if ((e.State.Equal s(DrawItemState .None)) ||
(e.State.Equals (DrawItemState. Selected)))
acceleratorOn = true;

Regards

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2584
by: Lex | last post by:
I am writing a C# app that has a Menu. Some of the menu items will have short cuts that do not exist in the Shortcut enum. I would like the custom shortcuts to appear on the menu but as far as I can tell there is no way to add a short cut that is not in the Shortcut enum. I have my on keyboard hook so I am not worried about the custom shortcut magically working. I just want it to appear nicely formated on the menu. Anyone have any...
1
2664
by: Lex | last post by:
I have a c# app that has a OwnerDrawn menu items. Is there and easy way to use DrawString to draw the underline under the mnemonic character? BTW - I figured out how to detected if we should be showing the underline or not from my draw method: if ((e.State.Equals(DrawItemState.None)) || (e.State.Equals(DrawItemState.Selected)))
2
14874
by: Mark Keats | last post by:
Hi there, I have some code for an ASP.Net page that produces an image of an e-mail address to prevent those programs that spider the net for e-mail addresses on pages grabbing it. The code is as follows (but on my version it gets the e-mail address from a database rather than QueryString). How can I crop the image to the exact size of the text as if the e-mail
1
8843
by: Drew | last post by:
I posted this to framework.drawing, but did not get any responses... Maybe here?? I am drawing some text using DrawString() and using a bounding rectangle so that when the string is too long it wraps automatically. I want to decrease the amount of space between the lines. How would I go about changing the LineSpacing? The FontFamily has a read only property. Any ideas?
0
1719
by: Valerie Hough | last post by:
I have derived a class from MenuItem so that I can associate IDs of my choosing with each item (a la C++). I have created a ContextMenu in the constructor of an owner draw list box and added a number of MyMenuItems to it, each with a unique mnemonic (&Item1 e.g.). When I right click the mouse on my list box, all the menus show up as intended; the characters I have assigned as mnemonics work, but the mnemonic character is not...
0
1286
by: kate sporks | last post by:
I apologize if this double posts. I'm currently building a document viewer that uses DrawString(...) to render text. I've gotten it working quite well, including getting MeasureString and StringFormat.GenericTypographic. However, I run into a problem when I have to print a string consisting purely of whitespace. This problem only occurs when it's a collection of spaces, like " ", and the Font says to underline it. If there's...
5
5035
by: jack | last post by:
In using GDI+ drawstring, if the string to be drawn is in rtf format, how do I make GDI+ to recognize the rtf attributes. In other words, how do I draw one string in GDI+ , within which the font size , bold / underline attributes are different.
0
3557
by: Hasim AH | last post by:
Hi .. Just getting interested to learn C# and needs help. I want to write C# application so that the program will execute and draw graphics when the user select the drawing menu from the main menu, SigDraw. Here is the codes:- using System; using System.Drawing; using System.Collections;
1
1704
by: Gidi | last post by:
Hi, Is it possible to draw string with few font styls, like in WORD (i.e. Bold and Underline) at the same line, on the same text ? and is it possible that part of the line will be bold and the other one not ? Thanks, Gidi.
2
14950
by: Siv | last post by:
Hi, I want to print using the Graphics.Drawstring method but instead of using either bold or underline I want to combine both so the printed text is bold and underline?? The way I send the drawstring command is as follows: Somewhere in my declarations I have: Private ra As System.Drawing.StringFormat
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.