GripPrimitive
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
public GripPrimitive()
Fields
Identifies the BackColor2 dependency property.
public static RadProperty BackColor2Property
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.
Identifies the NumberOfDots dependency property.
public static RadProperty NumberOfDotsProperty
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
Gets or sets the shadow color used for creating depth effect in the grip dots.
[TypeConverter(typeof(RadColorEditorConverter))]
public virtual Color BackColor2 { get; set; }
A Color value representing the shadow color. The default value is Control.
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.
Gets or sets the number of dots to display in the grip handle.
public virtual int NumberOfDots { get; set; }
An integer value representing the number of dot elements to render. The default value is 4.
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.
Gets or sets a value indicating whether the primitive should stretch horizontally to fill available space.
public override bool StretchHorizontally { get; set; }
false by default. Grip primitives typically maintain fixed width for consistent appearance.
Overrides:
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.
Gets or sets a value indicating whether the primitive should stretch vertically to fill available space.
public override bool StretchVertically { get; set; }
false by default. Grip primitives typically maintain fixed height for consistent appearance.
Overrides:
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
Initializes the default field values for the grip primitive.
protected override void InitializeFields()
Overrides:
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.
Renders the grip handle using the specified graphics context, applying rotation and scaling transformations.
public override void PaintPrimitive(IGraphics g, float angle, SizeF scale)
The IGraphics interface used for drawing the grip dots.
anglefloatThe rotation angle in degrees to apply to the rendered content.
scaleSizeFThe scaling factor to apply to the rendered content.
Overrides:
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.