Version

ErrorImageBlinkRate Property

Gets/sets the rate at which the error image blinks, expressed in milliseconds. Applicable only when the notification action resolves to 'Image'.
Syntax
'Declaration
 
Public Property ErrorImageBlinkRate As Integer
public int ErrorImageBlinkRate {get; set;}
Exceptions
ExceptionDescription
System.ArgumentOutOfRangeExceptionThrown if this property is set to a negative number.
Remarks

The ErrorImageBlinkRate property is not applicable when the entity being validated is an embeddable editor. It is also not applicable when the ErrorImageBlinkStyle property is set to 'Never'.

Setting the ErrorImageBlinkRate property to zero is the functional equivalent of setting the ErrorImageBlinkStyle property to 'Never'. Setting the property to a negative value is not permitted; attempting to do so will cause an System.ArgumentOutOfRangeException to be thrown.

The error image does not blink while the cursor is positioned over it.

Example
The following code sample demonstrates how to use the ErrorImageAlignment, ErrorImagePadding, ErrorImageBlinkRate, ErrorImageBlinkStyle, ErrorImageSize, and ErrorImageTransparentColor properties to customize the appearance and behavior of the error image which is displayed when the NotificationAction is set ti 'Image':

Imports Infragistics.Win
Imports Infragistics.Win.Misc
Imports System.Drawing
Imports System.Drawing.Drawing2D

    Private Sub SetErrorImageProperties(ByVal ultraValidator As UltraValidator)
        '  Set the ErrorImageAlignment property to 'MiddleLeft' so that the
        '  error image appears on the left side, centered vertically.
        ultraValidator.ErrorImageAlignment = ErrorIconAlignment.MiddleLeft

        '  Set the ErrorImagePadding property to 5 so that there is a
        '  little space between the image and the control.
        ultraValidator.ErrorImagePadding = 5

        '  Set the blink rate for the error image to 182 milleseconds,
        '  and the blink style to 'Always', so that the error image
        '  blinks quickly when an error occurs.
        ultraValidator.ErrorImageBlinkRate = 182
        ultraValidator.ErrorImageBlinkStyle = ErrorImageBlinkStyle.Always

        '  Generate an image to be displayed when a validation error occurs,
        '  and use a smaller that usual size for a compact UI. Set the transparent
        '  color to Color.Transparent. Also, handle the Disposed event so we can
        '  properly dispose of the error image since we created it.
        Dim errorImageSize As Size = New Size(13, 13)
        ultraValidator.ErrorImageSize = errorImageSize
        ultraValidator.NotificationSettings.Image = Me.GenerateErrorImage(errorImageSize)
        ultraValidator.ErrorImageTransparentColor = Color.Transparent
        AddHandler ultraValidator.Disposed, AddressOf Me.ultraValidator_Disposed

        '  Set the notification action to 'Image'.
        ultraValidator.NotificationSettings.Action = NotificationAction.Image
    End Sub

    Private Function GenerateErrorImage(ByVal size As Size) As Bitmap

        Dim errorImage As Bitmap = New Bitmap(size.Width, size.Height)
        Dim bounds As Rectangle = New Rectangle(Point.Empty, size)

        Using gr As Graphics = Graphics.FromImage(errorImage)

            gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias

            Using brush As SolidBrush = New SolidBrush(Color.Red)
                gr.FillEllipse(brush, bounds)
            End Using

            bounds.Inflate(-3, -3)

            Using pen As Pen = New Pen(Color.White, 2.0F)
                gr.DrawLine(pen, bounds.Location, New Point(bounds.Right, bounds.Bottom))
                gr.DrawLine(pen, New Point(bounds.Left, bounds.Bottom), New Point(bounds.Right, bounds.Top))
            End Using
        End Using

        Return errorImage
    End Function

    Private Sub ultraValidator_Disposed(ByVal sender As Object, ByVal e As EventArgs)

        Dim ultraValidator As UltraValidator = sender

        Dim errorImage As Image = ultraValidator.NotificationSettings.Image

        If Not errorImage Is Nothing Then errorImage.Dispose()
    End Sub
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Infragistics.Win;
using Infragistics.Win.Misc;
using System.Drawing;
using System.Drawing.Drawing2D;

    private void SetErrorImageProperties( UltraValidator ultraValidator )
    {
        //  Set the ErrorImageAlignment property to 'MiddleLeft' so that the
        //  error image appears on the left side, centered vertically.
        ultraValidator.ErrorImageAlignment = ErrorIconAlignment.MiddleLeft;

        //  Set the ErrorImagePadding property to 5 so that there is a
        //  little space between the image and the control.
        ultraValidator.ErrorImagePadding = 5;

        //  Set the blink rate for the error image to 182 milleseconds,
        //  and the blink style to 'Always', so that the error image
        //  blinks quickly when an error occurs.
        ultraValidator.ErrorImageBlinkRate = 182;
        ultraValidator.ErrorImageBlinkStyle = ErrorImageBlinkStyle.Always;

        //  Generate an image to be displayed when a validation error occurs,
        //  and use a smaller that usual size for a compact UI. Set the transparent
        //  color to Color.Transparent. Also, handle the Disposed event so we can
        //  properly dispose of the error image since we created it.
        Size errorImageSize = new Size(13, 13);
        ultraValidator.ErrorImageSize = errorImageSize;
        ultraValidator.NotificationSettings.Image = this.GenerateErrorImage(  errorImageSize );
        ultraValidator.ErrorImageTransparentColor = Color.Transparent;
        ultraValidator.Disposed += new EventHandler( this.ultraValidator_Disposed );

        //  Set the notification action to 'Image'.
        ultraValidator.NotificationSettings.Action = NotificationAction.Image;
    }

    private Bitmap GenerateErrorImage( Size size )
    {
        Bitmap errorImage = new Bitmap( size.Width, size.Height );
        Rectangle bounds = new Rectangle( Point.Empty, size );

        using ( Graphics gr = Graphics.FromImage(errorImage) )
        {
            gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            using ( SolidBrush brush = new SolidBrush(Color.Red) )
            {
                gr.FillEllipse( brush, bounds );
            }

            bounds.Inflate( -3, -3 );

            using ( Pen pen = new Pen(Color.White, 2f) )
            {
                gr.DrawLine( pen, bounds.Location, new Point(bounds.Right, bounds.Bottom) );
                gr.DrawLine( pen, new Point(bounds.Left, bounds.Bottom), new Point(bounds.Right, bounds.Top) );
            }
        }

        return errorImage;
    }

    private void ultraValidator_Disposed(object sender, EventArgs e)
    {
        UltraValidator ultraValidator = sender as UltraValidator;
        Image errorImage = ultraValidator.NotificationSettings.Image;

        if ( errorImage != null )
            errorImage.Dispose();
    }
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also