ClassGripPrimitive
Represents a primitive element that renders a visual grip or handle, commonly used for resizing, moving, or indicating interactive areas within Telerik WinControls components.
Definition
Namespace:Telerik.WinControls.Primitives
Assembly:Telerik.WinControls.dll
Syntax:
public class GripPrimitive : BasePrimitive, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IStylableNode, IPrimitive
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementBasePrimitiveGripPrimitive
Implements:
Inherited Members
Constructors
GripPrimitive()
Declaration
public GripPrimitive()
Fields
BackColor2Property
Identifies the BackColor2 dependency property.
Declaration
public static RadProperty BackColor2Property
Field Value
Remarks
This property defines the shadow color used to create a three-dimensional effect for the grip dots, enhancing the visual depth and making the grip more prominent.
NumberOfDotsProperty
Identifies the NumberOfDots dependency property.
Declaration
public static RadProperty NumberOfDotsProperty
Field Value
Remarks
This property controls how many individual dot elements are rendered in the grip handle, affecting the overall visual density and length of the grip indicator.
Properties
BackColor2
Gets or sets the shadow color used for creating depth effect in the grip dots.
Declaration
[TypeConverter(typeof(RadColorEditorConverter))]
public virtual Color BackColor2 { get; set; }
Property Value
A Color value representing the shadow color. The default value is Control.
Remarks
This color is used to render shadow rectangles slightly offset from the main grip dots, creating a three-dimensional appearance that makes the grip more visually prominent. The shadow is typically rendered in a lighter color than the main dots.
For best visual results, this color should contrast appropriately with both the main BackColor and the containing element's background.
NumberOfDots
Gets or sets the number of dots to display in the grip handle.
Declaration
public virtual int NumberOfDots { get; set; }
Property Value
An integer value representing the number of dot elements to render. The default value is 4.
Remarks
This property determines how many individual dot elements are rendered vertically within the grip handle. More dots create a longer grip that may be easier to grab, while fewer dots create a more compact appearance.
The dots are evenly spaced based on the primitive's height and the number of dots specified. Each dot is rendered as a small rectangle with an associated shadow for depth effect.
StretchHorizontally
Gets or sets a value indicating whether the primitive should stretch horizontally to fill available space.
Declaration
public override bool StretchHorizontally { get; set; }
Property Value
false by default. Grip primitives typically maintain fixed width for consistent appearance.
Overrides
Remarks
Grip handles are generally designed to have a fixed width to ensure consistent visual appearance
and proper user interaction. Setting this to true may cause the grip to appear distorted.
StretchVertically
Gets or sets a value indicating whether the primitive should stretch vertically to fill available space.
Declaration
public override bool StretchVertically { get; set; }
Property Value
false by default. Grip primitives typically maintain fixed height for consistent appearance.
Overrides
Remarks
While grip handles may vary in height based on their container, they typically maintain
consistent spacing and dot size. Setting this to true should be done carefully
to maintain proper visual proportions.
Methods
InitializeFields()
Initializes the default field values for the grip primitive.
Declaration
protected override void InitializeFields()
Overrides
Remarks
This method configures the primitive to have fixed sizing by default, as grip handles typically have predetermined dimensions and should not stretch to fill available space. The primitive maintains its intrinsic size for consistent visual appearance.
PaintPrimitive(IGraphics, float, SizeF)
Renders the grip handle using the specified graphics context, applying rotation and scaling transformations.
Declaration
public override void PaintPrimitive(IGraphics g, float angle, SizeF scale)
Parameters
g
The IGraphics interface used for drawing the grip dots.
angle
The rotation angle in degrees to apply to the rendered content.
scale
The scaling factor to apply to the rendered content.
Overrides
Remarks
This method renders a series of small rectangular dots arranged vertically to create a grip handle appearance. Each dot consists of two rectangles: a shadow rectangle (rendered with BackColor2) and a main rectangle (rendered with BackColor).
The rendering process:
- Calculates the spacing between dots based on the primitive's height and NumberOfDots
- Renders each dot as a 2x2 pixel rectangle starting from the top
- For each dot, first renders a shadow rectangle offset by 0.1 pixels
- Then renders the main dot rectangle on top
- Continues until reaching the bottom of the primitive or running out of space
The dots are positioned with a 4-pixel vertical offset from the top and spaced 4 pixels apart vertically. Each dot is 2x2 pixels in size with a subtle shadow effect for depth.