ClassTelerikHelper
Definition
Namespace:Telerik.WinControls
Assembly:Telerik.WinControls.dll
Syntax:
public class TelerikHelper
Inheritance: objectTelerikHelper
Constructors
TelerikHelper()
Declaration
public TelerikHelper()
Properties
IsWindows10AnniversaryUpdateOrHigher
Declaration
public static bool IsWindows10AnniversaryUpdateOrHigher { get; }
Property Value
IsWindows10CreatorsUpdateOrHigher
Declaration
public static bool IsWindows10CreatorsUpdateOrHigher { get; }
Property Value
IsWindows10OrHigher
Gets a value indicating whether the current operating system is Windows 10 or higher.
Declaration
public static bool IsWindows10OrHigher { get; }
Property Value
true if the operating system is Windows 10, Windows 11, or higher; otherwise, false.
Remarks
This property checks for Windows 10 by examining the build number (10240 or higher). It's useful for determining when Windows 10+ specific features like WinUI, modern theming, or enhanced DPI support can be used.
IsWindows11
Gets a value indicating whether the current operating system is Windows 11.
Declaration
public static bool IsWindows11 { get; }
Property Value
true if the operating system is Windows 11; otherwise, false.
Remarks
This property specifically detects Windows 11 by checking for build number 21996 or higher on Windows 10+ systems. It's useful for enabling Windows 11-specific features like rounded corners, new system sounds, or updated visual styles.
IsWindows7
Gets a value indicating whether the current operating system is exactly Windows 7.
Declaration
public static bool IsWindows7 { get; }
Property Value
true if the operating system is Windows 7; otherwise, false.
Remarks
This property specifically detects Windows 7 (version 6.1) and can be used for Windows 7-specific workarounds or feature enablement. Note that this returns false for Windows 7 SP1 or later service packs.
IsWindows7OrHigher
Gets a value indicating whether the current operating system is Windows 7 or higher.
Declaration
public static bool IsWindows7OrHigher { get; }
Property Value
true if the operating system is Windows 7 or a more recent version; otherwise, false.
Remarks
This property checks for Windows 7 (version 6.1) or higher. It's useful for determining minimum OS requirements and enabling features that require Windows 7 APIs like improved taskbar integration, Aero effects, or enhanced touch support.
IsWindows8OrHigher
Gets a value indicating whether the current operating system is Windows 8 or higher.
Declaration
public static bool IsWindows8OrHigher { get; }
Property Value
true if the operating system is Windows 8, Windows 8.1, Windows 10, Windows 11, or higher; otherwise, false.
Remarks
This property checks the operating system version to determine compatibility with Windows 8 features and APIs. Windows 8 corresponds to version 6.2 or higher of the Windows NT platform.
IsWindows8OrLower
Gets a value indicating whether the current operating system is Windows 8 or lower.
Declaration
public static bool IsWindows8OrLower { get; }
Property Value
true if the operating system is Windows 8 or an earlier version; otherwise, false.
Remarks
This property is useful for determining when to avoid Windows 8.1+ specific features or APIs. It returns true for Windows 8 (version 6.2) and all earlier Windows versions.
Methods
ColorMixer(GradientStyles, int, float, float, params Color[])
Declaration
public static Color ColorMixer(GradientStyles gradientStyle, int numberOfColors, float gradientPercent, float gradientPercent2, params Color[] colors)
Parameters
gradientStyle
numberOfColors
gradientPercent
gradientPercent2
colors
Color[]
Returns
CreateOutlineForm1()
Declaration
public static RadShimControl CreateOutlineForm1()
Returns
CreateOutlineForm1(Bitmap, Color)
Declaration
public static RadShimControl CreateOutlineForm1(Bitmap image, Color color)
Parameters
image
color
Returns
FindRadControlParent(Control)
Searches the control hierarchy tree and returns the first RadControl that parents the control provided. Otherwise returns null.
Declaration
public static RadControl FindRadControlParent(Control control)
Parameters
control
Returns
GetBoundingRect(Rectangle, RadMatrix)
Get bounding rectangle around rotated one.
GetBoundingRect(RectangleF, RadMatrix)
Declaration
public static RectangleF GetBoundingRect(RectangleF rect, RadMatrix matrix)
Parameters
rect
matrix
Returns
GetColorAtPoint(Point)
Gets the color of the pixel at the specified location on the screen.
GetImageFormat(Image)
Declaration
public static ImageFormat GetImageFormat(Image img)
Parameters
img
Returns
GetThemeName(RadElement)
Gets the actual theme used by the passed RadElement.
Declaration
public static string GetThemeName(RadElement element)
Parameters
element
Returns
GetThemeName(string)
Gets the actual theme name in use. The theme is set with the following priority:
- ThemeResolutionService.ApplicationThemeName
- RadControl.ThemeName - it is passed as the method parameter
- ThemeResolutionService.ControlDefaultThemeName
ImageFromString(string)
Converts a base64-encoded string to a System.Drawing.Image object.
Declaration
public static Image ImageFromString(string encodedImage)
Parameters
encodedImage
The base64-encoded string representation of an image.
Returns
A System.Drawing.Image object created from the encoded string, or null if the input string is null or empty.
Exceptions
Thrown when the input string is not a valid base64 string.
Thrown when the decoded data does not represent a valid image format.
Remarks
This method decodes a base64 string and creates an Image object from the resulting byte array. It handles various pixel formats and applies appropriate transformations:
- For 24bpp RGB images, creates a bitmap and makes magenta transparent
- For GIF images, returns the image as-is
- For other formats, converts to 32bpp ARGB format for better transparency support
The method properly disposes of intermediate resources to prevent memory leaks.
ImageToString(Image)
Converts a System.Drawing.Image object to a base64-encoded string representation.
Declaration
public static string ImageToString(Image image)
Parameters
image
The image to convert to a string representation.
Returns
A base64-encoded string representing the image, or an empty string if the input image is null.
Remarks
This method serializes an image to a base64 string that can be stored or transmitted as text. The method preserves the original image format when possible:
- GIF images are saved in their original GIF format
- Other image types are converted to PNG format for better quality and transparency support
The resulting string can be converted back to an image using the ImageFromString(string) method. All intermediate resources are properly disposed to prevent memory leaks.
KeyCodeToUnicode(Keys)
Converts a key to string taking into account the currently selected keyboard layout.
MirrorRotateFlipType(RotateFlipType)
Declaration
public static RotateFlipType MirrorRotateFlipType(RotateFlipType rotateFlip)
Parameters
rotateFlip
Returns
PerformCenteredRotation(ref RadMatrix, RectangleF, float)
Declaration
public static RectangleF PerformCenteredRotation(ref RadMatrix matrix, RectangleF bounds, float angle)
Parameters
matrix
bounds
angle
Returns
PerformTopLeftRotation(ref RadMatrix, RectangleF, float)
Declaration
public static RectangleF PerformTopLeftRotation(ref RadMatrix matrix, RectangleF bounds, float angle)
Parameters
matrix
bounds
angle
Returns
ProcessStart(string)
Declaration
public static void ProcessStart(string fileName)
Parameters
fileName
ResizeImage(Image, Size)
Resizes an image to a new size.
StringFormatForAlignment(ContentAlignment)
Creates a StringFormat object configured for the specified content alignment.
Declaration
public static StringFormat StringFormatForAlignment(ContentAlignment align)
Parameters
align
The content alignment to configure the StringFormat for.
Returns
A StringFormat object with Alignment and LineAlignment properties set according to the specified ContentAlignment.
Remarks
This method translates WinForms ContentAlignment values to appropriate StringFormat alignment settings for text drawing operations. The returned StringFormat can be used with GDI+ text drawing methods to achieve the desired text alignment.
SvgImageFromString(string)
Creates a RadSvgImage object from XML string.
Declaration
public static RadSvgImage SvgImageFromString(string svgXml)
Parameters
svgXml
The XML representing the SVG image.
Returns
The created RadSvgImage object.
SvgImageToString(RadSvgImage)
Converts a RadSvgImage object to a XML string.
Declaration
public static string SvgImageToString(RadSvgImage svgImage)
Parameters
svgImage
The RadSvgImage object.
Returns