 |
|
|
 |
|
 |
Very Nice contol. Quick and easy to use, but limited in some functionalties for example, context menu, tray icon menu etc. Also, once you have called the Start method, there is no way to change icon of menu item.
I had two context menus which are associated with controls dynamically. When I called Start method, it didn't applied theme on them, even I tried with associated ContextMenu with controls (ListView) before calling it, but didn't worked. however, when I assigedn one context menu to form itself, it worked.
IF this control has support for Context Menu and runtime image updation, then i think this will be the best one. I think to change icons at runtime, there is one 'tweak' (Just thought about while writing this message), that is, stop and start it again. I believe it should work. Will test now.
But ***** from me. Since this is really best effort. Good Luck Sameers
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
hi, yes it is a great control,but there is a problem about the contextmenu, when I create a richTextBox and add contextMenu but I can'nt find the image icon in the menu. wo can help me?
|
| Sign In·View Thread·PermaLink | 1.00/5 (2 votes) |
|
|
|
 |
|
 |
All in all this is a great control, so first let me say well done.
But as the title of the thread suggests I have found a bug, that I am at a loss to explain.
I have placed the Menu control as the MainMenu for an MDI parent form, when this form loads it loads references to all the MDI children (via reflection) (each MDI child is in its own class library). When I open 2 mdi children and then close them the MainMenu seems to self destruct.
I know self destruct is a poor explanation so this is what basically happens. When the second MDI child is closed all text from the MainMenu disappears. If I click on now empty MainMenu it does popup the sub menus but these have no text. If I click where there should be an entry the request event is fired and the MainMenu suddenly gets its items back.
Does anybody know what could be causing this, as it would be a real shame to have to drop the component for this.
EDIT: I am quite confident that it is the control causing this as if I put a "return;" at the top of the Start(...) function (effectively disabling the control) I do not get this bug
EDIT 2 As a test I created a simple test app that doesnt do any of that fancy reflection loading. A simple project with 2 forms: an MDI parent and an MDI child. Both forms have MainMenus on them one of the MenuItems on the parent shows the child form. If I launch a single child form I can open and close to my hearts content, if I open 2 child forms, when i close them both the MainMenu disappears as described above. If I remove the MainMenu component from the child MDI form the problem disappears. I am fairly confident that this has something to do with the redraws but at the moment I am at a loss to explain it.
EDIT 3 A little more investigation has found that if I have an MdiList MenuItem, this is still visible when all other menu components disappear. On a side note there is still the bug as described in the post "Using MdiList in Menu" where the MdiList menu items are not rendered with the MSO 2K3 style.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
I am trying to make this work with context menues, but I had no success so far.
I have one main form with regula top menues, and that is OK, Office Menues work. I have a listview on the main form with one context menu, and this menu doesn't have a office look, as it could be expected. And I have one more form with one more listview, and that control also have context menu, and this one is also without office look. How to make this control to work with both of the context menus? Should I start control on every form separatly or not?
Millan
-- modified at 18:26 Sunday 9th October, 2005
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
You have to change the Call in file 'officeMenus.cs'
There is a code in which all Controls of the form will be enumerated. But this methode has to be called recursive.
In the Methode 'Start' in file 'officeMenus.cs' replace the call with this Methode
this.InitContextMenues(form.Controls);
I don't know the exact Position in Source file. Sorry.
Here is the Code for the Methode InitContextMenues: private void InitContextMenues (Control.ControlCollection yControls) { foreach ( Control c in yControls ) { this.InitContextMenues(c.Controls);
if ( c.ContextMenu != null ) InitMenuItem(c.ContextMenu); } } }
Don't forget to do so for the Unlink (End) Methode!!!
Hope it helps! And sorry for my bad English
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
 |
I want to use mouse to choose a object on display( use to move a object or edit it). But i don't write code. Can you show me a way to write code? Thank you very much.
thanhvu
|
| Sign In·View Thread·PermaLink | 1.00/5 (2 votes) |
|
|
|
 |
|
|
 |
|
 |
The line separator is actually drawn. The problem is, it may have the same color as your menu-background.
This line draws the separator: e.Graphics.DrawLine (new Pen (Globals.MenuLightColor), e.Bounds.X + Globals.PIC_AREA_SIZE + 3, e.Bounds.Y + 2, e.Bounds.Width - 2, e.Bounds.Y + 2);
Definition of MenuLightColor: public static Color MenuLightColor = Color.FromKnownColor (KnownColor.InactiveCaption);
Definition of MenuBackgroundColor: public static Color MenuBgColor = Color.White;
If your DesktopTheme sets KnownColor.InactiveCaption to a value close to Color.White (XP Silver Theme for example), you won't see the separator.
Simply change the color in your desktoptheme or inside the drawing code.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi!
How could I use the OfficeMenu-Control in my MDI-Application. It works with the normal menu but when I insert a menuitem with MdiList = true to list the forms which are open, it don't get the Office 2003 style for this list.
Is there a possibility to use this control?
CU Jens
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
 |
