LEADTOOLS Special Effects (Leadtools.SpecialEffects assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.30
GradientFillRectangle(IntPtr,Rectangle,SpecialEffectsGradientStyle,Color,Color,Int32) Method
See Also 
Leadtools.SpecialEffects Namespace > SpecialEffectsProcessor Class > GradientFillRectangle Method : GradientFillRectangle(IntPtr,Rectangle,SpecialEffectsGradientStyle,Color,Color,Int32) Method



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.
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.
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

Visual Basic (Declaration) 
Overloads Public Sub GradientFillRectangle( _
   ByVal hdc As IntPtr, _
   ByVal destRect As Rectangle, _
   ByVal gradientStyle As SpecialEffectsGradientStyle, _
   ByVal startColor As Color, _
   ByVal endColor As Color, _
   ByVal steps As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As SpecialEffectsProcessor
Dim hdc As IntPtr
Dim destRect As Rectangle
Dim gradientStyle As SpecialEffectsGradientStyle
Dim startColor As Color
Dim endColor As Color
Dim steps As Integer
 
instance.GradientFillRectangle(hdc, destRect, gradientStyle, startColor, endColor, steps)
C# 
public void GradientFillRectangle( 
   IntPtr hdc,
   Rectangle destRect,
   SpecialEffectsGradientStyle gradientStyle,
   Color startColor,
   Color endColor,
   int steps
)
C++/CLI 
public:
void GradientFillRectangle( 
   IntPtr hdc,
   Rectangle destRect,
   SpecialEffectsGradientStyle gradientStyle,
   Color startColor,
   Color endColor,
   int steps
) 

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(Graphics,Rectangle,SpecialEffectsGradientStyle,Color,Color,Int32) method to draw and fill a rectangle with a color gradient.

Visual BasicCopy 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

For more information, refer to Implementing Special Effects.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also