IHelpServiceとは? わかりやすく解説

IHelpService インターフェイス

デザイン時にヘルプ トピック表示しヘルプ キーワードの追加削除を行うためのメソッド提供します

名前空間: System.ComponentModel.Design
アセンブリ: System (system.dll 内)
構文構文

public interface IHelpService
public interface class IHelpService
public interface IHelpService
public interface IHelpService
解説解説

デザイン環境には、ユーザーが F1 キー押したときに関連するヘルプ トピック検索するヘルプ システム用意されています。このヘルプ システムは、ヘルプ要求され場合関連するトピック指定するために使用する現在のコンテキスト キーワードセット維持します。既定では、キーワードはデザイン環境選択されクラス オブジェクトオブジェクトプロパティ関連付けられます。コンポーネントプロパティ既定のキーワードは、そのクラスプロパティの完全修飾名です。また特定のキーワードは、複数オブジェクト選択されたときなど、特定のモードにも関連付けられています。カスタム ヘルプ コレクション外部ヘルプ プロバイダ対応して構成されデザイン環境統合されている場合ドキュメント プロバイダは、特定のコンポーネントクラスプロパティトピックを、その項目の完全修型名や完全修メンバ名で構成されたキーワードに関連付けることができます

IHelpService使用すると、ShowHelpFromKeyword メソッド使用して指定したキーワードでヘルプ サービス呼び出したり、ShowHelpFromUrl メソッド使用して指定した URL からヘルプ トピック呼び出すことができます

また IHelpService使用してデザイン時にヘルプ キーワードの追加削除を行うこともできますデザイン時にコンポーネントプロパティ選択すると、選択対象の完全修型名や完全修メンバ名で構成され既定目次キーワードが設定され以前選択されていた (もう選択されていない) コンポーネントプロパティのキーワードは削除されます。

ヘルプ システムは、カスタム ヘルプ キーワードを自動的に削除しないため、使用しなくなったカスタム キーワードは明示的に削除する必要があります。ISelectionService インターフェイス定義されるイベント監視すると、コンポーネント選択状態が変更されるタイミング判断できます。これらのイベント基づいてコンポーネント選択されたときにそのコンポーネントヘルプ コンテキスト属性追加し選択内容からコンポーネント外されたときにヘルプ コンテキスト属性削除できます

使用例使用例

IHelpService使用して該当するコントロールヘルプ コンテキスト属性追加削除を行うコード例次に示します。この例を使用するには、クラス ライブラリコンパイルし、コントロールインスタンスForm追加する必要がありますデザイン ビューで、コンポーネント選択し、F1 キーを押すと、現在のヘルプ コンテキスト キーワード基づいて関連するヘルプ トピック検索されます。コンポーネント右クリックすると、Add IHelpService Help KeywordRemove IHelpService Help Keyword の名前の付いた 2 つカスタム DesignerVerb コマンドを含むショートカット メニュー表示されます。これらのコマンド使用して、F1 キー押したときに IHelpService トピック表示する値 "IHelpService" のヘルプ コンテキスト キーワード追加削除を行うことができます

Imports System
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Drawing
Imports System.IO
Imports System.Windows.Forms
Imports System.Windows.Forms.Design