Hello,
Thanks for this control.
The shortcut key information does not have "+" as the separator. For example: CTRL+N is shown as CTRLN.
Is there a way to correct this?
Regards, Vedavyas K.P
Your Anger is a Gift
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Yes, I had the same problem.
In the DrawShortCutText method, add this line: string shortcut= TypeDescriptor.GetConverter(typeof(Keys)).ConvertToString((Keys)mi.Shortcut);
and change all occurences of mi.Shortcut.ToString() to shortcut
Best regards, Balder
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
First of all, I have to say, that this article whas exactly what I was looking for. I have strange problem. I cannot se any ContextMenus with Office2003 look only in sample project form (note that i added control recursion from previous threads). But when I made nearly the same simple form, both wint MainMenu and ContextMenu, only MainMenu had expected office look Please can anyone help me or got similar problems?
Many thanks,
tgrk | www.wiso.cz
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I was blind. My problem was that I forgot to do following line of code in Component Init section:
this.ContextMenu = this.contextListSections;
Ugh
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I've been trying to find a solution to adding icon support to a context menu that is to be used in conjunction with a notify icon in the system tray. However, each one I try works fine on a form but when associated with the notify icon, the images are not displayed and nor is the text!!!
Can anyone tell me why this is the case and if there is a way around this bug?
Thanks,
Alex
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
 |
Hi, just make the InitMenuItem public and add manually e.g: OfficeMenus1.InitMenuItem(cmNotifyIcon);
cmNotifyIcon is then the contectmenu of the NotifyIcon.
Best regards, Balder
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I'm writing a multi-language program and tried several menu styles.
Every owner drawn main menu has a major bug, for which I couldn't find a solution yet. 
Try it. Just add an long menu name and change it with i.e. a button click to a shorter one. You'll see that the width of the first assigned menuitem will be used. Looks very discusting and doesn't appear with the standard menu.
Does anyone have a hint or suggestion that leads to solution?
Thanks in advance.
Joerg Kaumanns
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hello. I'm experiencing the same problem. Using variuos size menu items which can change on item click. After menu items text becomes longer or shotter than previous, width of menu item doesn't change. Application doesn't enter measure item event handler. Still looking for solution, any help appreciated.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I wrote a workaround with stopping the extended menus, changing the text and restarting the menu. Not really nice but time was running short.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
To add the hotkey when you prefix a leffer by '&' -------------------------------------------------
add this line code : sf.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.Show; after this line code: sf.Alignment = StringAlignment.Center; in the DrawMenuItem method of MainMenuItemDrawing class and DrawMenuText Method of MenuItemDrawing class
Gavray F.
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
 |
Hi,
The above code only fix the hotkey for the main menu like &file The menu item under File menu like New, Open, Close does not show the hotkey. Please advice if you know the solution Tx
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
 |
I edited the Function for Menu-Drawing to this:
public static void DrawMenuItem (System.Windows.Forms.DrawItemEventArgs e, MenuItem mi) { // Drawing rect holen Rectangle rect = new Rectangle (e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height -1);
// Check the state of the menuItem if ((e.State & DrawItemState.HotLight) == DrawItemState.HotLight) { // Draw Hover rectangle DrawHoverRect (e, mi); } else if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { // Draw selection rectangle DrawSelectionRect (e, mi); } else { // if no selection, just draw space e.Graphics.FillRectangle (new SolidBrush (Globals.MainColor), rect); e.Graphics.DrawRectangle (new Pen (Globals.MainColor), rect); } // Create stringFormat object with Line Alignment to Center and Stringalignment to Left StringFormat sf = new StringFormat(); sf.LineAlignment = StringAlignment.Center; sf.Alignment = StringAlignment.Near;
// Draw the text SolidBrush textBrush = new SolidBrush (Globals.TextColor);
string miText = mi.Text.Replace ("&", ""); int pos = mi.Text.IndexOf ('&'); if (pos == -1) { e.Graphics.DrawString (miText, Globals.menuFont, textBrush, rect, sf); } else { RectangleF rectF = new RectangleF (rect.X, rect.Y, rect.Width, rect.Height); StringFormat sfmt = StringFormat.GenericTypographic; sfmt.Alignment = sf.Alignment;
// underline the letter which has '&' in Front string startText = mi.Text.Substring (0, pos); if (startText.Length > 0) { e.Graphics.DrawString (startText, Globals.menuFont, textBrush, rectF, sf); SizeF size = e.Graphics.MeasureString (startText, Globals.menuFont, new PointF (rectF.X, rectF.Y), sfmt); // , new SizeF (rect.Width, rect.Height), sf rectF = new RectangleF (rectF.X + size.Width, rectF.Y, rectF.Width - size.Width, rectF.Height); } Font f = new Font (Globals.menuFont, FontStyle.Underline); string medString = mi.Text.Substring (pos + 1, 1); e.Graphics.DrawString (medString, f, textBrush, rectF, sf); SizeF size2 = e.Graphics.MeasureString (medString, Globals.menuFont, new PointF (rectF.X, rectF.Y), sfmt); // , new SizeF (rect.Width, rect.Height), sf rectF = new RectangleF (rectF.X + size2.Width, rectF.Y, rectF.Width - size2.Width, rectF.Height); e.Graphics.DrawString (mi.Text.Substring (pos + 2), Globals.menuFont, textBrush, rectF, sf); } }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |