Class GradientPanel
The GradientPanel is a System.Windows.Forms.Panel-derived class that has numerous border styles and has a background composed of a multiple gradient brush.
Inheritance
Implements
Namespace: Syncfusion.Windows.Forms.Tools
Assembly: Syncfusion.Shared.Base.dll
Syntax
public class GradientPanel : Panel, IThemedControl, INonClientPaintingSupport, ISupportInitialize, IThemeProvider, IVisualStyle
Constructors
GradientPanel()
Declaration
public GradientPanel()
Properties
BackgroundColor
The background color, gradient and other styles can be set through this property.
Declaration
public BrushInfo BackgroundColor { get; set; }
Property Value
| Type |
|---|
| BrushInfo |
Remarks
The GradientPanel control provides this property to enable specialized custom gradient backgrounds.
Border3DStyle
Gets or sets the style of the 3D border.
Declaration
public Border3DStyle Border3DStyle { get; set; }
Property Value
| Type |
|---|
| System.Windows.Forms.Border3DStyle |
BorderColor
Gets or sets the color of the 2D border.
Declaration
public virtual Color BorderColor { get; set; }
Property Value
| Type |
|---|
| System.Drawing.Color |
BorderSides
Gets or sets the border sides of the panel.
Declaration
public Border3DSide BorderSides { get; set; }
Property Value
| Type |
|---|
| System.Windows.Forms.Border3DSide |
BorderSingle
Gets or sets the 2D border style.
Declaration
public ButtonBorderStyle BorderSingle { get; set; }
Property Value
| Type |
|---|
| System.Windows.Forms.ButtonBorderStyle |
BorderStyle
Gets or sets the border style of the panel.
Declaration
public BorderStyle BorderStyle { get; set; }
Property Value
| Type |
|---|
| System.Windows.Forms.BorderStyle |
CanApplyTheme
Gets or sets a value indicating whether a SkinManager theme settings can be applied to the control.
Declaration
public bool CanApplyTheme { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | The default value is true. |
Remarks
This property must be initialized before applying the VisualTheme />
CanOverrideStyle
Gets or sets a value indicating whether control elements styles can be overridden by theme style settings.
Declaration
public bool CanOverrideStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | Default value is false. |
Remarks
By default, the control's element styles will not be overridden by theme style settings if the style is set in sample level. If this property is enabled, element style will be overridden by theme style settings event if it is set in sample level. This property should be enabled or disabled before calling the ThemeName property of the control.
ControlName
Gets the name of the control.
Declaration
public string ControlName { get; }
Property Value
| Type |
|---|
| System.String |
CreateParams
Declaration
protected override CreateParams CreateParams { get; }
Property Value
| Type |
|---|
| System.Windows.Forms.CreateParams |
EnableTouchMode
Gets or Sets the touch mode
Declaration
public bool EnableTouchMode { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
GradientBackground
Indicates whether the background will be drawn with the gradient.
Declaration
[Obsolete("This property will be removed in the future. Please use the BackgroundColor property instead.")]
public bool GradientBackground { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
Remarks
This property will be removed in the future. Please use the BackgroundColor property instead.
GradientColors
Gets or sets the color array that defines the gradient.
Declaration
[Obsolete("This property will be removed in the future. Please use the BackgroundColor property instead.")]
public Color[] GradientColors { get; set; }
Property Value
| Type |
|---|
| System.Drawing.Color[] |
Remarks
This property will be removed in the future. Please use the BackgroundColor property instead.
IgnoreThemeBackground
Indicates whether the control will ignore the theme's background color and draw the backcolor instead.
Declaration
public bool IgnoreThemeBackground { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
IsVisualStyleEnabled
Gets a value indicating whether the visual style based theme is applied to the control and also indicates whether the theme files are referred from external assemblies or not.
Declaration
public bool IsVisualStyleEnabled { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | Return true, if the visual style based theme is applied to the control. Otherwise returns false. |
ScrollerFrame
Gets the ScrollerFrame
Declaration
public ScrollersFrame ScrollerFrame { get; }
Property Value
| Type |
|---|
| ScrollersFrame |
ThemedBorder
Declaration
protected bool ThemedBorder { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
ThemeName
Gets or sets the theme name of the control.
Declaration
public string ThemeName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The default value is null. |
Remarks
This ThemeStyle settings will be applied only when the VisualStyleBased theme has been applied to the control.
ThemesEnabled
Indicates whether the control is themed.
Declaration
public bool ThemesEnabled { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
ThemeStyle
Gets or sets the GradientPanelVisualStyle value used to customize the appearance of the GradientPanel.
Declaration
public GradientPanelVisualStyle ThemeStyle { get; set; }
Property Value
| Type |
|---|
| GradientPanelVisualStyle |
Remarks
This ThemeStyle settings will be applied only when the VisualStyleBased theme has been applied to the control.
UseCustomScrollerFrame
Gets or Sets whether to have custom scrollbar
Declaration
public bool UseCustomScrollerFrame { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
VerticalGradient
Indicates whether the gradient is vertical.
Declaration
[Obsolete("This property will be removed in the future. Please use the BackgroundColor property instead.")]
public bool VerticalGradient { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
Remarks
This property will be removed in the future. Please use the BackgroundColor property instead.
Methods
ApplyScaleToControl(Single)
Applies the scaling for controls
Declaration
public void ApplyScaleToControl(float scaleFactor)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | scaleFactor |
BeginInit()
Signals the object that initialization is starting.
Declaration
public virtual void BeginInit()
CreateAccessibilityInstance()
Declaration
protected override AccessibleObject CreateAccessibilityInstance()
Returns
| Type |
|---|
| System.Windows.Forms.AccessibleObject |
Dispose(Boolean)
Cleans up any resources being used.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
EndInit()
Signals the object that initialization is complete.
Declaration
public virtual void EndInit()
GetActiveThemeName()
Gets the active theme name of the control.
Declaration
public virtual string GetActiveThemeName()
Returns
| Type | Description |
|---|---|
| System.String | Returns the active theme name. |
GetControlName(String)
Helps to override the ControlName property settings
Declaration
public virtual string GetControlName(string controlName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | controlName | ControlName |
Returns
| Type |
|---|
| System.String |
OnBorder3DStyleChanged()
Declaration
protected virtual void OnBorder3DStyleChanged()
OnBorderColorChanged()
Declaration
protected virtual void OnBorderColorChanged()
OnBorderSidesChanged()
Declaration
protected virtual void OnBorderSidesChanged()
OnBorderSingleChanged()
Declaration
protected virtual void OnBorderSingleChanged()
OnBorderStyleChanged()
Declaration
protected virtual void OnBorderStyleChanged()
OnCanApplyThemeChanged(Boolean)
Helps to override the CanApplyTheme property settings
Declaration
public virtual void OnCanApplyThemeChanged(bool canApplyTheme)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | canApplyTheme |
OnCanOverrideStyleChanged(Boolean)
Helps to override the CanOverriderStyle property settings
Declaration
public virtual void OnCanOverrideStyleChanged(bool canOverrideStyle)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | canOverrideStyle |
OnFontChanged(EventArgs)
Font changed
Declaration
protected override void OnFontChanged(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
OnGradientBackgroundChanged()
Declaration
protected virtual void OnGradientBackgroundChanged()
OnGradientColorsChanged()
Declaration
protected virtual void OnGradientColorsChanged()
OnHandleCreated(EventArgs)
Declaration
protected override void OnHandleCreated(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
OnHandleDestroyed(EventArgs)
Declaration
protected override void OnHandleDestroyed(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
OnPaint(PaintEventArgs)
Declaration
protected override void OnPaint(PaintEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.PaintEventArgs | e |
OnPaintBackground(PaintEventArgs)
Declaration
protected override void OnPaintBackground(PaintEventArgs pevent)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.PaintEventArgs | pevent |
OnScroll(ScrollEventArgs)
Declaration
protected override void OnScroll(ScrollEventArgs se)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.ScrollEventArgs | se |
OnSizeChanged(EventArgs)
Declaration
protected override void OnSizeChanged(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
OnThemeChanged(EventArgs)
Declaration
protected virtual void OnThemeChanged(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
OnThemeNameChanged(String)
Helps to apply the ThemeName settings in control
Declaration
public virtual void OnThemeNameChanged(string themeName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | themeName | ThemeName |
OnVerticalGradientChanged()
Declaration
protected virtual void OnVerticalGradientChanged()
RaiseThemeChanged(Object, ThemeChangedEventArgs)
Raises the ThemeNameChanged event when theme name changed.
Declaration
protected virtual void RaiseThemeChanged(object sender, ThemeChangedEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sender | The sender value. |
| ThemeChangedEventArgs | args | A ThemeChangedEventArgs contains the event data. |
RedrawBorders()
Declaration
protected virtual void RedrawBorders()
ThemedPaintBackground(Graphics, Rectangle, Rectangle)
Declaration
protected virtual void ThemedPaintBackground(Graphics graphics, Rectangle rect, Rectangle clip)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Graphics | graphics | |
| System.Drawing.Rectangle | rect | |
| System.Drawing.Rectangle | clip |
WndProc(ref Message)
Declaration
protected override void WndProc(ref Message m)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Message | m |
Events
Border3DStyleChanged
Occurs when border's 3D style is changed.
Declaration
public event EventHandler Border3DStyleChanged
Event Type
| Type |
|---|
| System.EventHandler |
BorderColorChanged
Occurs when border color is changed.
Declaration
public event EventHandler BorderColorChanged
Event Type
| Type |
|---|
| System.EventHandler |
BorderSidesChanged
Occurs when border sides are changed.
Declaration
public event EventHandler BorderSidesChanged
Event Type
| Type |
|---|
| System.EventHandler |
BorderSingleChanged
Occurs when border's 2D style is changed.
Declaration
public event EventHandler BorderSingleChanged
Event Type
| Type |
|---|
| System.EventHandler |
BorderStyleChanged
Occurs when border style is changed.
Declaration
public event EventHandler BorderStyleChanged
Event Type
| Type |
|---|
| System.EventHandler |
GradientBackgroundChanged
Occurs when gradient background is changed.
Declaration
public event EventHandler GradientBackgroundChanged
Event Type
| Type |
|---|
| System.EventHandler |
GradientColorsChanged
Occurs when gradient colors are changed.
Declaration
public event EventHandler GradientColorsChanged
Event Type
| Type |
|---|
| System.EventHandler |
GradientPanelThemeChanged
Occurs when ThemesEnabled property is changed.
Declaration
public event EventHandler GradientPanelThemeChanged
Event Type
| Type |
|---|
| System.EventHandler |
ThemeNameChanged
Declaration
public event ThemeChangedEventHandler ThemeNameChanged
Event Type
| Type |
|---|
| ThemeChangedEventHandler |
VerticalGradientChanged
Occurs when vertical gradient is changed.
Declaration
public event EventHandler VerticalGradientChanged
Event Type
| Type |
|---|
| System.EventHandler |
Explicit Interface Implementations
INonClientPaintingSupport.NonClientPaint(PaintEventArgs, Rectangle, Rectangle)
Declaration
IntPtr INonClientPaintingSupport.NonClientPaint(PaintEventArgs e, Rectangle displayRect, Rectangle windowRectInScreen)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.PaintEventArgs | e | |
| System.Drawing.Rectangle | displayRect | |
| System.Drawing.Rectangle | windowRectInScreen |
Returns
| Type |
|---|
| System.IntPtr |
IVisualStyle.VisualTheme
Get or Set of Visual theme
Declaration
string IVisualStyle.VisualTheme { get; set; }
Returns
| Type |
|---|
| System.String |
IThemeProvider.BaseThemeName
Gets or sets the Base Theme name of the theme
Declaration
string IThemeProvider.BaseThemeName { get; set; }
Returns
| Type |
|---|
| System.String |