Namespace IHelpServiceSample

    Public Class HelpDesigner
        Inherits System.Windows.Forms.Design.ControlDesigner

        Public Sub New()
        End Sub 'New

        Public Overrides ReadOnly
 Property Verbs() As System.ComponentModel.Design.DesignerVerbCollection
            Get
                Return New DesignerVerbCollection(New
 DesignerVerb() {New DesignerVerb("Add IHelpService Help Keyword",
 AddressOf Me.addKeyword), New DesignerVerb("Remove IHelpService Help Keyword", AddressOf
 Me.removeKeyword)})
            End Get
        End Property

        Private Sub addKeyword(ByVal
 sender As Object, ByVal
 e As EventArgs)
            Dim hs As IHelpService = CType(Me.Control.Site.GetService(GetType(IHelpService)),
 IHelpService)
            hs.AddContextAttribute("keyword", "IHelpService",
 HelpKeywordType.F1Keyword)
        End Sub 'addKeyword

        Private Sub removeKeyword(ByVal
 sender As Object, ByVal
 e As EventArgs)
            Dim hs As IHelpService = CType(Me.Control.Site.GetService(GetType(IHelpService)),
 IHelpService)
            hs.RemoveContextAttribute("keyword", "IHelpService")
        End Sub 'removeKeyword
    End Class 'HelpDesigner

    <Designer(GetType(HelpDesigner))> _
    Public Class HelpTestControl
        Inherits System.Windows.Forms.UserControl

        Public Sub New()
            Me.Size = New Size(320, 100)
            Me.BackColor = Color.White
        End Sub 'New

        Protected Overrides Sub
 OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
            Dim brush As New
 SolidBrush(Color.Blue)
            e.Graphics.DrawString("IHelpService Example Designer
 Control", New Font(FontFamily.GenericMonospace,
 10), brush, 5, 5)
            e.Graphics.DrawString("Right-click this component
 for", New Font(FontFamily.GenericMonospace, 8),
 brush, 5, 25)
            e.Graphics.DrawString("add/remove Help context keyword
 commands.", New Font(FontFamily.GenericMonospace,
 8), brush, 5, 35)
            e.Graphics.DrawString("Press F1 while this component
 is", New Font(FontFamily.GenericMonospace, 8), brush,
 5, 55)
            e.Graphics.DrawString("selected to raise Help topics
 for", New Font(FontFamily.GenericMonospace, 8),
 brush, 5, 65)
            e.Graphics.DrawString("the current keyword or keywords",
 New Font(FontFamily.GenericMonospace, 8), brush, 5, 75)
        End Sub 'OnPaint
    End Class 'HelpTestControl
End Namespace 'IHelpServiceSample
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.Windows.Forms.Design;

namespace IHelpServiceSample
{
    public class HelpDesigner : System.Windows.Forms.Design.ControlDesigner
    {
        public HelpDesigner()
        {            
        }

        public override System.ComponentModel.Design.DesignerVerbCollection
 Verbs
        {
            get
            {
                return new DesignerVerbCollection(
 new DesignerVerb[] { 
                        new DesignerVerb("Add IHelpService
 Help Keyword", new EventHandler(this.addKeyword))
,
                        new DesignerVerb("Remove IHelpService
 Help Keyword", new EventHandler(this.removeKeyword))
                } );
            }
        }
        
        private void addKeyword(object sender,
 EventArgs e)
        {
            IHelpService hs = (IHelpService) this.Control.Site.GetService(typeof(IHelpService));
            
            hs.AddContextAttribute("keyword", "IHelpService",
 HelpKeywordType.F1Keyword);    
        }
        
        private void removeKeyword(object sender,
 EventArgs e)
        {
            IHelpService hs = (IHelpService) this.Control.Site.GetService(typeof(IHelpService));
            
            hs.RemoveContextAttribute("keyword", "IHelpService");
        }
    }

    [Designer(typeof(HelpDesigner))]
    public class HelpTestControl : System.Windows.Forms.UserControl
    {
        public HelpTestControl()
        {
            this.Size = new Size(320, 100);
            this.BackColor = Color.White;
        }

        protected override void OnPaint(System.Windows.Forms.PaintEventArgs
 e)
        {            
            Brush brush = new SolidBrush(Color.Blue);
            e.Graphics.DrawString("IHelpService Example Designer Control",
 new Font( FontFamily.GenericMonospace, 10 ), brush, 5, 5);
            e.Graphics.DrawString("Right-click this component
 for", new Font( FontFamily.GenericMonospace,
 8 ), brush, 5, 25);
            e.Graphics.DrawString("add/remove Help context keyword commands.",
 new Font( FontFamily.GenericMonospace, 8 ), brush, 5, 35); 
           
            e.Graphics.DrawString("Press F1 while this
 component is", new Font( FontFamily.GenericMonospace, 8
 ), brush, 5, 55);
            e.Graphics.DrawString("selected to raise Help topics for",
 new Font( FontFamily.GenericMonospace, 8 ), brush, 5, 65); 
           
            e.Graphics.DrawString("the current keyword or keywords", new
 Font( FontFamily.GenericMonospace, 8 ), brush, 5, 75);            
        }        
    }
}
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
#using <System.Design.dll>
#using <System.dll>

using namespace System;
using namespace System::ComponentModel;
using namespace System::ComponentModel::Design;
using namespace System::Drawing;
using namespace System::IO;
using namespace System::Windows::Forms;
using namespace System::Windows::Forms::Design;

public ref class HelpDesigner: public
 System::Windows::Forms::Design::ControlDesigner
{
public:
   HelpDesigner(){}

   property System::ComponentModel::Design::DesignerVerbCollection^ Verbs 
   {
      virtual System::ComponentModel::Design::DesignerVerbCollection^ get()
 override
      {
         array<DesignerVerb^>^temp0 = {gcnew DesignerVerb( "Add IHelpService
 Help Keyword",gcnew EventHandler( this, &HelpDesigner::addKeyword
 ) ),gcnew DesignerVerb( "Remove IHelpService Help Keyword",gcnew EventHandler( this, &HelpDesigner::removeKeyword ) )};
         return gcnew DesignerVerbCollection( temp0 );
      }
   }

private:
   void addKeyword( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      IHelpService^ hs = dynamic_cast<IHelpService^>(this->Control->Site->GetService(
 IHelpService::typeid ));
      hs->AddContextAttribute( "keyword", "IHelpService",
 HelpKeywordType::F1Keyword );
   }

   void removeKeyword( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      IHelpService^ hs = dynamic_cast<IHelpService^>(this->Control->Site->GetService(
 IHelpService::typeid ));
      hs->RemoveContextAttribute( "keyword", "IHelpService"
 );
   }
};


[Designer(HelpDesigner::typeid)]
public ref class HelpTestControl: public
 System::Windows::Forms::UserControl
{
public:
   HelpTestControl()
   {
      this->Size = System::Drawing::Size( 320, 100 );
      this->BackColor = Color::White;
   }

protected:
   virtual void OnPaint( System::Windows::Forms::PaintEventArgs^
 e ) override
   {
      Brush^ brush = gcnew SolidBrush( Color::Blue );
      e->Graphics->DrawString( "IHelpService Example Designer Control",
 gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), brush, 5, 5 );
      e->Graphics->DrawString( "Right-click this component
 for", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8
 ), brush, 5, 25 );
      e->Graphics->DrawString( "add/remove Help context keyword commands.",
 gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), brush, 5, 35 );
      e->Graphics->DrawString( "Press F1 while this
 component is", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8
 ), brush, 5, 55 );
      e->Graphics->DrawString( "selected to raise Help topics for",
 gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), brush, 5, 65 );
      e->Graphics->DrawString( "the current keyword or keywords",
 gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), brush, 5, 75 );
   }
};
package IHelpServiceSample; 
import System.*;
import System.ComponentModel.*;
import System.ComponentModel.Design.*;
import System.Drawing.*;
import System.IO.*;
import System.Windows.Forms.*;
import System.Windows.Forms.Design.*;

public class HelpDesigner extends System.Windows.Forms.Design.ControlDesigner
{
    public HelpDesigner()
    {
    } //HelpDesigner

    /** @property 
     */
    public System.ComponentModel.Design.DesignerVerbCollection
 get_Verbs()
    {
        return new DesignerVerbCollection(new
 DesignerVerb[] { 
            new DesignerVerb("Add IHelpService Help Keyword",
 
            new EventHandler(this.AddKeyword)),
 new DesignerVerb(
            "Remove IHelpService Help Keyword", new
 EventHandler(
            this.RemoveKeyword)) });
    } //get_Verbs

    private void AddKeyword(Object sender,
 EventArgs e)
    {
        IHelpService hs = (IHelpService)(this.get_Control().get_Site().
            GetService(IHelpService.class.ToType()));
        hs.AddContextAttribute("keyword", "IHelpService", 
            HelpKeywordType.F1Keyword);
    } //AddKeyword

