Color gradient rectangular painting

xiaoxiao2021-03-31  231

Protected Override Void OnPaint (Painteventargs PE)

{

Graphics g = pe.graphics;

/ / Set the position and size of the rectangular area

Rectangle Rect = New Rectangle (0, 0, 200, 200);

/ / Make the color of the filled rectangle from red to yellow gradient

LINEARGRADIENTBRUSH LBRUSH = New Lineargradientbrush (Rect, Color.red, Color.Yellow,

Lineargradientmode.BackWardDiagonal);

g.fillRectangle (LBRUSH, RECT);

}

转载请注明原文地址:https://www.9cbs.com/read-131028.html

New Post(0)