コード例 #1
0
        /// <summary>
        ///  This function is called on the service when the PBRSFORWARD gets the first WM_CHAR message.
        /// </summary>
        public void HandleKeyChar()
        {
            if (_toolDesigner != null || _toolItemDesigner != null)
            {
                if (_toolDesigner != null)
                {
                    _toolDesigner.ShowEditNode(false);
                }
                else if (_toolItemDesigner != null)
                {
                    if (_toolItemDesigner is ToolStripMenuItemDesigner menuDesigner)
                    {
                        ISelectionService selService = (ISelectionService)_sp.GetService(typeof(ISelectionService));
                        if (selService != null)
                        {
                            object comp = selService.PrimarySelection;
                            if (comp is null)
                            {
                                comp = ToolStripKeyBoardService.SelectedDesignerControl;
                            }

                            DesignerToolStripControlHost designerItem = comp as DesignerToolStripControlHost;
                            if (designerItem != null || comp is ToolStripDropDown)
                            {
                                menuDesigner.EditTemplateNode(false);
                            }
                            else
                            {
                                menuDesigner.ShowEditNode(false);
                            }
                        }
                    }
                    else
                    {
                        _toolItemDesigner.ShowEditNode(false);
                    }
                }
            }
        }