示例#1
0
        private void InitializeTocControl()
        {
            if (Help2ControlsValidation.IsTocControlRegistered)
            {
                try
                {
                    tocControl = new AxHxTocCtrl();
                    tocControl.BeginInit();
                    tocControl.Dock            = DockStyle.Fill;
                    tocControl.NodeClick      += new AxMSHelpControls.IHxTreeViewEvents_NodeClickEventHandler(this.TocNodeClick);
                    tocControl.NodeRightClick += new AxMSHelpControls.IHxTreeViewEvents_NodeRightClickEventHandler(TocNodeRightClick);
                    tocControl.EndInit();
                    panTocControl.Controls.Add(tocControl);
                    tocControl.Parent = panTocControl;
                    tocControl.CreateControl();

                    tocControl.Visible     = false;
                    tocControl.BorderStyle = HxBorderStyle.HxBorderStyle_FixedSingle;
                    tocControl.FontSource  = HxFontSourceConstant.HxFontExternal;
                    tocControl.TreeStyle   = (HtmlHelp2Environment.Config.TocPictures) ? TSC.HxTreeStyle_TreelinesPlusMinusPictureText : TSC.HxTreeStyle_TreelinesPlusMinusText;
                }
                catch (System.Runtime.InteropServices.COMException cEx)
                {
                    LoggingService.Error("Help 2.0: TOC control failed: " + cEx.ToString());
                    this.tocControlFailed = true;
                }
            }
        }
示例#2
0
        private void InitializeComponents()
        {
            infoLabel.Dock      = DockStyle.Fill;
            infoLabel.Visible   = false;
            infoLabel.TextAlign = ContentAlignment.MiddleCenter;
            Controls.Add(infoLabel);

            if (Help2ControlsValidation.IsTocControlRegistered)
            {
                try
                {
                    tocControl = new AxHxTocCtrl();
                    tocControl.BeginInit();
                    tocControl.Dock       = DockStyle.Fill;
                    tocControl.NodeClick +=
                        new AxMSHelpControls.IHxTreeViewEvents_NodeClickEventHandler(this.TocNodeClick);
                    tocControl.NodeRightClick +=
                        new AxMSHelpControls.IHxTreeViewEvents_NodeRightClickEventHandler(TocNodeRightClick);
                    tocControl.EndInit();
                    Controls.Add(tocControl);
                    tocControl.CreateControl();

                    tocControl.Visible     = false;
                    tocControl.BorderStyle = HxBorderStyle.HxBorderStyle_FixedSingle;
                    tocControl.FontSource  = HxFontSourceConstant.HxFontExternal;
                    tocControl.TreeStyle   =
                        (HtmlHelp2Environment.Config.TocPictures)?TSC.HxTreeStyle_TreelinesPlusMinusPictureText:TSC.HxTreeStyle_TreelinesPlusMinusText;

                    printTopic.Image        = ResourcesHelper.GetBitmap("HtmlHelp2.16x16.Print.bmp");
                    printTopic.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
                    printTopic.Text         = StringParser.Parse("${res:AddIns.HtmlHelp2.PrintTopic}");
                    printTopic.Click       += new EventHandler(this.PrintTopic);
                    printContextMenu.Items.Add(printTopic);

                    printTopicAndSubTopics.Text   = StringParser.Parse("${res:AddIns.HtmlHelp2.PrintSubtopics}");
                    printTopicAndSubTopics.Click += new EventHandler(this.PrintTopicAndSubTopics);
                    printContextMenu.Items.Add(printTopicAndSubTopics);
                }
                catch (System.Runtime.InteropServices.COMException cEx)
                {
                    LoggingService.Error("Help 2.0: TOC control failed: " + cEx.ToString());
                    this.tocControlFailed = true;
                }
            }

            Panel panel1 = new Panel();

            Controls.Add(panel1);
            panel1.Dock   = DockStyle.Top;
            panel1.Height = filterCombobox.Height + 7;

            panel1.Controls.Add(filterCombobox);
            filterCombobox.Dock                  = DockStyle.Top;
            filterCombobox.DropDownStyle         = ComboBoxStyle.DropDownList;
            filterCombobox.Sorted                = true;
            filterCombobox.Enabled               = false;
            filterCombobox.Font                  = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            filterCombobox.SelectedIndexChanged += new EventHandler(this.FilterChanged);

            Controls.Add(label1);
            label1.Dock      = DockStyle.Top;
            label1.TextAlign = ContentAlignment.MiddleLeft;
            label1.Font      = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.RedrawContent();

            this.tocControlFailed = (this.tocControlFailed || tocControl == null);
        }