![]() ![]() Private void toolStripMenuItem11_Click( object sender, EventArgs e) Private void toolStripMenuItem10_Click( object sender, EventArgs e) Private void çToolStripMenuItem_Click( object sender, EventArgs e) Private void üToolStripMenuItem_Click( object sender, EventArgs e) ![]() Private void ïToolStripMenuItem_Click( object sender, EventArgs e) Private void ëToolStripMenuItem_Click( object sender, EventArgs e) Private void ûToolStripMenuItem_Click( object sender, EventArgs e) Private void ôToolStripMenuItem_Click( object sender, EventArgs e) Private void îToolStripMenuItem_Click( object sender, EventArgs e) Private void êToolStripMenuItem_Click( object sender, EventArgs e) Private void âToolStripMenuItem_Click( object sender, EventArgs e) Private void éToolStripMenuItem_Click( object sender, EventArgs e) Private void ùToolStripMenuItem_Click( object sender, EventArgs e) Private void èToolStripMenuItem_Click( object sender, EventArgs e) Private void àToolStripMenuItem_Click( object sender, EventArgs e) All work the same and when called, each will insert the requested accent mark into the document at the position of the cursor. The following event handlers and these are the handlers for the new insert menu. The next new part of the application is used to insert the French accent marks into the active document. In this section, two new variables are declared, the first is a point used to maintain awareness as to the physical location of the mouse (which is later used to decide where to show the context menu) and the second is a string variable entitled "mode" which is used to maintain awareness as to whether or not to use upper case or lower case when inserting the character. The first part of the code to depart from the original version of the C# based word processor project is the declarations region of the main form. The bulk of the code in this class will not be discussed only those parts that pertain to the placement of special characters into the document. This class provides all of the functionality used in this example to allow the user to insert special characters. A similar approach could be used to allow the user to insert other special characters such as mathematical equation symbols or any other special character that might be of interest to the user. As a delta from the original editor, the main form was modified by the addition of an insert menu which contains most of the French Accent Marks and through the addition of a context menu with the same characters made available by the new insert menu. This article will only address that part of the code used to handle the context menu to do the character inserts.įigure 3: Solution Explorer with the Project VisibleĪll of the code discussed in this article is contained in frmMain.cs. The solution contains a developed word processor built around the rich text box control that much of the code will not be described herein but a description is available on this site in an earlier article. I built the example on top of a fleshed out rich text editor that is also described and available on this site. You won't win any speed typing awards going this route but it is less error prone than keying the codes and will work for you even if you don't have a number pad on your keyboard as is the case with my laptop. The lower case version is also available using a right click. To handle case differences, I set it up to insert upper case versions of the characters if I use Shift+F1 to open the menu or lower case versions of the characters if I open the menu with F1 without the shift key. Rather than remembering to lock the number pad and to type things like ALT+0192 or ALT+134, I found it easier to provide an interface in the form of a context menu. If your OS is configured for English and you'd like to leave it like that, and if you have not quite memorized all of the key code values required to insert all of the special characters you might use in writing or if you work from a laptop without a number pad, then this article will offer an alternative approach and may be of interest.įigure 2: Character Selection from a Context Menu This article describes a simple approach to implementing special character use in a C# based text editor. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |