Nevron .NET Vision
Framework / Presentation Layer / Graphics / Measurement Units / Lengths, Sizes, Points and Margins

In This Topic
    Lengths, Sizes, Points and Margins
    In This Topic

    Nevron Graphics implements a set of structures, which help you express common dimension metrics like lengths, points, sizes and margins as measured in a specific measurement unit. Following is a brief description of these structures:

     Lengths

    In the Nevron Graphics lengths are specified as NLength structures. The NLength structure groups together a value and a measurement unit. The following example creates a length that represents ten pixels:

    C#
    Copy Code
    NLength tenPixels = new NLength(10, NGraphicsUnit.Pixel);
    
    Visual Basic
    Copy Code
    Dim tenPixels As New NLength(10, NGraphicsUnit.Pixel)
    

    If you do not specify a measurement unit then the length will by default use the NGraphics.Point measurement unit.

    C#
    Copy Code
    NLength tenPoints = new NLength(10);
    
    Visual Basic
    Copy Code
    Dim tenPoints As NLength = New NLength(10)
    
     Sizes

    In the Nevron Graphics sizes measured in arbitrary measurement units are specified as NSizeL structures. The NSizeL structure groups together two NLength structures - one for the Width and one for the Height. The following example creates a size, which is ten pixels wide and 2 points high:

    C#
    Copy Code
    NSizeL size = new NSizeL(new NLength(10, NGraphicsUnit.Pixel), new NLength(2, NGraphicsUnit.Point));
    
    Visual Basic
    Copy Code
    Dim size As NSizeL = New NSizeL(New NLength(10, NGraphicsUnit.Pixel), New NLength(2, NGraphicsUnit.Point))
    
     Points

    In Nevron Graphics points measured in arbitrary measurement units are specified as NPointL structures. The NPointL structure groups together two NLength structures - one for the X and one for the Y value of the point. The following example creates a point that represents a coordinate at [10px, 2pt]:

    C#
    Copy Code
    NPointL point = new NPointL(new NLength(10, NGraphicsUnit.Pixel), new NLength(2, NGraphicsUnit.Point));
    
    Visual Basic
    Copy Code
    Dim point As New NPointL(New NLength(10, NGraphicsUnit.Pixel), New NLength(2, NGraphicsUnit.Point))
    
     Margins

    In Nevron Graphics margins measured in arbitrary measurement units are specified as NMarginsL structures. The NMarginsL structure groups together four NLength structures corresponding to the Left, Top, Right and Bottom margin. The following example creates a margin that represents margins of ten pixels for the Left, Top, Right and Bottom:

    C#
    Copy Code
    NMarginsL margins = new NMarginsL(new NLength(10, NGraphicsUnit.Pixel), new NLength(10, NGraphicsUnit.Pixel), new NLength(10, NGraphicsUnit.Pixel),  new NLength(10, NGraphicsUnit.Pixel));
    
    Visual Basic
    Copy Code
    Dim margins As New NMarginsL(New NLength(10, NGraphicsUnit.Pixel), New NLength(10, NGraphicsUnit.Pixel), New NLength(10, NGraphicsUnit.Pixel), New NLength(10, NGraphicsUnit.Pixel))
    
    See Also