If(e.DoubleClick || e.Button = MouseButtons.Right) Private void callback_MouseDown(object sender, StatusBarMouseDownEventArgs e) Void menu_Settings_Click (object sender, EventArgs e) Void menu_OnoFF_MouseClick (object sender, EventArgs e) _pane.Icon = newstate ? iconLoggerON : iconLoggerOff Private void LoggerStatus_Update(object sender, EventArgs e, bool newstate) String _ResourcePath = Path.Combine(new FileInfo(_dllPath).Directory.FullName, "Images") String _dllPath = typeof(LoggerPane).Assembly.Location menu_settings.Click += menu_Settings_Click Better suited for handeling current checked status. TODO: remove checked initializing to OnPopUp. _ti.MouseDown += new StatusBarMouseDownEventHandler(callback_MouseDown) _ti.ToolTipText = "Autocad DWG\n Logger" _ti.Icon = _On ? iconLoggerON : iconLoggerOff _pane.MouseDown += new StatusBarMouseDownEventHandler(callback_MouseDown) _pane.ToolTipText = "Autocad DWG\n Logger" ![]() _pane.Icon = _On ? iconLoggerON: iconLoggerOff += new LoggerStatusEventHandler(LoggerStatus_Update) Private Pane _pane // not using this at the moment I was hoping there was some small tidbit of understanding I missed or acknowledgement of a bug with this in civil3d 2015. All worked but just can't get the context menu to fire. Created custom implementation of menuitems with my own events. Other code I have tried include using StartusBar.MenuItem Controls.Context menu instead of. It all works as expected with using either a Pane added to the status bar or the Tray Item. It went through a hatchet job with hours of abuse trying many different methods not shown below. But no matter how I add a context menu to anything, the click event will not fire. It looks like every example I found from many sources. Yes, I agree, I saw it and said the same thing. If you add the menu items to the context menu and set their Click handler, the click event should fire. So, I don't know if anyone can help you without seeing your exact code attempt. I know you said you're using the exact code posted here, but after looking at it, there doesn't seem to be any problems with that code. I am currently building and testing on civil3d 2015. I have even implemented a custom item implementing a click event and still can not get it to fire. I am at a total loss for getting it to work. Neither the Pane nor a Tray Item will allow a click event on the context menu.Ĭurrently I have the exact code posted here and get the same result. I have implemented many different methods for adding the items. Following microsoft support, I made sure not to add any sub menu items which turn off the the click event, yet no success. All works well with the exception that the click event will not fire for any menu items added to the context menu. I doubled back and used the identical code posted here using the tray icon. I have been going a bit crazy lately trying to hook up a context menu to a Pane using the same method outlined in this thread. Void mi_Click2(object sender, EventArgs e) Void mi_Click(object sender, EventArgs e) _ti.Displa圜ontextMenu(m_ContextMenu, Cursor.Position) Void _ti_MouseDown(object sender, StatusBarMouseDownEventArgs e) If anybody knows their way around this area, that would be incredibly stress reducing for me. Secondly, the namespace has it's own menu classes but Displa圜ontextMenu demands a class, so the context menu will not keep the look and feel of AutoCAD. However, it displays it in relation to the origin at top left corner(ish) of the whole status bar, when the StatusBarMouseDownEventArgs X and Y values are in relation to the top left of the TrayItem "window". And it does create and display my context menu with About option. ![]() Which I have found scouring the internet. Displa圜ontextMenu(contextMenu, new Point(e. Private static void TrayItem_MouseDown( object sender, StatusBarMouseDownEventArgs e) I know want it as the source of an AboutBox, which I want via a right-click context menu as is traditional. ![]() viewer.I have created a TrayItem that exists in the StatusBar i use it to notify the user of activity via the the balloon notifications. One is called " Override color of selected elements to the red" which will be shown when some model elements are selected, another is called " Clear overridden color" which will be shown while nothing is selected. Follow couple of customers asked me how to customize the viewer context menu to add extra menu items to the default menu or create their owned menu without default menu items.Īdd new items to the existing context menu is quite easy, Forge viewer allows users add menu items via a simple API function call to register your owned menu items to the context menu. All you need is doing something like the following codes, this code snippet is demonstrating how to add two menu items.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |