IHelpService 인터페이스

정의

디자인 타임에 도움말 항목을 표시하고 도움말 키워드를 추가하고 제거하는 메서드를 제공합니다.

public interface class IHelpService
public interface IHelpService
type IHelpService = interface
Public Interface IHelpService

예제

다음 예제에서는 사용 하는 디자이너를 추가 IHelpService 하 고 포함 된 컨트롤에 대 한 도움말 컨텍스트 특성을 제거 합니다. 이 샘플을 사용하려면 클래스 라이브러리에 컴파일하고 컨트롤Form의 instance 에 추가합니다. 디자인 보기에서 구성 요소를 선택하고 F1 키를 누르면 현재 도움말 컨텍스트 키워드(keyword) 또는 키워드를 기반으로 관련 도움말 topics 조회하려고 시도합니다. 구성 요소를 마우스 오른쪽 단추로 클릭하면 및 Remove IHelpService Help Keyword라는 Add IHelpService Help Keyword 두 개의 사용자 지정 DesignerVerb 명령을 포함하여 바로 가기 메뉴에 명령이 표시됩니다. 이러한 명령을 사용하여 F1 키를 누를 때 토픽을 발생 IHelpService 시키려는 "IHelpService" 값의 키워드(keyword) 도움말 컨텍스트를 추가하거나 제거할 수 있습니다.

#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 );
   }
};
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);			
        }		
    }
}
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

        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

        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
    End Class

    <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

        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
    End Class
End Namespace 'IHelpServiceSample

설명

디자인 타임 환경은 사용자가 F1 키를 누를 때 표시할 관련 도움말 topics 찾으려고 시도하는 도움말 시스템을 제공합니다. 도움말 시스템은 도움말이 요청된 경우 관련 topics 식별하는 데 사용되는 현재 컨텍스트 키워드 집합을 유지 관리합니다. 기본적으로 키워드는 디자인 타임 환경에서 선택한 클래스 개체 및 개체의 속성과 연결됩니다. 구성 요소 또는 속성의 기본 키워드(keyword) 정규화된 클래스 또는 속성 이름입니다. 특정 키워드는 여러 개체가 선택된 경우와 같은 특정 모드와도 연결됩니다. 사용자 지정 도움말 컬렉션이 외부 도움말 공급자에 대해 구성하여 디자인 타임 환경과 통합되는 경우 설명서 공급자는 특정 구성 요소 클래스 또는 속성에 대한 토픽을 항목의 정규화된 형식 또는 멤버 이름으로 구성된 키워드(keyword) 연결할 수 있습니다.

IHelpService 메서드를 사용하여 지정된 키워드(keyword) 도움말 서비스를 호출하거나 메서드를 사용하여 ShowHelpFromKeywordShowHelpFromUrl 지정된 URL에서 도움말 항목을 호출하는 데 사용할 수 있습니다.

디자인 타임에 도움말 IHelpService 키워드를 추가하거나 제거하는 데 를 사용할 수도 있습니다. 디자인 타임에 구성 요소 또는 속성을 선택하면 선택 영역의 정규화된 형식 또는 멤버 이름으로 구성된 기본 컨텍스트 키워드(keyword) 설정되고 이전에 선택한 구성 요소 또는 속성이 더 이상 선택되지 않은 키워드를 제거합니다.

도움말 시스템은 사용자 지정 도움말 키워드를 자동으로 제거하지 않으므로 더 이상 적용되지 않을 때 사용자 지정 키워드(keyword) 명시적으로 제거해야 합니다. 인터페이스에서 정의한 ISelectionService 이벤트를 모니터링하여 구성 요소 선택이 변경되는 시기를 확인할 수 있습니다. 이러한 이벤트에 따라 구성 요소를 선택할 때 구성 요소에 대한 도움말 컨텍스트 특성을 추가한 다음 선택 영역에 구성 요소가 더 이상 포함되어 있지 않으면 도움말 컨텍스트 특성을 제거할 수 있습니다.

메서드

AddContextAttribute(String, String, HelpKeywordType)

컨텍스트 특성을 문서에 추가합니다.

ClearContextAttributes()

모든 기존 컨텍스트 특성을 문서에서 제거합니다.

CreateLocalContext(HelpContextType)

하위 컨텍스트를 관리하는 로컬 IHelpService를 만듭니다.

RemoveContextAttribute(String, String)

이전에 추가된 컨텍스트 특성을 제거합니다.

RemoveLocalContext(IHelpService)

CreateLocalContext(HelpContextType)으로 만들어진 컨텍스트를 제거합니다.

ShowHelpFromKeyword(String)

지정된 키에 일치하는 도움말 항목을 나타냅니다.

ShowHelpFromUrl(String)

지정된 URL에 해당하는 도움말 항목을 표시합니다.

적용 대상

추가 정보