ArcObjects Library Reference  

EditProperties2

About the Feature editing with the control commands Sample

[C#]

EditProperties2.cs

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using ESRI.ArcGIS.Controls;

namespace EditPropertiesDialog
{

	public class EditProperties2 : System.Windows.Forms.Form
	{
		private System.ComponentModel.Container components = null;

		public EditProperties2()
		{
			InitializeComponent();
		}

		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
      this.label1 = new System.Windows.Forms.Label();
      this.label2 = new System.Windows.Forms.Label();
      this.label3 = new System.Windows.Forms.Label();
      this.label4 = new System.Windows.Forms.Label();
      this.label5 = new System.Windows.Forms.Label();
      this.label6 = new System.Windows.Forms.Label();
      this.label7 = new System.Windows.Forms.Label();
      this.label8 = new System.Windows.Forms.Label();
      this.txtOffset = new System.Windows.Forms.TextBox();
      this.txtPrecision = new System.Windows.Forms.TextBox();
      this.cboType = new System.Windows.Forms.ComboBox();
      this.cboUnits = new System.Windows.Forms.ComboBox();
      this.txtFactor = new System.Windows.Forms.TextBox();
      this.chkSnapTips = new System.Windows.Forms.CheckBox();
      this.chkGrid = new System.Windows.Forms.CheckBox();
      this.txtTolerance = new System.Windows.Forms.TextBox();
      this.SuspendLayout();
      // 
      // label1
      // 
      this.label1.Location = new System.Drawing.Point(8, 16);
      this.label1.Name = "label1";
      this.label1.Size = new System.Drawing.Size(136, 16);
      this.label1.TabIndex = 0;
      this.label1.Text = "Angular Correction Offset:";
      // 
      // label2
      // 
      this.label2.Location = new System.Drawing.Point(8, 48);
      this.label2.Name = "label2";
      this.label2.Size = new System.Drawing.Size(120, 16);
      this.label2.TabIndex = 1;
      this.label2.Text = "Angular Unit Precision:";
      // 
      // label3
      // 
      this.label3.Location = new System.Drawing.Point(8, 80);
      this.label3.Name = "label3";
      this.label3.Size = new System.Drawing.Size(88, 16);
      this.label3.TabIndex = 2;
      this.label3.Text = "Direction Type:";
      // 
      // label4
      // 
      this.label4.Location = new System.Drawing.Point(8, 112);
      this.label4.Name = "label4";
      this.label4.Size = new System.Drawing.Size(88, 16);
      this.label4.TabIndex = 3;
      this.label4.Text = "Direction Units:";
      // 
      // label5
      // 
      this.label5.Location = new System.Drawing.Point(8, 144);
      this.label5.Name = "label5";
      this.label5.Size = new System.Drawing.Size(144, 16);
      this.label5.TabIndex = 4;
      this.label5.Text = "Distance Correction Factor:";
      // 
      // label6
      // 
      this.label6.Location = new System.Drawing.Point(8, 176);
      this.label6.Name = "label6";
      this.label6.Size = new System.Drawing.Size(88, 16);
      this.label6.TabIndex = 5;
      this.label6.Text = "Snap Tips:";
      // 
      // label7
      // 
      this.label7.Location = new System.Drawing.Point(8, 208);
      this.label7.Name = "label7";
      this.label7.Size = new System.Drawing.Size(136, 16);
      this.label7.TabIndex = 6;
      this.label7.Text = "Sticky Move Tolerance:";
      // 
      // label8
      // 
      this.label8.Location = new System.Drawing.Point(8, 240);
      this.label8.Name = "label8";
      this.label8.Size = new System.Drawing.Size(120, 16);
      this.label8.TabIndex = 7;
      this.label8.Text = "Use Ground to Grid:";
      // 
      // txtOffset
      // 
      this.txtOffset.Location = new System.Drawing.Point(152, 16);
      this.txtOffset.Name = "txtOffset";
      this.txtOffset.Size = new System.Drawing.Size(80, 20);
      this.txtOffset.TabIndex = 8;
      this.txtOffset.Text = "";
      this.txtOffset.TextChanged += new System.EventHandler(this.txtOffset_TextChanged);
      // 
      // txtPrecision
      // 
      this.txtPrecision.Location = new System.Drawing.Point(152, 48);
      this.txtPrecision.Name = "txtPrecision";
      this.txtPrecision.Size = new System.Drawing.Size(80, 20);
      this.txtPrecision.TabIndex = 9;
      this.txtPrecision.Text = "";
      this.txtPrecision.TextChanged += new System.EventHandler(this.txtPrecision_TextChanged);
      // 
      // cboType
      // 
      this.cboType.Items.AddRange(new object[] {
                                                 "North Azimuth",
                                                 "South Azimuth",
                                                 "Polar",
                                                 "Quadrant Bearing"});
      this.cboType.Location = new System.Drawing.Point(96, 80);
      this.cboType.Name = "cboType";
      this.cboType.Size = new System.Drawing.Size(136, 21);
      this.cboType.TabIndex = 10;
      // 
      // cboUnits
      // 
      this.cboUnits.Items.AddRange(new object[] {
                                                  "Radians",
                                                  "Decimal Degrees",
                                                  "Degrees Minutes Seconds",
                                                  "Gradians",
                                                  "Gons"});
      this.cboUnits.Location = new System.Drawing.Point(96, 112);
      this.cboUnits.Name = "cboUnits";
      this.cboUnits.Size = new System.Drawing.Size(136, 21);
      this.cboUnits.TabIndex = 11;
      // 
      // txtFactor
      // 
      this.txtFactor.Location = new System.Drawing.Point(152, 144);
      this.txtFactor.Name = "txtFactor";
      this.txtFactor.Size = new System.Drawing.Size(80, 20);
      this.txtFactor.TabIndex = 12;
      this.txtFactor.Text = "";
      this.txtFactor.TextChanged += new System.EventHandler(this.txtFactor_TextChanged);
      // 
      // chkSnapTips
      // 
      this.chkSnapTips.Location = new System.Drawing.Point(152, 168);
      this.chkSnapTips.Name = "chkSnapTips";
      this.chkSnapTips.Size = new System.Drawing.Size(24, 32);
      this.chkSnapTips.TabIndex = 13;
      // 
      // chkGrid
      // 
      this.chkGrid.Location = new System.Drawing.Point(152, 232);
      this.chkGrid.Name = "chkGrid";
      this.chkGrid.Size = new System.Drawing.Size(24, 32);
      this.chkGrid.TabIndex = 14;
      // 
      // txtTolerance
      // 
      this.txtTolerance.Location = new System.Drawing.Point(152, 208);
      this.txtTolerance.Name = "txtTolerance";
      this.txtTolerance.Size = new System.Drawing.Size(80, 20);
      this.txtTolerance.TabIndex = 15;
      this.txtTolerance.Text = "";
      this.txtTolerance.TextChanged += new System.EventHandler(this.txtTolerance_TextChanged);
      // 
      // EditProperties2
      // 
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
      this.ClientSize = new System.Drawing.Size(242, 270);
      this.Controls.Add(this.txtTolerance);
      this.Controls.Add(this.chkGrid);
      this.Controls.Add(this.chkSnapTips);
      this.Controls.Add(this.txtFactor);
      this.Controls.Add(this.cboUnits);
      this.Controls.Add(this.cboType);
      this.Controls.Add(this.txtPrecision);
      this.Controls.Add(this.txtOffset);
      this.Controls.Add(this.label8);
      this.Controls.Add(this.label7);
      this.Controls.Add(this.label6);
      this.Controls.Add(this.label5);
      this.Controls.Add(this.label4);
      this.Controls.Add(this.label3);
      this.Controls.Add(this.label2);
      this.Controls.Add(this.label1);
      this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
      this.MaximizeBox = false;
      this.MinimizeBox = false;
      this.Name = "EditProperties2";
      this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
      this.Text = "Edit Properties 2";
      this.Closing += new System.ComponentModel.CancelEventHandler(this.EditProperties2_Closing);
      this.Load += new System.EventHandler(this.EditProperties2_Load);
      this.ResumeLayout(false);

    }
		#endregion

		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.TextBox txtOffset;
		private System.Windows.Forms.TextBox txtPrecision;
		private System.Windows.Forms.ComboBox cboType;
		private System.Windows.Forms.ComboBox cboUnits;
		private System.Windows.Forms.TextBox txtFactor;
		private System.Windows.Forms.CheckBox chkSnapTips;
		private System.Windows.Forms.CheckBox chkGrid;
		private System.Windows.Forms.TextBox txtTolerance;
		private IEngineEditProperties2 m_engineEditProperties2 = new EngineEditorClass();

		private void EditProperties2_Load(object sender, System.EventArgs e)
		{
			//Populate form with current IEngineProperties2 values 
			txtOffset.Text = m_engineEditProperties2.AngularCorrectionOffset.ToString();
			txtPrecision.Text = m_engineEditProperties2.AngularUnitPrecision.ToString();
			txtFactor.Text = m_engineEditProperties2.DistanceCorrectionFactor.ToString();
			txtTolerance.Text = m_engineEditProperties2.StickyMoveTolerance.ToString();

			if (m_engineEditProperties2.SnapTips)
				chkSnapTips.Checked = true;
			else
				chkSnapTips.Checked = false;

			if (m_engineEditProperties2.UseGroundToGrid)
				chkGrid.Checked = true;
			else
				chkGrid.Checked = false;

			//Select current direction type
			esriEngineDirectionType type = m_engineEditProperties2.DirectionType;
			switch (type.ToString())
			{
				case "esriEngineDTNorthAzimuth":
					cboType.SelectedItem = "North Azimuth";
					break;
				case "esriEngineDTSouthAzimuth":
					cboType.SelectedItem = "South Azimuth";
					break;
				case "esriEngineDTPolar":
					cboType.SelectedItem = "Polar";
					break;
				case "esriEngineDTQuadrantBearing":
					cboType.SelectedItem = "Quadrant Bearing";
					break;
				default:
					break;
			}

			//Select current direction units
			esriEngineDirectionUnits units = m_engineEditProperties2.DirectionUnits;
			switch (units.ToString())
			{
				case "esriEngineDURadians":
					cboUnits.SelectedItem = "Radians";
					break;
				case "esriEngineDUDecimalDegrees":
					cboUnits.SelectedItem = "Decimal Degrees";
					break;
				case "esriEngineDUDegreesMinutesSeconds":
					cboUnits.SelectedItem = "Degrees Minutes Seconds";
					break;
				case "esriEngineDUGradians":
					cboUnits.SelectedItem = "Gradians";
					break;
				case "esriEngineDUGons":
					cboUnits.SelectedItem = "Gons";
					break;
				default:
					break;
			}
		}

		private void EditProperties2_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
			//Update Offset property
			if (txtOffset.Text != "")
				m_engineEditProperties2.AngularCorrectionOffset = Convert.ToInt32(txtOffset.Text);

			//Update Precision property
			if (txtPrecision.Text != "")
				m_engineEditProperties2.AngularUnitPrecision = Convert.ToInt32(txtPrecision.Text);

			//Update Distance Correction Factor property
			if (txtFactor.Text != "")
				m_engineEditProperties2.DistanceCorrectionFactor = Convert.ToInt32(txtFactor.Text);

			//Update Tolerance property
			if (txtTolerance.Text != "")
				m_engineEditProperties2.StickyMoveTolerance = Convert.ToInt32(txtTolerance.Text);

			//Update Snap Tips property
			if (chkSnapTips.Checked)
				m_engineEditProperties2.SnapTips = true;
			else
				m_engineEditProperties2.SnapTips = false;

			//Update Grid property
			if (chkGrid.Checked)
				m_engineEditProperties2.UseGroundToGrid = true;
			else
				m_engineEditProperties2.UseGroundToGrid = false;

			//Set Direction Type property
			string type = cboType.SelectedItem.ToString();
			switch (type)
			{
				case "North Azimuth":
					m_engineEditProperties2.DirectionType = esriEngineDirectionType.esriEngineDTNorthAzimuth;
					break;
				case "South Azimuth":
					m_engineEditProperties2.DirectionType = esriEngineDirectionType.esriEngineDTSouthAzimuth;
					break;
				case "Polar":
					m_engineEditProperties2.DirectionType = esriEngineDirectionType.esriEngineDTPolar;
					break;
				case "Quadrant Bearing":
					m_engineEditProperties2.DirectionType = esriEngineDirectionType.esriEngineDTQuadrantBearing;
					break;
				default:
					break;
			}

			//Set Direction Units property
			string units = cboUnits.SelectedItem.ToString();
			switch (units)
			{
				case "Radians":
					m_engineEditProperties2.DirectionUnits = esriEngineDirectionUnits.esriEngineDURadians;
					break;
				case "Decimal Degrees":
					m_engineEditProperties2.DirectionUnits = esriEngineDirectionUnits.esriEngineDUDecimalDegrees;
					break;
				case "Degrees Minutes Seconds":
					m_engineEditProperties2.DirectionUnits = esriEngineDirectionUnits.esriEngineDUDegreesMinutesSeconds;
					break;
				case "Gradians":
					m_engineEditProperties2.DirectionUnits = esriEngineDirectionUnits.esriEngineDUGradians;
					break;
				case "Gons":
					m_engineEditProperties2.DirectionUnits = esriEngineDirectionUnits.esriEngineDUGons;
					break;
				default:
					break;
			}
		}


		private void txtOffset_TextChanged(object sender, System.EventArgs e)
		{
			//Validate offset
			try
			{
				if (txtOffset.Text != "")
				Convert.ToInt32(txtOffset.Text);
			}
			catch (FormatException)
			{
				MessageBox.Show("Correction offset should be a numeric value", "Correction Offset");
				txtOffset.Text = "";
				txtOffset.Focus();
			}
		}

		private void txtPrecision_TextChanged(object sender, System.EventArgs e)
		{
			//Validate precision
			try
			{
				if (txtPrecision.Text != "")
				Convert.ToInt32(txtPrecision.Text);
			}
			catch (FormatException)
			{
                MessageBox.Show("Unit precision should be a numeric value", "Unit Precision");
				txtPrecision.Text = "";
				txtPrecision.Focus();
			}    
		}

		private void txtFactor_TextChanged(object sender, System.EventArgs e)
		{
			//Validate factor
			try
			{
				if (txtFactor.Text != "")
				Convert.ToInt32(txtFactor.Text);
			}
			catch (FormatException)
			{
				MessageBox.Show("Distance Correction Factor should be a numeric value", "Distance Correction Factor");
				txtFactor.Text = "";
				txtFactor.Focus();
			} 
		}

		private void txtTolerance_TextChanged(object sender, System.EventArgs e)
		{
			//Validate tolerance
			try
			{
				if (txtTolerance.Text != "")
				Convert.ToInt32(txtTolerance.Text);
			}
			catch (FormatException)
			{
				MessageBox.Show("Sticky Move Tolerance should be a numeric value", "Sticky Move Tolerance");
				txtTolerance.Text = "";
				txtTolerance.Focus();
			} 
		}

	}
}

