Draws a rectangle onto the target device context, and then fills the rectangle with a gradient that begins with the specified starting color and ends with the specified ending color
Syntax
Parameters
- hdc
- Handle to a device context where the gradient effect will be displayed.
- destRect
- Rectangle to be used as the display destination rectangle.
- gradientStyle
- Gradient style. For possible values refer to SpecialEffectsGradientStyle.
- startColor
- Value that specifies the starting color.
- endColor
- Value that specifies the ending color.
- steps
- Number of gradient color steps. Valid values are 2 to 256.
Example
This Example shows the minimum requirements for using the GradientFillRectangle method to draw and fill a rectangle with a color gradient.
Visual Basic |
Copy Code |
Public Sub GradientFillRectangle(ByVal g As Graphics, ByVal destRect As Rectangle) Dim processor As SpecialEffectsProcessor = New SpecialEffectsProcessor() processor.GradientFillRectangle(g, destRect, SpecialEffectsGradientStyle.EllipseToC, Color.Red, Color.Blue, 12) End Sub |
C# |
Copy Code |
public void GradientFillRectangle(Graphics g, Rectangle destRect) { SpecialEffectsProcessor processor = new SpecialEffectsProcessor(); processor.GradientFillRectangle(g, destRect, SpecialEffectsGradientStyle.EllipseToC, Color.Red, Color.Blue, 12); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also