// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors // This is the default contructor that calls the base class constructor. // This function determines the type of the edit control and then calls the default constructor. internal WindowsEditBox (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item) { _type = GetEditboxtype (hwnd); if (IsMultiline) { _cControlType = ControlType.Document; } else { _cControlType = ControlType.Edit; } // When embedded inside of the combobox, hide the edit portion in the content element tree _fIsContent = !IsInsideOfCombo(); _fIsKeyboardFocusable = true; if (IsInsideOfListView(hwnd)) { _sAutomationId = "edit"; } // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors // This is the default contructor that calls the base class constructor. // This function determines the type of the edit control and then calls the default constructor. internal WindowsEditBox(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { _type = GetEditboxtype(hwnd); if (IsMultiline) { _cControlType = ControlType.Document; } else { _cControlType = ControlType.Edit; } // When embedded inside of the combobox, hide the edit portion in the content element tree _fIsContent = !IsInsideOfCombo(); _fIsKeyboardFocusable = true; if (IsInsideOfListView(hwnd)) { _sAutomationId = "edit"; } // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsProgressBar(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { _cControlType = ControlType.ProgressBar; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsProgressBar (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item ) { _cControlType = ControlType.ProgressBar; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for the tooltip proxy class. WindowsTooltip (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item) { // Set the control type string to return properly the properties. _cControlType = ControlType.ToolTip; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsRebar(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { _sType = ST.Get(STID.LocalizedControlTypeRebar); _fIsContent = false; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsRebar (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item ) { _sType = ST.Get(STID.LocalizedControlTypeRebar); _fIsContent = false; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Construction/destruction // // ------------------------------------------------------ #region Constructors internal FormsLink(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.Hyperlink; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
//------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructor WindowsComboBox(IntPtr hwnd, ProxyFragment parent, IntPtr hwndEx, int item) : base(hwnd, parent, item) { _cControlType = ControlType.ComboBox; _hwndEx = hwndEx; _comboType = GetComboType(); _fIsKeyboardFocusable = true; _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Construction/destruction // // ------------------------------------------------------ #region Constructors internal FormsLink (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.Hyperlink; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsPager(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _sType = SR.Get(SRID.LocalizedControlTypePager); // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for the tooltip proxy class. WindowsTooltip(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // Set the control type string to return properly the properties. _cControlType = ControlType.ToolTip; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
//------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructor WindowsComboBox (IntPtr hwnd, ProxyFragment parent, IntPtr hwndEx, int item) : base(hwnd, parent, item) { _cControlType = ControlType.ComboBox; _hwndEx = hwndEx; _comboType = GetComboType (); _fIsKeyboardFocusable = true; _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
//------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors internal WindowsSysHeader (IntPtr hwnd) : base( hwnd, null, 0) { _cControlType = ControlType.Header; _fIsContent = false; _sAutomationId = "Header"; // This string is a non-localizable string // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
//------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors internal WindowsSysHeader(IntPtr hwnd) : base(hwnd, null, 0) { _cControlType = ControlType.Header; _fIsContent = false; _sAutomationId = "Header"; // This string is a non-localizable string // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors WindowsIPAddress (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item ) { // IP Address control itself is custom so need to also return LocalizedControlType property _cControlType = ControlType.Custom; _sType = ST.Get( STID.LocalizedControlTypeIPAddress ); ; _fIsKeyboardFocusable = true; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors WindowsIPAddress(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // IP Address control itself is custom so need to also return LocalizedControlType property _cControlType = ControlType.Custom; _sType = SR.Get(SRID.LocalizedControlTypeIPAddress);; _fIsKeyboardFocusable = true; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsAltTab(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { _fIsKeyboardFocusable = true; _cControlType = ControlType.List; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); GetAltTabInfo(_hwnd, 0, ref _altTabInfo, null); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsAltTab(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { _fIsKeyboardFocusable = true; _cControlType = ControlType.List; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); GetAltTabInfo(_hwnd, 0, ref _altTabInfo, null); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for WindownsSpinner class. Calls the base class constructor. internal WindowsSpinner(IntPtr hwndUpDown, IntPtr hwndEdit, ProxyFragment parent, int item) : base(hwndUpDown, parent, item) { _elEdit = new WindowsEditBox(hwndEdit, this, 0); _elUpDown = new WindowsUpDown(hwndUpDown, this, 0); // Set the strings to return properly the properties. _cControlType = ControlType.Spinner; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for WindownsSpinner class. Calls the base class constructor. internal WindowsSpinner(IntPtr hwndUpDown, IntPtr hwndEdit, ProxyFragment parent, int item) : base(hwndUpDown, parent, item) { _elEdit = new WindowsEditBox(hwndEdit, this, 0); _elUpDown = new WindowsUpDown(hwndUpDown, this, 0); // Set the strings to return properly the properties. _cControlType = ControlType.Spinner; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsSlider (IntPtr hwnd, ProxyFragment parent, int item) : base (hwnd, parent, item ) { _fHorizontal = IsHorizontalSlider (); _fIsKeyboardFocusable = true; // Set the strings to return properly the properties. _cControlType = ControlType.Slider; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsSlider(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { _fHorizontal = IsHorizontalSlider(); _fIsKeyboardFocusable = true; // Set the strings to return properly the properties. _cControlType = ControlType.Slider; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for SpinControlProxy class. Calls the base class constructor. internal WindowsUpDown(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.Spinner; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); // if spin is embedded in a tab control exclude from the content view. _fIsContent = !IsInsideOfTab(); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsTreeView (IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.Tree; // Can be focused _fIsKeyboardFocusable = true; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for SpinControlProxy class. Calls the base class constructor. internal WindowsUpDown (IntPtr hwnd, ProxyFragment parent, int item) : base (hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.Spinner; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); // if spin is embedded in a tab control exclude from the content view. _fIsContent = !IsInsideOfTab(); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors public WindowsTab (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item ) { // Set the strings to return properly the properties. _cControlType = ControlType.Tab; // force initialisation of this so it can be used later _windowsForms = WindowsFormsHelper.GetControlState (hwnd); // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); _fIsContent = IsValidControl(_hwnd); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsStatusBar(IntPtr hwnd, ProxyFragment parent, int item, Accessible acc) : base(hwnd, parent, item) { _acc = acc; _cControlType = ControlType.StatusBar; _fHasGrip = StatusBarGrip.HasGrip(hwnd); _sAutomationId = "StatusBar"; // This string is a non-localizable string // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors public WindowsTab(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.Tab; // force initialisation of this so it can be used later _windowsForms = WindowsFormsHelper.GetControlState(hwnd); // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); _fIsContent = IsValidControl(_hwnd); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsStatusBar(IntPtr hwnd, ProxyFragment parent, int item, Accessible acc) : base(hwnd, parent, item) { _acc = acc; _cControlType = ControlType.StatusBar; _fHasGrip = StatusBarGrip.HasGrip(hwnd); _sAutomationId = "StatusBar"; // This string is a non-localizable string // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsDateTimePicker(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // DateTimePicker is custom so need to also return LocalizedControlType property _cControlType = ControlType.Custom; _sType = SR.Get(SRID.LocalizedControlTypeDateTimePicker); // support for events _IsDropDownType = IsDropDownType(); _fIsKeyboardFocusable = true; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors // Contructor for Button Proxy class. // param "hwnd", Windows handle // param "parent", Proxy Parent. Null if it is a root fragment // param "type", Button / Checkbox / Radio / Group // param "style", Button Style (BS_*) also used as the Proxy ID // Made internal so that WinFormsHelper.CreateButton can use. internal WindowsButton (IntPtr hwnd, ProxyFragment parent, ButtonType type, int style, Accessible acc) : base( hwnd, parent, 0) { _type = type; _fIsKeyboardFocusable = true; _style = style; _acc = acc; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); // Set ControlType based on type // Note: Do not call LocalizedName() within the constructor // since it is a virtual method. Calling a virtual method // in a constructor would have unintended consequences for // derived classes. if(type == ButtonType.PushButton) { _cControlType = ControlType.Button; _fControlHasLabel = false; } else if(type == ButtonType.CheckBox) { _cControlType = ControlType.CheckBox; // If a check box has non-empty text, it has no associated label. _fControlHasLabel = string.IsNullOrEmpty(GetLocalizedName()); } else if(type == ButtonType.RadioButton) { _cControlType = ControlType.RadioButton; // If a radio button has non-empty text, it has no associated label. _fControlHasLabel = string.IsNullOrEmpty(GetLocalizedName()); } else if (type == ButtonType.GroupBox) { _cControlType = ControlType.Group; _fIsKeyboardFocusable = false; // If a group box has non-empty text, it has no associated label. _fControlHasLabel = string.IsNullOrEmpty(GetLocalizedName()); } else { _cControlType = ControlType.Custom; } }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors // Contructor for Button Proxy class. // param "hwnd", Windows handle // param "parent", Proxy Parent. Null if it is a root fragment // param "type", Button / Checkbox / Radio / Group // param "style", Button Style (BS_*) also used as the Proxy ID // Made internal so that WinFormsHelper.CreateButton can use. internal WindowsButton(IntPtr hwnd, ProxyFragment parent, ButtonType type, int style, Accessible acc) : base(hwnd, parent, 0) { _type = type; _fIsKeyboardFocusable = true; _style = style; _acc = acc; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); // Set ControlType based on type // Note: Do not call LocalizedName() within the constructor // since it is a virtual method. Calling a virtual method // in a constructor would have unintended consequences for // derived classes. if (type == ButtonType.PushButton) { _cControlType = ControlType.Button; _fControlHasLabel = false; } else if (type == ButtonType.CheckBox) { _cControlType = ControlType.CheckBox; // If a check box has non-empty text, it has no associated label. _fControlHasLabel = string.IsNullOrEmpty(GetLocalizedName()); } else if (type == ButtonType.RadioButton) { _cControlType = ControlType.RadioButton; // If a radio button has non-empty text, it has no associated label. _fControlHasLabel = string.IsNullOrEmpty(GetLocalizedName()); } else if (type == ButtonType.GroupBox) { _cControlType = ControlType.Group; _fIsKeyboardFocusable = false; // If a group box has non-empty text, it has no associated label. _fControlHasLabel = string.IsNullOrEmpty(GetLocalizedName()); } else { _cControlType = ControlType.Custom; } }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsListBox(IntPtr hwnd, ProxyFragment parent, int item, bool parentedByCombo) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _parentedByCombo = parentedByCombo; _fIsKeyboardFocusable = true; _cControlType = ControlType.List; _fIsContent = !_parentedByCombo; if (parentedByCombo) { _sAutomationId = "ListBox"; // This string is a non-localizable string } // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsListBox (IntPtr hwnd, ProxyFragment parent, int item, bool parentedByCombo) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _parentedByCombo = parentedByCombo; _fIsKeyboardFocusable = true; _cControlType = ControlType.List; _fIsContent = !_parentedByCombo; if (parentedByCombo) { _sAutomationId = "ListBox"; // This string is a non-localizable string } // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsRichEdit (IntPtr hwnd, ProxyFragment parent, int style) : base( hwnd, parent, style ) { _type = WindowsEditBox.GetEditboxtype(hwnd); if (IsMultiline) { _cControlType = ControlType.Document; } else { _cControlType = ControlType.Edit; } _fIsKeyboardFocusable = true; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsRichEdit(IntPtr hwnd, ProxyFragment parent, int style) : base(hwnd, parent, style) { _type = WindowsEditBox.GetEditboxtype(hwnd); if (IsMultiline) { _cControlType = ControlType.Document; } else { _cControlType = ControlType.Edit; } _fIsKeyboardFocusable = true; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsStatic (IntPtr hwnd, ProxyFragment parent, StaticType type, int style) : base( hwnd, parent, 0) { _type = type; _style = style; if (type == StaticType.Text) { _cControlType = ControlType.Text; _fIsContent = false; _fControlHasLabel = false; } else { _cControlType = ControlType.Image; } // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsStatic(IntPtr hwnd, ProxyFragment parent, StaticType type, int style) : base(hwnd, parent, 0) { _type = type; _style = style; if (type == StaticType.Text) { _cControlType = ControlType.Text; _fIsContent = false; _fControlHasLabel = false; } else { _cControlType = ControlType.Image; } // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsScrollBar(IntPtr hwnd, ProxyFragment parent, int item, int sbFlag) : base(hwnd, parent, item) { _sbFlag = sbFlag; // Never do any non client area cliping when dealing with the scroll bar and // scroll bar bits _fNonClientAreaElement = true; // Control Type _cControlType = ControlType.ScrollBar; // Only Focusable if it is a stand alone scroll bar _fIsKeyboardFocusable = IsStandAlone(); if (!IsStandAlone()) { _sAutomationId = sbFlag == NativeMethods.SB_VERT ? "Vertical ScrollBar" : "Horizontal ScrollBar"; // This string is a non-localizable string } // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsScrollBar (IntPtr hwnd, ProxyFragment parent, int item, int sbFlag) : base( hwnd, parent, item) { _sbFlag = sbFlag; // Never do any non client area cliping when dealing with the scroll bar and // scroll bar bits _fNonClientAreaElement = true; // Control Type _cControlType = ControlType.ScrollBar; // Only Focusable if it is a stand alone scroll bar _fIsKeyboardFocusable = IsStandAlone(); if (!IsStandAlone()) { _sAutomationId = sbFlag == NativeMethods.SB_VERT ? "Vertical ScrollBar" : "Horizontal ScrollBar"; // This string is a non-localizable string } // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
internal NonClientArea (IntPtr hwnd) : base( hwnd, null, 0 ) { _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
internal WindowsListView (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item ) { // Set the strings to return properly the properties. if (IsDetailMode(hwnd)) { _cControlType = ControlType.DataGrid; } else { _cControlType = ControlType.List; } // Can be focused _fIsKeyboardFocusable = true; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); // internally track some of the lv events WinEventTracker.AddToNotificationList (_hwnd, new WinEventTracker.ProxyRaiseEvents (WindowsListView.GroupSpecificEvents), _groupEvents, 3); }
internal NonClientArea(IntPtr hwnd) : base(hwnd, null, 0) { _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for WinformsSpinner class. Calls the base class constructor. internal WinformsSpinner(IntPtr hwnd, IntPtr hwndEdit, IntPtr hwndUpDown, ProxyFragment parent, int item) : base(hwnd, parent, item) { _elEdit = new WindowsEditBox(hwndEdit, this, (int)0); _elUpDown = new WindowsUpDown(hwndUpDown, this, (int)0); string text; try { text = Misc.ProxyGetText(hwndEdit); } catch (TimeoutException) { text = null; } catch (Win32Exception) { text = null; } if (!string.IsNullOrEmpty(text)) { try { double.Parse(text, NumberStyles.Any, CultureInfo.InvariantCulture); // the text parsed just fine so must be a number. _type = SpinnerType.Numeric; } catch (FormatException) { // the text is not a based 10 number. Check if the text is a hex number. try { int.Parse(text, NumberStyles.HexNumber, CultureInfo.InvariantCulture); // the text parsed just fine so must be a number. _type = SpinnerType.Numeric; } catch (FormatException) { // the text does not consist solely of an optional negative sign followed by a sequence of // digits ranging from 0 to 9, so this spinner must be a domain spinner _type = SpinnerType.Domain; } catch (OverflowException) { // the text represents a number less than MinValue or greater than MaxValue, but it is still // a number, therefore must be a numeric spinner _type = SpinnerType.Numeric; } } catch (OverflowException) { // the text represents a number less than MinValue or greater than MaxValue, but it is still // a number, therefore must be a numeric spinner _type = SpinnerType.Numeric; } } else { // numeric spinners always have a value. The defualt state of a domain spinner // may be blank. The text value is blank so this must be a domain spinner. _type = SpinnerType.Domain; } // Set the strings to return properly the properties. _cControlType = ControlType.Spinner; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(WindowsUpDown.RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for WinformsSpinner class. Calls the base class constructor. internal WinformsSpinner(IntPtr hwnd, IntPtr hwndEdit, IntPtr hwndUpDown, ProxyFragment parent, int item) : base(hwnd, parent, item) { _elEdit = new WindowsEditBox(hwndEdit, this, (int)0); _elUpDown = new WindowsUpDown(hwndUpDown, this, (int)0); string text; try { text = Misc.ProxyGetText(hwndEdit); } catch (TimeoutException) { text = null; } catch (Win32Exception) { text = null; } if (!string.IsNullOrEmpty(text)) { try { double.Parse(text, NumberStyles.Any, CultureInfo.InvariantCulture); // the text parsed just fine so must be a number. _type = SpinnerType.Numeric; } catch (FormatException) { // the text is not a based 10 number. Check if the text is a hex number. try { int.Parse(text, NumberStyles.HexNumber, CultureInfo.InvariantCulture); // the text parsed just fine so must be a number. _type = SpinnerType.Numeric; } catch (FormatException) { // the text does not consist solely of an optional negative sign followed by a sequence of // digits ranging from 0 to 9, so this spinner must be a domain spinner _type = SpinnerType.Domain; } catch (OverflowException) { // the text represents a number less than MinValue or greater than MaxValue, but it is still // a number, therefore must be a numeric spinner _type = SpinnerType.Numeric; } } catch (OverflowException) { // the text represents a number less than MinValue or greater than MaxValue, but it is still // a number, therefore must be a numeric spinner _type = SpinnerType.Numeric; } } else { // numeric spinners always have a value. The defualt state of a domain spinner // may be blank. The text value is blank so this must be a domain spinner. _type = SpinnerType.Domain; } // Set the strings to return properly the properties. _cControlType = ControlType.Spinner; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(WindowsUpDown.RaiseEvents); }