[Visual Basic .NET]

EditProperties2.vb

Imports System.Windows.Forms
Imports ESRI.ArcGIS.Controls

Public Class EditProperties2
    Inherits System.Windows.Forms.Form

    Private m_engineEditProperties2 As New EngineEditorClass

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents txtTolerance As System.Windows.Forms.TextBox
    Friend WithEvents chkGrid As System.Windows.Forms.CheckBox
    Friend WithEvents chkSnapTips As System.Windows.Forms.CheckBox
    Friend WithEvents txtFactor As System.Windows.Forms.TextBox
    Friend WithEvents cboUnits As System.Windows.Forms.ComboBox
    Friend WithEvents cboType As System.Windows.Forms.ComboBox
    Friend WithEvents txtPrecision As System.Windows.Forms.TextBox
    Friend WithEvents txtOffset As System.Windows.Forms.TextBox
    Friend WithEvents label8 As System.Windows.Forms.Label
    Friend WithEvents label7 As System.Windows.Forms.Label
    Friend WithEvents label6 As System.Windows.Forms.Label
    Friend WithEvents label5 As System.Windows.Forms.Label
    Friend WithEvents label4 As System.Windows.Forms.Label
    Friend WithEvents label3 As System.Windows.Forms.Label
    Friend WithEvents label2 As System.Windows.Forms.Label
    Friend WithEvents label1 As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.txtTolerance = New System.Windows.Forms.TextBox
        Me.chkGrid = New System.Windows.Forms.CheckBox
        Me.chkSnapTips = New System.Windows.Forms.CheckBox
        Me.txtFactor = New System.Windows.Forms.TextBox
        Me.cboUnits = New System.Windows.Forms.ComboBox
        Me.cboType = New System.Windows.Forms.ComboBox
        Me.txtPrecision = New System.Windows.Forms.TextBox
        Me.txtOffset = New System.Windows.Forms.TextBox
        Me.label8 = New System.Windows.Forms.Label
        Me.label7 = New System.Windows.Forms.Label
        Me.label6 = New System.Windows.Forms.Label
        Me.label5 = New System.Windows.Forms.Label
        Me.label4 = New System.Windows.Forms.Label
        Me.label3 = New System.Windows.Forms.Label
        Me.label2 = New System.Windows.Forms.Label
        Me.label1 = New System.Windows.Forms.Label
        Me.SuspendLayout()
        '
        'txtTolerance
        '
        Me.txtTolerance.Location = New System.Drawing.Point(152, 201)
        Me.txtTolerance.Name = "txtTolerance"
        Me.txtTolerance.Size = New System.Drawing.Size(80, 20)
        Me.txtTolerance.TabIndex = 31
        Me.txtTolerance.Text = ""
        '
        'chkGrid
        '
        Me.chkGrid.Location = New System.Drawing.Point(152, 225)
        Me.chkGrid.Name = "chkGrid"
        Me.chkGrid.Size = New System.Drawing.Size(24, 32)
        Me.chkGrid.TabIndex = 30
        '
        'chkSnapTips
        '
        Me.chkSnapTips.Location = New System.Drawing.Point(152, 161)
        Me.chkSnapTips.Name = "chkSnapTips"
        Me.chkSnapTips.Size = New System.Drawing.Size(24, 32)
        Me.chkSnapTips.TabIndex = 29
        '
        'txtFactor
        '
        Me.txtFactor.Location = New System.Drawing.Point(152, 137)
        Me.txtFactor.Name = "txtFactor"
        Me.txtFactor.Size = New System.Drawing.Size(80, 20)
        Me.txtFactor.TabIndex = 28
        Me.txtFactor.Text = ""
        '
        'cboUnits
        '
        Me.cboUnits.Items.AddRange(New Object() {"Radians", "Decimal Degrees", "Degrees Minutes Seconds", "Gradians", "Gons"})
        Me.cboUnits.Location = New System.Drawing.Point(122, 105)
        Me.cboUnits.Name = "cboUnits"
        Me.cboUnits.Size = New System.Drawing.Size(136, 21)
        Me.cboUnits.TabIndex = 27
        '
        'cboType
        '
        Me.cboType.Items.AddRange(New Object() {"North Azimuth", "South Azimuth", "Polar", "Quadrant Bearing"})
        Me.cboType.Location = New System.Drawing.Point(122, 73)
        Me.cboType.Name = "cboType"
        Me.cboType.Size = New System.Drawing.Size(136, 21)
        Me.cboType.TabIndex = 26
        '
        'txtPrecision
        '
        Me.txtPrecision.Location = New System.Drawing.Point(152, 41)
        Me.txtPrecision.Name = "txtPrecision"
        Me.txtPrecision.Size = New System.Drawing.Size(80, 20)
        Me.txtPrecision.TabIndex = 25
        Me.txtPrecision.Text = ""
        '
        'txtOffset
        '
        Me.txtOffset.Location = New System.Drawing.Point(152, 9)
        Me.txtOffset.Name = "txtOffset"
        Me.txtOffset.Size = New System.Drawing.Size(80, 20)
        Me.txtOffset.TabIndex = 24
        Me.txtOffset.Text = ""
        '
        'label8
        '
        Me.label8.Location = New System.Drawing.Point(8, 233)
        Me.label8.Name = "label8"
        Me.label8.Size = New System.Drawing.Size(120, 16)
        Me.label8.TabIndex = 23
        Me.label8.Text = "Use Ground to Grid:"
        '
        'label7
        '
        Me.label7.Location = New System.Drawing.Point(8, 201)
        Me.label7.Name = "label7"
        Me.label7.Size = New System.Drawing.Size(136, 16)
        Me.label7.TabIndex = 22
        Me.label7.Text = "Sticky Move Tolerance:"
        '
        'label6
        '
        Me.label6.Location = New System.Drawing.Point(8, 169)
        Me.label6.Name = "label6"
        Me.label6.Size = New System.Drawing.Size(88, 16)
        Me.label6.TabIndex = 21
        Me.label6.Text = "Snap Tips:"
        '
        'label5
        '
        Me.label5.Location = New System.Drawing.Point(8, 137)
        Me.label5.Name = "label5"
        Me.label5.Size = New System.Drawing.Size(144, 16)
        Me.label5.TabIndex = 20
        Me.label5.Text = "Distance Correction Factor:"
        '
        'label4
        '
        Me.label4.Location = New System.Drawing.Point(8, 105)
        Me.label4.Name = "label4"
        Me.label4.Size = New System.Drawing.Size(88, 16)
        Me.label4.TabIndex = 19
        Me.label4.Text = "Direction Units:"
        '
        'label3
        '
        Me.label3.Location = New System.Drawing.Point(8, 73)
        Me.label3.Name = "label3"
        Me.label3.Size = New System.Drawing.Size(88, 16)
        Me.label3.TabIndex = 18
        Me.label3.Text = "Direction Type:"
        '
        'label2
        '
        Me.label2.Location = New System.Drawing.Point(8, 41)
        Me.label2.Name = "label2"
        Me.label2.Size = New System.Drawing.Size(120, 16)
        Me.label2.TabIndex = 17
        Me.label2.Text = "Angular Unit Precision:"
        '
        'label1
        '
        Me.label1.Location = New System.Drawing.Point(8, 9)
        Me.label1.Name = "label1"
        Me.label1.Size = New System.Drawing.Size(136, 16)
        Me.label1.TabIndex = 16
        Me.label1.Text = "Angular Correction Offset:"
        '
        'EditProperties2
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(264, 262)
        Me.Controls.Add(Me.txtTolerance)
        Me.Controls.Add(Me.chkGrid)
        Me.Controls.Add(Me.chkSnapTips)
        Me.Controls.Add(Me.txtFactor)
        Me.Controls.Add(Me.cboUnits)
        Me.Controls.Add(Me.cboType)
        Me.Controls.Add(Me.txtPrecision)
        Me.Controls.Add(Me.txtOffset)
        Me.Controls.Add(Me.label8)
        Me.Controls.Add(Me.label7)
        Me.Controls.Add(Me.label6)
        Me.Controls.Add(Me.label5)
        Me.Controls.Add(Me.label4)
        Me.Controls.Add(Me.label3)
        Me.Controls.Add(Me.label2)
        Me.Controls.Add(Me.label1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
        Me.Name = "EditProperties2"
        Me.Text = "Edit Properties 2"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub EditProperties2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'Populate form with current IEngineProperties2 values 
        txtOffset.Text = m_engineEditProperties2.AngularCorrectionOffset.ToString()
        txtPrecision.Text = m_engineEditProperties2.AngularUnitPrecision.ToString()
        txtFactor.Text = m_engineEditProperties2.DistanceCorrectionFactor.ToString()
        txtTolerance.Text = m_engineEditProperties2.StickyMoveTolerance.ToString()

        If (m_engineEditProperties2.SnapTips) Then
            chkSnapTips.Checked = True
        Else
            chkSnapTips.Checked = False
        End If

        If (m_engineEditProperties2.UseGroundToGrid) Then
            chkGrid.Checked = True
        Else
            chkGrid.Checked = False
        End If

        'Select current direction type
        Dim type As esriEngineDirectionType
        type = m_engineEditProperties2.DirectionType

        Select Case (type.ToString())
            Case "esriEngineDTNorthAzimuth"
                cboType.SelectedItem = "North Azimuth"
                Exit Select
            Case "esriEngineDTSouthAzimuth"
                cboType.SelectedItem = "South Azimuth"
                Exit Select
            Case "esriEngineDTPolar"
                cboType.SelectedItem = "Polar"
                Exit Select
            Case "esriEngineDTQuadrantBearing"
                cboType.SelectedItem = "Quadrant Bearing"
                Exit Select
            Case Else
                Exit Select
        End Select


        'Select current direction units
        Dim units As esriEngineDirectionUnits
        units = m_engineEditProperties2.DirectionUnits
        Select Case (units.ToString())
            Case "esriEngineDURadians"
                cboUnits.SelectedItem = "Radians"
                Exit Select
            Case "esriEngineDUDecimalDegrees"
                cboUnits.SelectedItem = "Decimal Degrees"
                Exit Select
            Case "esriEngineDUDegreesMinutesSeconds"
                cboUnits.SelectedItem = "Degrees Minutes Seconds"
                Exit Select
            Case "esriEngineDUGradians"
                cboUnits.SelectedItem = "Gradians"
                Exit Select
            Case "esriEngineDUGons"
                cboUnits.SelectedItem = "Gons"
                Exit Select
            Case Else
                Exit Select
        End Select
    End Sub

    Private Sub EditProperties2_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing

        'Update Offset property
        If (txtOffset.Text <> "") Then
            m_engineEditProperties2.AngularCorrectionOffset = Convert.ToInt32(txtOffset.Text)
        End If

        'Update Precision property
        If (txtPrecision.Text <> "") Then
            m_engineEditProperties2.AngularUnitPrecision = Convert.ToInt32(txtPrecision.Text)
        End If

        'Update Distance Correction Factor property
        If (txtFactor.Text <> "") Then
            m_engineEditProperties2.DistanceCorrectionFactor = Convert.ToInt32(txtFactor.Text)
        End If

        'Update Tolerance property
        If (txtTolerance.Text <> "") Then
            m_engineEditProperties2.StickyMoveTolerance = Convert.ToInt32(txtTolerance.Text)
        End If

        'Update Snap Tips property
        If (chkSnapTips.Checked) Then
            m_engineEditProperties2.SnapTips = True
        Else
            m_engineEditProperties2.SnapTips = False
        End If

        'Update Grid property
        If (chkGrid.Checked) Then
            m_engineEditProperties2.UseGroundToGrid = True
        Else
            m_engineEditProperties2.UseGroundToGrid = False
        End If

        'Set Direction Type property
        Dim type As String
        type = cboType.SelectedItem.ToString()
        Select Case (Type)
            Case "North Azimuth"
                m_engineEditProperties2.DirectionType = esriEngineDirectionType.esriEngineDTNorthAzimuth
                Exit Select
            Case "South Azimuth"
                m_engineEditProperties2.DirectionType = esriEngineDirectionType.esriEngineDTSouthAzimuth
                Exit Select
            Case "Polar"
                m_engineEditProperties2.DirectionType = esriEngineDirectionType.esriEngineDTPolar
                Exit Select
            Case "Quadrant Bearing"
                m_engineEditProperties2.DirectionType = esriEngineDirectionType.esriEngineDTQuadrantBearing
            Case Else
                Exit Select
        End Select

        'Set Direction Units property
        Dim units As String
        units = cboUnits.SelectedItem.ToString()
        Select Case (units)
        Case "Radians"
                m_engineEditProperties2.DirectionUnits = esriEngineDirectionUnits.esriEngineDURadians
                Exit Select
            Case "Decimal Degrees"
                m_engineEditProperties2.DirectionUnits = esriEngineDirectionUnits.esriEngineDUDecimalDegrees
                Exit Select
            Case "Degrees Minutes Seconds"
                m_engineEditProperties2.DirectionUnits = esriEngineDirectionUnits.esriEngineDUDegreesMinutesSeconds
                Exit Select
            Case "Gradians"
                m_engineEditProperties2.DirectionUnits = esriEngineDirectionUnits.esriEngineDUGradians
                Exit Select
            Case "Gons"
                m_engineEditProperties2.DirectionUnits = esriEngineDirectionUnits.esriEngineDUGons
                Exit Select
            Case Else
                Exit Select
        End Select
    End Sub

    Private Sub txtOffset_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtOffset.TextChanged
        'Validate offset
        Try
            If (txtOffset.Text <> "") Then
                Convert.ToInt32(txtOffset.Text)
            End If
        Catch
            MessageBox.Show("Correction offset should be a numeric value", "Correction Offset")
            txtOffset.Text = ""
            txtOffset.Focus()
        End Try
    End Sub

    Private Sub txtPrecision_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPrecision.TextChanged
        'Validate precision
        Try
            If (txtPrecision.Text <> "") Then
                Convert.ToInt32(txtPrecision.Text)
            End If
        Catch
            MessageBox.Show("Unit precision should be a numeric value", "Unit Precision")
            txtPrecision.Text = ""
            txtPrecision.Focus()
        End Try
    End Sub

    Private Sub txtFactor_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtFactor.TextChanged
        'Validate factor
        Try
            If (txtFactor.Text <> "") Then
                Convert.ToInt32(txtFactor.Text)
            End If
        Catch
            MessageBox.Show("Distance Correction Factor should be a numeric value", "Distance Correction Factor")
            txtFactor.Text = ""
            txtFactor.Focus()
        End Try
    End Sub

    Private Sub txtTolerance_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTolerance.TextChanged
        'Validate tolerance
        Try
            If (txtTolerance.Text <> "") Then
                Convert.ToInt32(txtTolerance.Text)
            End If
        Catch
            MessageBox.Show("Sticky Move Tolerance should be a numeric value", "Sticky Move Tolerance")
            txtTolerance.Text = ""
            txtTolerance.Focus()
        End Try
    End Sub
End Class