StatusBarDrawItemEventArgs 클래스

정의

DrawItem 이벤트에 대한 데이터를 제공합니다.

public ref class StatusBarDrawItemEventArgs : System::Windows::Forms::DrawItemEventArgs
public class StatusBarDrawItemEventArgs : System.Windows.Forms.DrawItemEventArgs
type StatusBarDrawItemEventArgs = class
    inherit DrawItemEventArgs
Public Class StatusBarDrawItemEventArgs
Inherits DrawItemEventArgs
상속
StatusBarDrawItemEventArgs

예제

다음 코드 예제에 사용 하는 방법을 보여 줍니다.는 Style 속성을 StatusBarDrawItemEventHandler 대리자를 StatusBarDrawItemEventArgs 클래스를 StatusBarPanelStyle 열거형 및 StatusBarDrawItemEventArgs.Panel 속성. 예제를 실행 하는 폼에 다음 코드를 붙여넣습니다. 호출 된 InitializeStatusBarPanels 폼의 생성자 또는 Load 메서드.

StatusBar^ StatusBar1;
void InitializeStatusBarPanels()
{
   StatusBar1 = gcnew StatusBar;
   
   // Create two StatusBarPanel objects.
   StatusBarPanel^ panel1 = gcnew StatusBarPanel;
   StatusBarPanel^ panel2 = gcnew StatusBarPanel;
   
   // Set the style of the panels.  
   // panel1 will be owner-drawn.
   panel1->Style = StatusBarPanelStyle::OwnerDraw;
   
   // The panel2 object will be drawn by the operating system.
   panel2->Style = StatusBarPanelStyle::Text;
   
   // Set the text of both panels to the same date string.
   panel1->Text = System::DateTime::Today.ToShortDateString();
   panel2->Text = System::DateTime::Today.ToShortDateString();
   
   // Add both panels to the StatusBar.
   StatusBar1->Panels->Add( panel1 );
   StatusBar1->Panels->Add( panel2 );
   
   // Make panels visible by setting the ShowPanels 
   // property to True.
   StatusBar1->ShowPanels = true;
   
   // Associate the event-handling method with the DrawItem event 
   // for the owner-drawn panel.
   StatusBar1->DrawItem += gcnew StatusBarDrawItemEventHandler( this, &Form1::DrawCustomStatusBarPanel );
   this->Controls->Add( StatusBar1 );
}


// Draw the panel.
void DrawCustomStatusBarPanel( Object^ sender, StatusBarDrawItemEventArgs^ e )
{
   
   // Draw a blue background in the owner-drawn panel.
   e->Graphics->FillRectangle( Brushes::AliceBlue, e->Bounds );
   
   // Create a StringFormat object to align text in the panel.
   StringFormat^ textFormat = gcnew StringFormat;
   
   // Center the text in the middle of the line.
   textFormat->LineAlignment = StringAlignment::Center;
   
   // Align the text to the left.
   textFormat->Alignment = StringAlignment::Far;
   
   // Draw the panel's text in dark blue using the Panel 
   // and Bounds properties of the StatusBarEventArgs object 
   // and the StringFormat object.
   e->Graphics->DrawString( e->Panel->Text, StatusBar1->Font, Brushes::DarkBlue, RectangleF(e->Bounds.X,e->Bounds.Y,e->Bounds.Width,e->Bounds.Height), textFormat );
}
private StatusBar StatusBar1;

private void InitializeStatusBarPanels()
{
    StatusBar1 = new StatusBar();

    // Create two StatusBarPanel objects.
    StatusBarPanel panel1 = new StatusBarPanel();
    StatusBarPanel panel2 = new StatusBarPanel();

    // Set the style of the panels.  
    // panel1 will be owner-drawn.
    panel1.Style = StatusBarPanelStyle.OwnerDraw;

    // The panel2 object will be drawn by the operating system.
    panel2.Style = StatusBarPanelStyle.Text;

    // Set the text of both panels to the same date string.
    panel1.Text = System.DateTime.Today.ToShortDateString();
    panel2.Text = System.DateTime.Today.ToShortDateString();

    // Add both panels to the StatusBar.
    StatusBar1.Panels.Add(panel1);
    StatusBar1.Panels.Add(panel2);

    // Make panels visible by setting the ShowPanels 
    // property to True.
    StatusBar1.ShowPanels = true;

    // Associate the event-handling method with the DrawItem event 
    // for the owner-drawn panel.
    StatusBar1.DrawItem += 
        new StatusBarDrawItemEventHandler(DrawCustomStatusBarPanel);
        
    this.Controls.Add(StatusBar1);
}

// Draw the panel.
private void DrawCustomStatusBarPanel(object sender, 
    StatusBarDrawItemEventArgs e)
{

    // Draw a blue background in the owner-drawn panel.
    e.Graphics.FillRectangle(Brushes.AliceBlue, e.Bounds);

    // Create a StringFormat object to align text in the panel.
    StringFormat textFormat = new StringFormat();

    // Center the text in the middle of the line.
    textFormat.LineAlignment = StringAlignment.Center;

    // Align the text to the left.
    textFormat.Alignment = StringAlignment.Far;

    // Draw the panel's text in dark blue using the Panel 
    // and Bounds properties of the StatusBarEventArgs object 
    // and the StringFormat object.
    e.Graphics.DrawString(e.Panel.Text, StatusBar1.Font, 
        Brushes.DarkBlue, new RectangleF(e.Bounds.X, 
        e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), textFormat);
}
Private StatusBar1 As StatusBar

