GdPicture.NET.14 (COM - ActiveX)~GdPicture14_namespace / GdPicture.NET.14 (COM - ActiveX)~GdPicture14.GdPicturePDF / SetLineAlpha Method
A new value for the transparency level. Use the value between 0 (full transparency) and 255 (full opacity).
Example





In This Topic
    SetLineAlpha Method (GdPicturePDF)
    In This Topic
    Sets the transparency level (the current stroking alpha constant) for all subsequent stroking operations, means those with the defined Stroke parameter, like the GdPicturePDF.DrawCircle method or the GdPicturePDF.DrawRectangle method. This constant specifies the constant shape or constant opacity value. The initial value is set to 255.

    The alpha constant parameter is one of the graphics state parameters. These parameters are initialized to their default values at the beginning of each page (see PDF Reference, Section "Graphics State").

    Syntax
    'Declaration
     
    
    Public Function SetLineAlpha( _
       ByVal Alpha As Byte _
    ) As GdPictureStatus
    public GdPictureStatus SetLineAlpha( 
       byte Alpha
    )
    public function SetLineAlpha( 
        Alpha: Byte
    ): GdPictureStatus; 
    public function SetLineAlpha( 
       Alpha : byte
    ) : GdPictureStatus;
    public: GdPictureStatus SetLineAlpha( 
       byte Alpha
    ) 
    public:
    GdPictureStatus SetLineAlpha( 
       byte Alpha
    ) 

    Parameters

    Alpha
    A new value for the transparency level. Use the value between 0 (full transparency) and 255 (full opacity).

    Return Value

    A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

    We strongly recommend always checking this status first.

    Remarks
    Please note that this method is only allowed for use with non-encrypted documents.

    Be aware also that graphics state parameters are initialized to their default values at the beginning of each page.

    Example
    How to set the transparency to be used when drawing various rectangles.
    Dim caption As String = "Example: SetLineAlpha"
    Dim oGdPicturePDF As New GdPicturePDF()
    Dim status As GdPictureStatus = oGdPicturePDF.NewPDF()
    If status = GdPictureStatus.OK Then
        oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
        oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter)
        If (oGdPicturePDF.NewPage(210, 297) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.ResetGraphicsState() = GdPictureStatus.OK) AndAlso 'The default graphics state is set.
           (oGdPicturePDF.SetLineWidth(3) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.SetLineColor(0, 0, 255) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.SetFillColor(0, 255, 255) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.DrawRectangle(70, 10, 60, 30, True, True) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.DrawRectangle(70, 80, 60, 30, True, True) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.DrawRectangle(70, 150, 60, 30, True, True) == GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.SetLineColor(255, 165, 0) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.SetFillColor(188, 143, 143) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.SetLineWidth(8) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.DrawRectangle(10, 25, 180, 40, True, True) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.SetLineAlpha(200) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.SetFillAlpha(200) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.DrawRectangle(10, 95, 180, 40, True, True) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.SetLineAlpha(100) == GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.SetFillAlpha(100) == GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.DrawRectangle(10, 165, 180, 40, True, True) == GdPictureStatus.OK) Then
            status = oGdPicturePDF.SaveToFile("test_Lines.pdf")
            If status = GdPictureStatus.OK Then
                MessageBox.Show("The example has been followed successfully and the file has been saved.", caption)
            Else
                MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption)
            End If
        Else
            MessageBox.Show("The example has not been followed successfully." + vbCrLf + "The last known status is " + oGdPicturePDF.GetStat().ToString(), caption)
        End If
    Else
        MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption)
    End If
    oGdPicturePDF.Dispose()
    string caption = "Example: SetLineAlpha";
    GdPicturePDF oGdPicturePDF = new GdPicturePDF();
    GdPictureStatus status = oGdPicturePDF.NewPDF();
    if (status == GdPictureStatus.OK)
    {
        oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
        oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter);
        if ((oGdPicturePDF.NewPage(210, 297) == GdPictureStatus.OK) &&
            (oGdPicturePDF.ResetGraphicsState() == GdPictureStatus.OK) && //The default graphics state is set.
            (oGdPicturePDF.SetLineWidth(3) == GdPictureStatus.OK) &&
            (oGdPicturePDF.SetLineColor(0, 0, 255) == GdPictureStatus.OK) &&
            (oGdPicturePDF.SetFillColor(0, 255, 255) == GdPictureStatus.OK) &&
            (oGdPicturePDF.DrawRectangle(70, 10, 60, 30, true, true) == GdPictureStatus.OK) &&
            (oGdPicturePDF.DrawRectangle(70, 80, 60, 30, true, true) == GdPictureStatus.OK) &&
            (oGdPicturePDF.DrawRectangle(70, 150, 60, 30, true, true) == GdPictureStatus.OK) &&
            (oGdPicturePDF.SetLineColor(255, 165, 0) == GdPictureStatus.OK) &&
            (oGdPicturePDF.SetFillColor(188, 143, 143) == GdPictureStatus.OK) &&
            (oGdPicturePDF.SetLineWidth(8) == GdPictureStatus.OK) &&
            (oGdPicturePDF.DrawRectangle(10, 25, 180, 40, true, true) == GdPictureStatus.OK) &&
            (oGdPicturePDF.SetLineAlpha(200) == GdPictureStatus.OK) &&
            (oGdPicturePDF.SetFillAlpha(200) == GdPictureStatus.OK) &&
            (oGdPicturePDF.DrawRectangle(10, 95, 180, 40, true, true) == GdPictureStatus.OK) &&
            (oGdPicturePDF.SetLineAlpha(100) == GdPictureStatus.OK) &&
            (oGdPicturePDF.SetFillAlpha(100) == GdPictureStatus.OK) &&
            (oGdPicturePDF.DrawRectangle(10, 165, 180, 40, true, true) == GdPictureStatus.OK))
        {
            status = oGdPicturePDF.SaveToFile("test_Lines.pdf");
            if (status == GdPictureStatus.OK)
                MessageBox.Show("The example has been followed successfully and the file has been saved.", caption);
            else
                MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption);
        }
        else
            MessageBox.Show("The example has not been followed successfully.\nThe last known status is " + oGdPicturePDF.GetStat().ToString(), caption);
    }
    else
        MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption);
    oGdPicturePDF.Dispose();
    See Also