Csharp/CSharp Tutorial/GUI Windows Forms/HelpProvider

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Use HelpProvider to Load CHM file

<source lang="csharp">using System; using System.Collections.Generic; using System.ruponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; public class UseHelpProviderToLoadCHMFile : Form {

   public UseHelpProviderToLoadCHMFile()
   {
       this.listBox1 = new System.Windows.Forms.ListBox();
       this.checkBox1 = new System.Windows.Forms.CheckBox();
       this.helpProvider1 = new System.Windows.Forms.HelpProvider();
       this.SuspendLayout();
       this.listBox1.FormattingEnabled = true;
       this.listBox1.Location = new System.Drawing.Point(12, 12);
       this.listBox1.Size = new System.Drawing.Size(155, 134);
       this.checkBox1.AutoSize = true;
       this.helpProvider1.SetHelpNavigator(this.checkBox1, System.Windows.Forms.HelpNavigator.TableOfContents);
       this.checkBox1.Location = new System.Drawing.Point(194, 36);
       this.helpProvider1.SetShowHelp(this.checkBox1, true);
       this.checkBox1.Size = new System.Drawing.Size(80, 17);
       this.checkBox1.UseVisualStyleBackColor = true;
       this.helpProvider1.HelpNamespace = "C:\\YourFile.chm";
       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
       this.ClientSize = new System.Drawing.Size(292, 169);
       this.Controls.Add(this.checkBox1);
       this.Controls.Add(this.listBox1);
       this.helpProvider1.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.TableOfContents);
       this.helpProvider1.SetShowHelp(this, true);
       this.ResumeLayout(false);
       this.PerformLayout();
   }
   [STAThread]
   public static void Main(string[] args)
   {
       Application.Run(new UseHelpProviderToLoadCHMFile());
   }
   private System.Windows.Forms.ListBox listBox1;
   private System.Windows.Forms.CheckBox checkBox1;
   private System.Windows.Forms.HelpProvider helpProvider1;
   

}</source>