StatusBarDrawItemEventArgs StatusBarDrawItemEventArgs StatusBarDrawItemEventArgs StatusBarDrawItemEventArgs Class

정의

DrawItem 이벤트에 대한 데이터를 제공합니다.Provides data for the DrawItem event.

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
상속
StatusBarDrawItemEventArgsStatusBarDrawItemEventArgsStatusBarDrawItemEventArgsStatusBarDrawItemEventArgs

예제

다음 코드 예제에 사용 하는 방법을 보여 줍니다.는 Style 속성을 StatusBarDrawItemEventHandler 대리자를 StatusBarDrawItemEventArgs 클래스를 StatusBarPanelStyle 열거형 및 StatusBarDrawItemEventArgs.Panel 속성.The following code example demonstrates how to use the Style property, the StatusBarDrawItemEventHandler delegate, the StatusBarDrawItemEventArgs class, the StatusBarPanelStyle enumeration and the StatusBarDrawItemEventArgs.Panel property. 예제를 실행 하는 폼에 다음 코드를 붙여넣습니다.To run the example, paste the following code in a form. 호출 된 InitializeStatusBarPanels 폼의 생성자 또는 Load 메서드.Call the InitializeStatusBarPanels method in the form's constructor or Load method.

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 변경 합니다.The DrawItem event occurs when a visual aspect of an owner-drawn StatusBarPanel changes. StatusBarDrawItemEventArgs 지정 된 Graphics 패널을 그리는 데 사용할 개체를 Rectangle 그릴 패널, 패널 id 번호, 패널 및 패널에 대 한 상태 정보를 그릴 개체.A StatusBarDrawItemEventArgs specifies the Graphics object to use to draw the panel, the Rectangle object in which to draw the panel, the panel identification number, state information about the panel, and the panel to draw. 에 대 한 이벤트 처리기에서이 클래스에서 제공 되는 데이터를 사용할 수는 DrawItem 애플리케이션의 패널 사용자 지정 그리기를 만들 이벤트 StatusBar 제어 합니다.You can use the data provided by this class in an event handler for the DrawItem event to create custom-drawn panels in your application's StatusBar control.

생성자

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

StatusBarDrawItemEventArgs의 배경색과 전경색을 지정하지 않고 StatusBarPanel 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the StatusBarDrawItemEventArgs class without specifying a background and foreground color for the StatusBarPanel.

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

StatusBarDrawItemEventArgs의 지정된 배경색 및 전경색을 사용하여 StatusBarPanel 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the StatusBarDrawItemEventArgs class with a specified background and foreground color for the StatusBarPanel.

속성

BackColor BackColor BackColor BackColor

그리고 있는 항목의 배경색을 가져옵니다.Gets the background color of the item that is being drawn.

(Inherited from DrawItemEventArgs)
Bounds Bounds Bounds Bounds

그리고 있는 항목의 경계를 나타내는 사각형을 가져옵니다.Gets the rectangle that represents the bounds of the item that is being drawn.

(Inherited from DrawItemEventArgs)
Font Font Font Font

그리는 항목에 할당되는 글꼴을 가져옵니다.Gets the font that is assigned to the item being drawn.

(Inherited from DrawItemEventArgs)
ForeColor ForeColor ForeColor ForeColor

그리고 있는 항목의 전경색을 가져옵니다.Gets the foreground color of the of the item being drawn.

(Inherited from DrawItemEventArgs)
Graphics Graphics Graphics Graphics

항목을 그릴 그래픽 표면을 가져옵니다.Gets the graphics surface to draw the item on.

(Inherited from DrawItemEventArgs)
Index Index Index Index

그리고 있는 항목의 인덱스 값을 가져옵니다.Gets the index value of the item that is being drawn.

(Inherited from DrawItemEventArgs)
Panel Panel Panel Panel

그릴 StatusBarPanel을 가져옵니다.Gets the StatusBarPanel to draw.

State State State State

그리고 있는 항목의 상태를 가져옵니다.Gets the state of the item being drawn.

(Inherited from DrawItemEventArgs)

메서드

DrawBackground() DrawBackground() DrawBackground() DrawBackground()

DrawItemEventArgs 생성자에 지정된 경계 내에 해당 색으로 배경을 그립니다.Draws the background within the bounds specified in the DrawItemEventArgs constructor and with the appropriate color.

(Inherited from DrawItemEventArgs)
DrawFocusRectangle() DrawFocusRectangle() DrawFocusRectangle() DrawFocusRectangle()

DrawItemEventArgs 생성자에 지정된 경계 내에 포커스 영역을 그립니다.Draws a focus rectangle within the bounds specified in the DrawItemEventArgs constructor.

(Inherited from DrawItemEventArgs)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(Inherited from Object)

적용 대상

추가 정보