You are here: Start » AVL.NET » AVL.NET Designers

AVL.NET Designers

Introduction

It is possible in AVL.NET to edit geometrical primitives the same way as in Adaptive Vision Studio. All that need to be done is to reference the Avl.Net.Designers.dll assembly. Appropriate classes are declared in AvlNet.Designers namespace.

Designer usage in AVL.NET is almost the same as of .NET dialogs. Each designer class exposes at least a public property of the type it is designed to edit and a public ShowDialog() method which returns a DialogResult enumeration.

Example

The following example is a part of the simple image thresholding application that allows to threshold an image within the user-defined ROI which can be defined with RegionDesigner. The complete source code can be found here.

The application is a single-form application that uses the RegionDesigner from the Avl.Net.Designers.dll assembly and contains two picture boxes, two track bar controls responsible for setting the thresholds and several buttons that allow to load images:


        //...
        Region roi;
        /// <summary>
        /// image being thresholded
        /// </summary>
        Image image;
        //...
        /// <summary>
        /// Performs image thresholding either in defined ROI or of a cropped image.
        /// </summary>
        private void UpdateThresholdResult()
        {
                //... 
                AVL.ThresholdImage(image, roi, minTrackBar.Value, maxTrackBar.Value, 1.0f, out thresholdedImage);
                //... 
                resultPreview.Image = thresholdedImage.CreateBitmap();
                //... 
        }

        /// <summary>
        /// Opens a RegionDesigner to edit a ROI within which an image will be thresholded.
        /// </summary>
        private void regionButton_Click(object sender, EventArgs e)
        {
            using (RegionDesigner designer = new RegionDesigner())
            {
                if (image != null)
                    designer.Backgrounds = new Image[] { image };

                designer.Region = roi;
                if (designer.ShowDialog(this) == DialogResult.OK)
                {
                    roi = designer.Region;
                }
            }

            UpdatePreview();
            UpdateThresholdResult();
        }

Clicking on the Edit ROI button opens the following dialog:


Available designer classes

Previous: Relation between AVL.NET and AVL/C++ Next: HMI Controls for AVL.NET