    private void RemoveKeyword(Object sender,
 EventArgs e)
    {
        IHelpService hs = (IHelpService)(this.get_Control().get_Site().
            GetService(IHelpService.class.ToType()));
        hs.RemoveContextAttribute("keyword", "IHelpService");
    } //RemoveKeyword
} //HelpDesigner

/** @attribute Designer(HelpDesigner.class)
 */
public class HelpTestControl extends System.Windows.Forms.UserControl
{
    public HelpTestControl()
    {
        this.set_Size(new Size(320, 100));
        this.set_BackColor(Color.get_White());
    } //HelpTestControl

    protected void OnPaint(System.Windows.Forms.PaintEventArgs
 e)
    {
        Brush brush = new SolidBrush(Color.get_Blue());

        e.get_Graphics().DrawString("IHelpService Example Designer Control"
,
            new Font(FontFamily.get_GenericMonospace(), 10), brush,
 5, 5);
        e.get_Graphics().DrawString("Right-click this component
 for", 
            new Font(FontFamily.get_GenericMonospace(), 8), brush,
 5, 25);
        e.get_Graphics().DrawString("add/remove Help context keyword commands."
,
            new Font(FontFamily.get_GenericMonospace(), 8), brush,
 5, 35);
        e.get_Graphics().DrawString("Press F1 while this
 component is", 
            new Font(FontFamily.get_GenericMonospace(), 8), brush,
 5, 55);
        e.get_Graphics().DrawString("selected to raise Help topics for",
 
            new Font(FontFamily.get_GenericMonospace(), 8), brush,
 5, 65);
        e.get_Graphics().DrawString("the current keyword or keywords",
 
            new Font(FontFamily.get_GenericMonospace(), 8), brush,
 5, 75);
    } //OnPaint
} //HelpTestControl
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IHelpService メンバ
System.ComponentModel.Design 名前空間
HelpKeywordType 列挙
HelpContextType 列挙

IHelpService メソッド


パブリック メソッドパブリック メソッド

  名前 説明
パブリック メソッド AddContextAttribute コンテキスト属性ドキュメント追加します
パブリック メソッド ClearContextAttributes ドキュメントから既存コンテキスト属性をすべて削除します
パブリック メソッド CreateLocalContext ローカル IHelpService を作成し、サブコンテキストを管理します
パブリック メソッド RemoveContextAttribute 以前追加したコンテキスト属性削除します
パブリック メソッド RemoveLocalContext CreateLocalContext を使用して作成したコンテキスト削除します
パブリック メソッド ShowHelpFromKeyword 指定したキーワードに対応するヘルプ トピック表示します
パブリック メソッド ShowHelpFromUrl 指定した URL対応するヘルプ トピック表示します
参照参照

関連項目

IHelpService インターフェイス
System.ComponentModel.Design 名前空間
HelpKeywordType 列挙
HelpContextType 列挙

IHelpService メンバ

デザイン時にヘルプ トピック表示しヘルプ キーワードの追加削除を行うためのメソッド提供します

IHelpService データ型公開されるメンバを以下の表に示します


パブリック メソッドパブリック メソッド
  名前 説明
パブリック メソッド AddContextAttribute コンテキスト属性ドキュメント追加します
パブリック メソッド ClearContextAttributes ドキュメントから既存コンテキスト属性をすべて削除します
パブリック メソッド CreateLocalContext ローカル IHelpService を作成し、サブコンテキストを管理します
パブリック メソッド RemoveContextAttribute 以前追加したコンテキスト属性削除します
パブリック メソッド RemoveLocalContext CreateLocalContext を使用して作成したコンテキスト削除します
パブリック メソッド ShowHelpFromKeyword 指定したキーワードに対応するヘルプ トピック表示します
パブリック メソッド ShowHelpFromUrl 指定した URL対応するヘルプ トピック表示します
参照参照

関連項目

IHelpService インターフェイス
System.ComponentModel.Design 名前空間
HelpKeywordType 列挙
HelpContextType 列挙


このページでは「.NET Framework クラス ライブラリ リファレンス」からIHelpServiceを検索した結果を表示しています。
Weblioに収録されているすべての辞書からIHelpServiceを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からIHelpService を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「IHelpService」の関連用語

IHelpServiceのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



IHelpServiceのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS