Add item to PropertyGrid custom controls

protected  the override  void the OnPaint (System.Windows.Forms.PaintEventArgs E) 
{ 
    Pen PEN = new new Pen (drawLineColor); 
    pen.Width = 2 ;
     //  draw a horizontal line   
    e.Graphics.DrawLine (PEN, new new Point ( . 5 , . 5 ), new new Point ( the this .Width - . 5 , . 5 ));
     /// / panel background image is drawn   
    // IF (the BackgroundImage = null) e.Graphics.DrawImage (this.BackgroundImage, new new Point (0, 0! ));   
}
 //  internal variable color values stored     
privateDrawLineColor = Color Color.Red; 
[the Description ( " modify this value, can change the color of the dividing line " ), the Category ( " custom property " )]
 //  custom property value of the control  
public Color DrawLineColor 
{ 
    GET 
    { 
        return drawLineColor; 
    } 
    SET 
    { 
        drawLineColor = value;
         //  modified here, is a custom attribute change operation performed  
         //  here when the value of the color attribute changes, new color, making custom redraw  
        the this .Invalidate () ; 
    } 
}

Guess you like

Origin www.cnblogs.com/jizhiqiliao/p/11584002.html