Spread Windows Forms 13.0 Product Documentation
FarPoint.Win Assembly / FarPoint.Win Namespace / Picture Class / TransparencyTolerance Property

In This Topic
    TransparencyTolerance Property (Picture)
    In This Topic
    Gets or sets the amount of tolerance of transparency from the color set as transparent.
    Public Overridable Property TransparencyTolerance As Integer
    Dim instance As Picture
    Dim value As Integer
    instance.TransparencyTolerance = value
    value = instance.TransparencyTolerance
    public virtual int TransparencyTolerance {get; set;}

    Property Value

    Integer number between 0 and 255 representing the transparency tolerance

    The value of the tolerance should be between 0 and 255. 

    The transparency tolerance determines how close the red, green, and blue components of a color must be to the TransparencyColor to be transparent in the rendered image. For example, if the TransparencyColor is Color.White (255,255,255) and the TransparencyTolerance is 1, then the color (254,254,254) is also rendered transparent.

    This example draws a picture in the top left of the dialog.
    private void DrawPicture(System.Windows.Forms.PaintEventArgs e)
    Graphics g = e.Graphics;
    FarPoint.Win.Picture p = new FarPoint.Win.Picture(Image.FromFile("d:\\earth.ico"), RenderStyle.Normal, Color.White, 50, HorizontalAlignment.Center, VerticalAlignment.Center);
    g.DrawImage(p.Image, 20, 20);
    int i = p.TransparencyTolerance;
    MessageBox.Show("The tolerance is " + i.ToString());
    Private Sub DrawPicture(ByVal e As PaintEventArgs)
    Dim g As Graphics = e.Graphics
    Dim p As New FarPoint.Win.Picture(Image.FromFile("d:\earth.ico"), RenderStyle.Normal, Color.White, 50, HorizontalAlignment.Center,VerticalAlignment.Center)
    g.DrawImage(p.Image, 20, 20)
    Dim i As Integer = p.TransparencyTolerance
    MessageBox.Show("The tolerance is " + i.ToString())
    End Sub
    See Also