Private Sub InitializeStatusBarPanels()
    StatusBar1 = New StatusBar

    ' Create two StatusBarPanel objects.
    Dim panel1 As New StatusBarPanel
    Dim panel2 As New StatusBarPanel

    ' Set the style of the panels.  
    ' panel1 will be owner-drawn.
    panel1.Style = StatusBarPanelStyle.OwnerDraw

    ' The panel2 object will be drawn by the operating system.
    panel2.Style = StatusBarPanelStyle.Text

    ' Set the text of both panels to the same date string.
    panel1.Text = DateTime.Today.ToShortDateString()
    panel2.Text = DateTime.Today.ToShortDateString()

    ' Add both panels to the StatusBar.
    StatusBar1.Panels.Add(panel1)
    StatusBar1.Panels.Add(panel2)

    ' Make panels visible by setting the ShowPanels 
    ' property to True.
    StatusBar1.ShowPanels = True

    ' Use the AddHandler syntax to handle the DrawItem event
    ' for the owner-drawn panel.
    AddHandler StatusBar1.DrawItem, _
        New StatusBarDrawItemEventHandler( _
        AddressOf DrawCustomStatusBarPanel)
    Me.Controls.Add(StatusBar1)
End Sub

' Draw the panel.
Private Sub DrawCustomStatusBarPanel(ByVal sender As Object, _
    ByVal e As StatusBarDrawItemEventArgs)

    ' Draw a blue background in the owner-drawn panel.
    e.Graphics.FillRectangle(Brushes.AliceBlue, e.Bounds)

    ' Create a StringFormat object to align text in the panel.
    Dim textFormat As New StringFormat

    ' Center the text in the middle of the line.
    textFormat.LineAlignment = StringAlignment.Center

    ' Align the text to the left.
    textFormat.Alignment = StringAlignment.Far

    ' Draw the panel's text in dark blue using the Panel 
    ' and Bounds properties of the StatusBarEventArgs object 
    ' and the StringFormat object.
    e.Graphics.DrawString(e.Panel.Text, StatusBar1.Font, _
          Brushes.DarkBlue, New RectangleF(e.Bounds.X, e.Bounds.Y, _
          e.Bounds.Width, e.Bounds.Height), textFormat)

End Sub

설명

합니다 DrawItem 이벤트가 발생할 때 소유자가 그린의 시각적 측면이 StatusBarPanel 변경 합니다. StatusBarDrawItemEventArgs 지정 된 Graphics 패널을 그리는 데 사용할 개체를 Rectangle 그릴 패널, 패널 id 번호, 패널 및 패널에 대 한 상태 정보를 그릴 개체. 에 대 한 이벤트 처리기에서이 클래스에서 제공 되는 데이터를 사용할 수는 DrawItem 애플리케이션의 패널 사용자 지정 그리기를 만들 이벤트 StatusBar 제어 합니다.

생성자

StatusBarDrawItemEventArgs(Graphics, Font, Rectangle, Int32, DrawItemState, StatusBarPanel)

StatusBarDrawItemEventArgs의 배경색과 전경색을 지정하지 않고 StatusBarPanel 클래스의 새 인스턴스를 초기화합니다.

StatusBarDrawItemEventArgs(Graphics, Font, Rectangle, Int32, DrawItemState, StatusBarPanel, Color, Color)

StatusBarDrawItemEventArgs의 지정된 배경색 및 전경색을 사용하여 StatusBarPanel 클래스의 새 인스턴스를 초기화합니다.

속성

BackColor

그리고 있는 항목의 배경색을 가져옵니다.

(다음에서 상속됨 DrawItemEventArgs)
Bounds

그리고 있는 항목의 경계를 나타내는 사각형을 가져옵니다.

(다음에서 상속됨 DrawItemEventArgs)
Font

그리는 항목에 할당되는 글꼴을 가져옵니다.

(다음에서 상속됨 DrawItemEventArgs)
ForeColor

그리고 있는 항목의 전경색을 가져옵니다.

(다음에서 상속됨 DrawItemEventArgs)
Graphics

항목을 그릴 그래픽 표면을 가져옵니다.

(다음에서 상속됨 DrawItemEventArgs)
Index

그리고 있는 항목의 인덱스 값을 가져옵니다.

(다음에서 상속됨 DrawItemEventArgs)
Panel

그릴 StatusBarPanel을 가져옵니다.

State

그리고 있는 항목의 상태를 가져옵니다.

(다음에서 상속됨 DrawItemEventArgs)

메서드

Dispose()

관리되지 않는 리소스의 확보, 해제 또는 다시 설정과 관련된 애플리케이션 정의 작업을 수행합니다.

(다음에서 상속됨 DrawItemEventArgs)
Dispose(Boolean)

DrawItem 이벤트에 대한 데이터를 제공합니다.

(다음에서 상속됨 DrawItemEventArgs)
DrawBackground()

DrawItemEventArgs 생성자에 지정된 경계 내에 해당 색으로 배경을 그립니다.

(다음에서 상속됨 DrawItemEventArgs)
DrawFocusRectangle()

DrawItemEventArgs 생성자에 지정된 경계 내에 포커스 영역을 그립니다.

(다음에서 상속됨 DrawItemEventArgs)
Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보