Class RadBarcodeViewElement
The core visual element that renders barcodes and provides functionality for displaying and exporting various types of barcodes using different symbologies.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.UI.Barcode
Assembly: Telerik.WinControls.UI.dll
Syntax
public class RadBarcodeViewElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IComponent, IDisposable, IBindableComponent, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider
Constructors
RadBarcodeViewElement()
Initializes a new instance of the RadBarcodeViewElement class.
Declaration
public RadBarcodeViewElement()
Fields
previousDpi
Stores the previous DPI scale factor for relative scaling calculations.
Declaration
protected SizeF previousDpi
Field Value
|
System.Drawing.SizeF
|
Properties
ElementFactory
Gets or sets the element factory that is used to create the elements of the displayed barcode.
Declaration
public IElementFactory ElementFactory { get; set; }
Property Value
|
IElementFactory
|
Symbology
Gets or sets the ISymbology that will be used to encode the value into a visual barcode representation.
Declaration
public ISymbology Symbology { get; set; }
Property Value
|
ISymbology
|
Value
Gets or sets the value that will be encoded and converted into a barcode representation.
Declaration
public string Value { get; set; }
Property Value
|
System.String
|
Methods
ArrangeOverride(SizeF)
Positions and sizes the barcode elements within the final allocated space.
Declaration
protected override SizeF ArrangeOverride(SizeF finalSize)
Parameters
|
System.Drawing.SizeF
finalSize
The final size allocated for arranging the barcode elements. |
Returns
|
System.Drawing.SizeF
The actual size used by the barcode element. |
Overrides
DpiScaleChanged(SizeF)
Handles DPI scaling changes by adjusting the barcode symbology module sizes to maintain proper visual proportions.
Declaration
public override void DpiScaleChanged(SizeF scaleFactor)
Parameters
|
System.Drawing.SizeF
scaleFactor
The new DPI scale factor to apply. |
Overrides
ExportToImage()
Exports the barcode with the current dimensions of the control.
Declaration
public Image ExportToImage()
Returns
|
System.Drawing.Image
An image of the barcode. |
ExportToImage(Int32, Int32)
Layouts the barcode using the provided dimensions and exports it to an image.
Declaration
public Image ExportToImage(int width, int height)
Parameters
|
System.Int32
width
The width of the exported image. |
|
System.Int32
height
The height of the exported image. |
Returns
|
System.Drawing.Image
An image of the barcode. |
ExportToImage(Stream, Size)
Layouts the barcode using the provided size and exports it to the specified stream.
Declaration
public void ExportToImage(Stream stream, Size size)
Parameters
|
System.IO.Stream
stream
The stream to export the barcode to. |
|
System.Drawing.Size
size
The size of the barcode. |
ExportToImage(Stream, Size, ImageFormat)
Layouts the barcode using the provided size and exports it to the specified stream in the specified image format.
Declaration
public void ExportToImage(Stream stream, Size size, ImageFormat imageFormat)
Parameters
|
System.IO.Stream
stream
The stream to export the barcode to. |
|
System.Drawing.Size
size
The size of the barcode. |
|
System.Drawing.Imaging.ImageFormat
imageFormat
The format of the exported image. |
ExportToImage(String, Size)
Layouts the barcode using the provided size and exports it to the specified file location.
Declaration
public void ExportToImage(string filePath, Size size)
Parameters
|
System.String
filePath
The location of the file where to export the barcode. |
|
System.Drawing.Size
size
The size of the barcode. |
ExportToImage(String, Size, ImageFormat)
Layouts the barcode using the provided size and exports it to the specified file location in the specified image format.
Declaration
public void ExportToImage(string filePath, Size size, ImageFormat imageFormat)
Parameters
|
System.String
filePath
The location of the file where to export the barcode. |
|
System.Drawing.Size
size
The size of the barcode. |
|
System.Drawing.Imaging.ImageFormat
imageFormat
The format of the exported image. |
InitializeFields()
Initializes the fields of the RadBarcodeViewElement.
Declaration
protected override void InitializeFields()
Overrides
MeasureOverride(SizeF)
Calculates the desired size required by the barcode element based on the available space and current symbology.
Declaration
protected override SizeF MeasureOverride(SizeF availableSize)
Parameters
|
System.Drawing.SizeF
availableSize
The available size for the element. |
Returns
|
System.Drawing.SizeF
The desired size of the element. |
Overrides
MeasureSymbology(SizeF)
Calculates the size requirements for the current barcode symbology within the available space.
Declaration
protected virtual SizeF MeasureSymbology(SizeF availableSize)
Parameters
|
System.Drawing.SizeF
availableSize
The available size for the symbology. |
Returns
|
System.Drawing.SizeF
The calculated size required for the barcode symbology. |
OnPropertyChanged(RadPropertyChangedEventArgs)
Handles property change notifications and updates the barcode display when the ForeColor property changes.
Declaration
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
Parameters
|
RadPropertyChangedEventArgs
e
The event arguments containing information about the property change. |
Overrides
OnSymbologyChanged(EventArgs)
Raises the SymbologyChanged event.
Declaration
protected virtual void OnSymbologyChanged(EventArgs e)
Parameters
|
System.EventArgs
e
The System.EventArgs instance containing the event data. |
OnSymbologyChanging(BarcodeSymbologyChangingEventArgs)
Raises the SymbologyChanging event.
Declaration
protected virtual void OnSymbologyChanging(BarcodeSymbologyChangingEventArgs e)
Parameters
|
BarcodeSymbologyChangingEventArgs
e
The BarcodeSymbologyChangingEventArgs instance containing the event data. |
OnSymbologyPropertyChanged(Object, PropertyChangedEventArgs)
Called when a property of the symbology changes. Suitable for performing necessary updates based on the changes.
Declaration
protected virtual void OnSymbologyPropertyChanged(object sender, PropertyChangedEventArgs e)
Parameters
|
System.Object
sender
The sender of the property changed event. |
|
System.ComponentModel.PropertyChangedEventArgs
e
The event arguments containing information about the property change. |
OnValueChanged(EventArgs)
Raises the ValueChanged event.
Declaration
protected virtual void OnValueChanged(EventArgs e)
Parameters
|
System.EventArgs
e
The System.EventArgs instance containing the event data. |
OnValueChanging(BarcodeValueChangingEventArgs)
Raises the ValueChanging event.
Declaration
protected virtual void OnValueChanging(BarcodeValueChangingEventArgs e)
Parameters
|
BarcodeValueChangingEventArgs
e
The BarcodeValueChangingEventArgs instance containing the event data. |
PaintElement(IGraphics, Single, SizeF)
Renders the barcode element using the specified graphics context with rotation and scaling transformations.
Declaration
protected override void PaintElement(IGraphics graphics, float angle, SizeF scale)
Parameters
|
IGraphics
graphics
The graphics context used for painting. |
|
System.Single
angle
The angle of rotation in degrees. |
|
System.Drawing.SizeF
scale
The scale factor for rendering. |
Overrides
PaintElements(IGraphics, ISymbology, IElementFactory)
Renders the barcode elements using the specified graphics context, symbology, and element factory.
Declaration
protected virtual void PaintElements(IGraphics graphics, ISymbology symbology, IElementFactory elementFactory)
Parameters
|
IGraphics
graphics
The graphics context used for painting. |
|
ISymbology
symbology
The barcode symbology that defines the encoding method. |
|
IElementFactory
elementFactory
The element factory used to create the barcode elements. |
PaintElements(IGraphics, ISymbology, IElementFactory, Size)
Renders the barcode elements using the specified graphics context, symbology, element factory, and size constraints.
Declaration
protected virtual void PaintElements(IGraphics graphics, ISymbology symbology, IElementFactory elementFactory, Size size)
Parameters
|
IGraphics
graphics
The graphics context used for painting. |
|
ISymbology
symbology
The barcode symbology that defines the encoding method. |
|
IElementFactory
elementFactory
The element factory used to create the barcode elements. |
|
System.Drawing.Size
size
The size of the painting area available for rendering. |
Update()
Updates the barcode display by processing the current value through the symbology and refreshing the layout and visual representation.
Declaration
protected virtual void Update()
Events
SymbologyChanged
Occurs after the symbology of the barcode is changed.
Declaration
public event EventHandler SymbologyChanged
Event Type
|
System.EventHandler
|
SymbologyChanging
Occurs before the symbology of the barcode is changed.
Declaration
public event BarcodeSymbologyChangingEventHandler SymbologyChanging
Event Type
|
BarcodeSymbologyChangingEventHandler
|
ValueChanged
Occurs after the value of the barcode is changed.
Declaration
public event EventHandler ValueChanged
Event Type
|
System.EventHandler
|
ValueChanging
Occurs before the value of the barcode is changed.
Declaration
public event BarcodeValueChangingEventHandler ValueChanging
Event Type
|
BarcodeValueChangingEventHandler
|