TableLayoutCellPaintEventHandler TableLayoutCellPaintEventHandler TableLayoutCellPaintEventHandler TableLayoutCellPaintEventHandler Delegate

정의

CellPaint 이벤트를 처리할 메서드를 나타냅니다.Represents the method that will handle the CellPaint event.

public delegate void TableLayoutCellPaintEventHandler(System::Object ^ sender, TableLayoutCellPaintEventArgs ^ e);
public delegate void TableLayoutCellPaintEventHandler(object sender, TableLayoutCellPaintEventArgs e);
type TableLayoutCellPaintEventHandler = delegate of obj * TableLayoutCellPaintEventArgs -> unit
Public Delegate Sub TableLayoutCellPaintEventHandler(sender As Object, e As TableLayoutCellPaintEventArgs)

매개 변수

sender
Object Object Object Object

이벤트 소스입니다.The source of the event.

상속
TableLayoutCellPaintEventHandlerTableLayoutCellPaintEventHandlerTableLayoutCellPaintEventHandlerTableLayoutCellPaintEventHandler

예제

다음 예제와 방법을 TableLayoutCellPaintEventHandler 의 모양을 사용자 지정 하는 대리자는 TableLayoutPanel 제어 합니다.The following example shows how to a TableLayoutCellPaintEventHandler delegate to customize the appearance of a TableLayoutPanel control. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 TableLayoutPanel 제어 합니다.This code example is part of a larger example provided for the TableLayoutPanel control.

public class DemoTableLayoutPanel : TableLayoutPanel
{
    protected override void OnCellPaint(TableLayoutCellPaintEventArgs e)
    {
        base.OnCellPaint(e);

        Control c = this.GetControlFromPosition(e.Column, e.Row);

        if ( c != null )
        {
            Graphics g = e.Graphics;

            g.DrawRectangle(
                Pens.Red, 
                e.CellBounds.Location.X+1,
                e.CellBounds.Location.Y + 1,
                e.CellBounds.Width - 2, e.CellBounds.Height - 2);

            g.FillRectangle(
                Brushes.Blue, 
                e.CellBounds.Location.X + 1, 
                e.CellBounds.Location.Y + 1, 
                e.CellBounds.Width - 2, 
                e.CellBounds.Height - 2);
        };
    }
    
}
Public Class DemoTableLayoutPanel
    Inherits TableLayoutPanel

    Protected Overrides Sub OnCellPaint( _
    ByVal e As System.Windows.Forms.TableLayoutCellPaintEventArgs)

        MyBase.OnCellPaint(e)

        Dim c As Control = Me.GetControlFromPosition(e.Column, e.Row)

        If c IsNot Nothing Then
            Dim g As Graphics = e.Graphics

            g.DrawRectangle( _
            Pens.Red, _
            e.CellBounds.Location.X + 1, _
            e.CellBounds.Location.Y + 1, _
            e.CellBounds.Width - 2, _
            e.CellBounds.Height - 2)

            g.FillRectangle( _
            Brushes.Blue, _
            e.CellBounds.Location.X + 1, _
            e.CellBounds.Location.Y + 1, _
            e.CellBounds.Width - 2, _
            e.CellBounds.Height - 2)
        End If

    End Sub

End Class

설명

만들 때는 TableLayoutCellPaintEventHandler 대리자를 이벤트를 처리할 메서드를 식별 합니다.When you create a TableLayoutCellPaintEventHandler delegate, you identify a method to handle the event. 이벤트를 이벤트 처리기와 연결하려면 대리자의 인스턴스를 해당 이벤트에 추가합니다.To associate the event with your event handler, add an instance of the delegate to the event. 대리자를 제거하지 않는 경우 이벤트가 발생할 때마다 이벤트 처리기가 호출됩니다.The event handler is called whenever the event occurs, unless you remove the delegate. 이벤트 처리기 대리자에 대 한 자세한 내용은 참조 하세요. 이벤트 처리 및 발생합니다.For more information about event handler delegates, see Handling and Raising Events.

확장 메서드

GetMethodInfo(Delegate) GetMethodInfo(Delegate) GetMethodInfo(Delegate) GetMethodInfo(Delegate)

지정된 대리자가 나타내는 메서드를 나타내는 개체를 가져옵니다.Gets an object that represents the method represented by the specified delegate.

적용 대상

추가 정보