提交 869fd033 编写于 作者: M Miguel de Icaza

[winforms] Pass 4 of removing NET_2_0 from winforms

上级 60ca042c
...@@ -33,10 +33,8 @@ using System.Windows.Forms.Theming; ...@@ -33,10 +33,8 @@ using System.Windows.Forms.Theming;
using System.Windows.Forms.VisualStyles; using System.Windows.Forms.VisualStyles;
namespace System.Windows.Forms { namespace System.Windows.Forms {
#if NET_2_0
[ComVisibleAttribute (true)] [ComVisibleAttribute (true)]
[ClassInterfaceAttribute (ClassInterfaceType.AutoDispatch)] [ClassInterfaceAttribute (ClassInterfaceType.AutoDispatch)]
#endif
[DefaultEvent("SelectedIndexChanged")] [DefaultEvent("SelectedIndexChanged")]
[DefaultProperty("TabPages")] [DefaultProperty("TabPages")]
[Designer("System.Windows.Forms.Design.TabControlDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")] [Designer("System.Windows.Forms.Design.TabControlDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
...@@ -66,13 +64,10 @@ namespace System.Windows.Forms { ...@@ -66,13 +64,10 @@ namespace System.Windows.Forms {
ToolTip.TipState tooltip_state = ToolTip.TipState.Down; ToolTip.TipState tooltip_state = ToolTip.TipState.Down;
Timer tooltip_timer; Timer tooltip_timer;
#if NET_2_0
private bool rightToLeftLayout; private bool rightToLeftLayout;
#endif
#endregion // Fields #endregion // Fields
#region UIA Framework Events #region UIA Framework Events
#if NET_2_0
static object UIAHorizontallyScrollableChangedEvent = new object (); static object UIAHorizontallyScrollableChangedEvent = new object ();
internal event EventHandler UIAHorizontallyScrollableChanged { internal event EventHandler UIAHorizontallyScrollableChanged {
...@@ -102,15 +97,12 @@ namespace System.Windows.Forms { ...@@ -102,15 +97,12 @@ namespace System.Windows.Forms {
if (eh != null) if (eh != null)
eh (this, e); eh (this, e);
} }
#endif
#endregion #endregion
#region UIA Framework Property #region UIA Framework Property
#if NET_2_0
internal double UIAHorizontalViewSize { internal double UIAHorizontalViewSize {
get { return LeftScrollButtonArea.Left * 100 / TabPages [TabCount - 1].TabBounds.Right; } get { return LeftScrollButtonArea.Left * 100 / TabPages [TabCount - 1].TabBounds.Right; }
} }
#endif
#endregion #endregion
#region Public Constructors #region Public Constructors
...@@ -171,14 +163,12 @@ namespace System.Windows.Forms { ...@@ -171,14 +163,12 @@ namespace System.Windows.Forms {
set { base.BackgroundImage = value; } set { base.BackgroundImage = value; }
} }
#if NET_2_0
[Browsable (false)] [Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]
public override ImageLayout BackgroundImageLayout { public override ImageLayout BackgroundImageLayout {
get { return base.BackgroundImageLayout; } get { return base.BackgroundImageLayout; }
set { base.BackgroundImageLayout = value; } set { base.BackgroundImageLayout = value; }
} }
#endif
public override Rectangle DisplayRectangle { public override Rectangle DisplayRectangle {
get { get {
...@@ -186,13 +176,11 @@ namespace System.Windows.Forms { ...@@ -186,13 +176,11 @@ namespace System.Windows.Forms {
} }
} }
#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]
protected override bool DoubleBuffered { protected override bool DoubleBuffered {
get { return base.DoubleBuffered; } get { return base.DoubleBuffered; }
set { base.DoubleBuffered = value; } set { base.DoubleBuffered = value; }
} }
#endif
[DefaultValue(TabDrawMode.Normal)] [DefaultValue(TabDrawMode.Normal)]
public TabDrawMode DrawMode { public TabDrawMode DrawMode {
...@@ -223,9 +211,7 @@ namespace System.Windows.Forms { ...@@ -223,9 +211,7 @@ namespace System.Windows.Forms {
} }
} }
#if NET_2_0
[RefreshProperties (RefreshProperties.Repaint)] [RefreshProperties (RefreshProperties.Repaint)]
#endif
[DefaultValue(null)] [DefaultValue(null)]
public ImageList ImageList { public ImageList ImageList {
get { return image_list; } get { return image_list; }
...@@ -279,9 +265,7 @@ namespace System.Windows.Forms { ...@@ -279,9 +265,7 @@ namespace System.Windows.Forms {
[Localizable(true)] [Localizable(true)]
public public
#if NET_2_0
new new
#endif
Point Padding { Point Padding {
get { return padding; } get { return padding; }
set { set {
...@@ -295,7 +279,6 @@ namespace System.Windows.Forms { ...@@ -295,7 +279,6 @@ namespace System.Windows.Forms {
} }
#if NET_2_0
[MonoTODO ("RTL not supported")] [MonoTODO ("RTL not supported")]
[Localizable (true)] [Localizable (true)]
[DefaultValue (false)] [DefaultValue (false)]
...@@ -308,7 +291,6 @@ namespace System.Windows.Forms { ...@@ -308,7 +291,6 @@ namespace System.Windows.Forms {
} }
} }
} }
#endif
[Browsable(false)] [Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
...@@ -323,20 +305,12 @@ namespace System.Windows.Forms { ...@@ -323,20 +305,12 @@ namespace System.Windows.Forms {
set { set {
if (value < -1) { if (value < -1) {
#if NET_2_0
throw new ArgumentOutOfRangeException ("SelectedIndex", "Value of '" + value + "' is valid for 'SelectedIndex'. " + throw new ArgumentOutOfRangeException ("SelectedIndex", "Value of '" + value + "' is valid for 'SelectedIndex'. " +
"'SelectedIndex' must be greater than or equal to -1."); "'SelectedIndex' must be greater than or equal to -1.");
#else
throw new ArgumentException ("'" + value + "' is not a valid value for 'value'. " +
"'value' must be greater than or equal to -1.");
#endif
} }
if (!this.IsHandleCreated) { if (!this.IsHandleCreated) {
if (selected_index != value) { if (selected_index != value) {
selected_index = value; selected_index = value;
#if !NET_2_0
OnSelectedIndexChanged (EventArgs.Empty);
#endif
} }
return; return;
} }
...@@ -353,27 +327,23 @@ namespace System.Windows.Forms { ...@@ -353,27 +327,23 @@ namespace System.Windows.Forms {
return; return;
} }
#if NET_2_0
TabControlCancelEventArgs ret = new TabControlCancelEventArgs (SelectedTab, selected_index, false, TabControlAction.Deselecting); TabControlCancelEventArgs ret = new TabControlCancelEventArgs (SelectedTab, selected_index, false, TabControlAction.Deselecting);
OnDeselecting (ret); OnDeselecting (ret);
if (ret.Cancel) if (ret.Cancel)
return; return;
#endif
Focus (); Focus ();
int old_index = selected_index; int old_index = selected_index;
int new_index = value; int new_index = value;
selected_index = new_index; selected_index = new_index;
#if NET_2_0
ret = new TabControlCancelEventArgs (SelectedTab, selected_index, false, TabControlAction.Selecting); ret = new TabControlCancelEventArgs (SelectedTab, selected_index, false, TabControlAction.Selecting);
OnSelecting (ret); OnSelecting (ret);
if (ret.Cancel) { if (ret.Cancel) {
selected_index = old_index; selected_index = old_index;
return; return;
} }
#endif
SuspendLayout (); SuspendLayout ();
...@@ -492,11 +462,7 @@ namespace System.Windows.Forms { ...@@ -492,11 +462,7 @@ namespace System.Windows.Forms {
} }
} }
#if NET_2_0
[Editor ("System.Windows.Forms.Design.TabPageCollectionEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))] [Editor ("System.Windows.Forms.Design.TabPageCollectionEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
#else
[DefaultValue(null)]
#endif
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[MergableProperty(false)] [MergableProperty(false)]
public TabPageCollection TabPages { public TabPageCollection TabPages {
...@@ -518,10 +484,8 @@ namespace System.Windows.Forms { ...@@ -518,10 +484,8 @@ namespace System.Windows.Forms {
set { set {
show_slider = value; show_slider = value;
#if NET_2_0
// UIA Framework Event: HorizontallyScrollable Changed // UIA Framework Event: HorizontallyScrollable Changed
OnUIAHorizontallyScrollableChanged (EventArgs.Empty); OnUIAHorizontallyScrollableChanged (EventArgs.Empty);
#endif
} }
} }
...@@ -613,7 +577,6 @@ namespace System.Windows.Forms { ...@@ -613,7 +577,6 @@ namespace System.Windows.Forms {
return GetTab (index); return GetTab (index);
} }
#if NET_2_0
public void SelectTab (TabPage tabPage) public void SelectTab (TabPage tabPage)
{ {
if (tabPage == null) if (tabPage == null)
...@@ -664,7 +627,6 @@ namespace System.Windows.Forms { ...@@ -664,7 +627,6 @@ namespace System.Windows.Forms {
} }
} }
#endif
public override string ToString () public override string ToString ()
{ {
...@@ -767,7 +729,6 @@ namespace System.Windows.Forms { ...@@ -767,7 +729,6 @@ namespace System.Windows.Forms {
pe.Handled = true; pe.Handled = true;
} }
#if NET_2_0
protected override void OnEnter (EventArgs e) protected override void OnEnter (EventArgs e)
{ {
base.OnEnter (e); base.OnEnter (e);
...@@ -835,7 +796,6 @@ namespace System.Windows.Forms { ...@@ -835,7 +796,6 @@ namespace System.Windows.Forms {
if (this.SelectedTab != null) if (this.SelectedTab != null)
this.SelectedTab.FireEnter (); this.SelectedTab.FireEnter ();
} }
#endif
#endregion #endregion
...@@ -937,11 +897,7 @@ namespace System.Windows.Forms { ...@@ -937,11 +897,7 @@ namespace System.Windows.Forms {
} }
#endregion #endregion
#if NET_2_0
protected void UpdateTabSelection (bool updateFocus) protected void UpdateTabSelection (bool updateFocus)
#else
protected void UpdateTabSelection (bool uiselected)
#endif
{ {
ResizeTabPages (); ResizeTabPages ();
} }
...@@ -998,10 +954,8 @@ namespace System.Windows.Forms { ...@@ -998,10 +954,8 @@ namespace System.Windows.Forms {
slider_pos++; slider_pos++;
SizeTabs (); SizeTabs ();
#if NET_2_0
// UIA Framework Event: Horizontally Scrolled // UIA Framework Event: Horizontally Scrolled
OnUIAHorizontallyScrolled (EventArgs.Empty); OnUIAHorizontallyScrolled (EventArgs.Empty);
#endif
switch (this.Alignment) { switch (this.Alignment) {
case TabAlignment.Top: case TabAlignment.Top:
...@@ -1028,10 +982,8 @@ namespace System.Windows.Forms { ...@@ -1028,10 +982,8 @@ namespace System.Windows.Forms {
slider_pos--; slider_pos--;
SizeTabs (); SizeTabs ();
#if NET_2_0
// UIA Framework Event: Horizontally Scrolled // UIA Framework Event: Horizontally Scrolled
OnUIAHorizontallyScrolled (EventArgs.Empty); OnUIAHorizontallyScrolled (EventArgs.Empty);
#endif
switch (this.Alignment) { switch (this.Alignment) {
case TabAlignment.Top: case TabAlignment.Top:
...@@ -1500,7 +1452,6 @@ namespace System.Windows.Forms { ...@@ -1500,7 +1452,6 @@ namespace System.Windows.Forms {
this.Controls.SetChildIndex (value, index); this.Controls.SetChildIndex (value, index);
Redraw (); Redraw ();
} }
#if NET_2_0
private void InsertTab (int index, TabPage value) private void InsertTab (int index, TabPage value)
{ {
if (!tab_pages.Contains (value)) { if (!tab_pages.Contains (value)) {
...@@ -1509,7 +1460,6 @@ namespace System.Windows.Forms { ...@@ -1509,7 +1460,6 @@ namespace System.Windows.Forms {
this.Controls.SetChildIndex (value, index); this.Controls.SetChildIndex (value, index);
Redraw (); Redraw ();
} }
#endif
internal void Redraw () internal void Redraw ()
{ {
if (!IsHandleCreated) if (!IsHandleCreated)
...@@ -1644,7 +1594,6 @@ namespace System.Windows.Forms { ...@@ -1644,7 +1594,6 @@ namespace System.Windows.Forms {
remove { base.BackgroundImageChanged -= value; } remove { base.BackgroundImageChanged -= value; }
} }
#if NET_2_0
[Browsable (false)] [Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]
public new event EventHandler BackgroundImageLayoutChanged public new event EventHandler BackgroundImageLayoutChanged
...@@ -1652,7 +1601,6 @@ namespace System.Windows.Forms { ...@@ -1652,7 +1601,6 @@ namespace System.Windows.Forms {
add { base.BackgroundImageLayoutChanged += value; } add { base.BackgroundImageLayoutChanged += value; }
remove { base.BackgroundImageLayoutChanged -= value; } remove { base.BackgroundImageLayoutChanged -= value; }
} }
#endif
[Browsable(false)] [Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]
...@@ -1688,7 +1636,6 @@ namespace System.Windows.Forms { ...@@ -1688,7 +1636,6 @@ namespace System.Windows.Forms {
remove { Events.RemoveHandler (SelectedIndexChangedEvent, value); } remove { Events.RemoveHandler (SelectedIndexChangedEvent, value); }
} }
#if NET_2_0
static object SelectedEvent = new object (); static object SelectedEvent = new object ();
public event TabControlEventHandler Selected { public event TabControlEventHandler Selected {
...@@ -1726,14 +1673,11 @@ namespace System.Windows.Forms { ...@@ -1726,14 +1673,11 @@ namespace System.Windows.Forms {
add { Events.AddHandler (RightToLeftLayoutChangedEvent, value); } add { Events.AddHandler (RightToLeftLayoutChangedEvent, value); }
remove { Events.RemoveHandler (RightToLeftLayoutChangedEvent, value); } remove { Events.RemoveHandler (RightToLeftLayoutChangedEvent, value); }
} }
#endif
#endregion // Events #endregion // Events
#region Class TaControl.ControlCollection #region Class TaControl.ControlCollection
#if NET_2_0
[ComVisible (false)] [ComVisible (false)]
#endif
public new class ControlCollection : System.Windows.Forms.Control.ControlCollection { public new class ControlCollection : System.Windows.Forms.Control.ControlCollection {
private TabControl owner; private TabControl owner;
...@@ -1821,7 +1765,6 @@ namespace System.Windows.Forms { ...@@ -1821,7 +1765,6 @@ namespace System.Windows.Forms {
owner.SetTab (index, value); owner.SetTab (index, value);
} }
} }
#if NET_2_0
public virtual TabPage this [string key] { public virtual TabPage this [string key] {
get { get {
if (string.IsNullOrEmpty (key)) if (string.IsNullOrEmpty (key))
...@@ -1834,7 +1777,6 @@ namespace System.Windows.Forms { ...@@ -1834,7 +1777,6 @@ namespace System.Windows.Forms {
return this[index]; return this[index];
} }
} }
#endif
internal int this[TabPage tabPage] { internal int this[TabPage tabPage] {
get { get {
...@@ -1877,7 +1819,6 @@ namespace System.Windows.Forms { ...@@ -1877,7 +1819,6 @@ namespace System.Windows.Forms {
owner.Controls.Add (value); owner.Controls.Add (value);
} }
#if NET_2_0
public void Add (string text) public void Add (string text)
{ {
TabPage page = new TabPage (text); TabPage page = new TabPage (text);
...@@ -1907,7 +1848,6 @@ namespace System.Windows.Forms { ...@@ -1907,7 +1848,6 @@ namespace System.Windows.Forms {
page.ImageKey = imageKey; page.ImageKey = imageKey;
this.Add (page); this.Add (page);
} }
#endif
public void AddRange (TabPage [] pages) public void AddRange (TabPage [] pages)
{ {
...@@ -1929,13 +1869,11 @@ namespace System.Windows.Forms { ...@@ -1929,13 +1869,11 @@ namespace System.Windows.Forms {
return owner.Controls.Contains (page); return owner.Controls.Contains (page);
} }
#if NET_2_0
public virtual bool ContainsKey (string key) public virtual bool ContainsKey (string key)
{ {
int index = this.IndexOfKey (key); int index = this.IndexOfKey (key);
return (index >= 0 && index < this.Count); return (index >= 0 && index < this.Count);
} }
#endif
public IEnumerator GetEnumerator () public IEnumerator GetEnumerator ()
{ {
...@@ -1947,7 +1885,6 @@ namespace System.Windows.Forms { ...@@ -1947,7 +1885,6 @@ namespace System.Windows.Forms {
return owner.Controls.IndexOf (page); return owner.Controls.IndexOf (page);
} }
#if NET_2_0
public virtual int IndexOfKey(string key) public virtual int IndexOfKey(string key)
{ {
if (string.IsNullOrEmpty (key)) if (string.IsNullOrEmpty (key))
...@@ -1962,7 +1899,6 @@ namespace System.Windows.Forms { ...@@ -1962,7 +1899,6 @@ namespace System.Windows.Forms {
return -1; return -1;
} }
#endif
public void Remove (TabPage value) public void Remove (TabPage value)
{ {
...@@ -1976,14 +1912,12 @@ namespace System.Windows.Forms { ...@@ -1976,14 +1912,12 @@ namespace System.Windows.Forms {
owner.Invalidate (); owner.Invalidate ();
} }
#if NET_2_0
public virtual void RemoveByKey (string key) public virtual void RemoveByKey (string key)
{ {
int index = this.IndexOfKey (key); int index = this.IndexOfKey (key);
if (index >= 0 && index < this.Count) if (index >= 0 && index < this.Count)
this.RemoveAt (index); this.RemoveAt (index);
} }
#endif
void ICollection.CopyTo (Array dest, int index) void ICollection.CopyTo (Array dest, int index)
{ {
...@@ -2015,16 +1949,11 @@ namespace System.Windows.Forms { ...@@ -2015,16 +1949,11 @@ namespace System.Windows.Forms {
return IndexOf (tabPage); return IndexOf (tabPage);
} }
#if NET_2_0
void IList.Insert (int index, object tabPage) void IList.Insert (int index, object tabPage)
#else
void IList.Insert (int index, object value)
#endif
{ {
throw new NotSupportedException (); throw new NotSupportedException ();
} }
#if NET_2_0
public void Insert (int index, string text) public void Insert (int index, string text)
{ {
owner.InsertTab (index, new TabPage (text)); owner.InsertTab (index, new TabPage (text));
...@@ -2057,7 +1986,6 @@ namespace System.Windows.Forms { ...@@ -2057,7 +1986,6 @@ namespace System.Windows.Forms {
owner.InsertTab (index, page); owner.InsertTab (index, page);
page.ImageKey = imageKey; page.ImageKey = imageKey;
} }
#endif
void IList.Remove (object value) void IList.Remove (object value)
{ {
TabPage page = value as TabPage; TabPage page = value as TabPage;
......
...@@ -38,11 +38,9 @@ using System.Collections; ...@@ -38,11 +38,9 @@ using System.Collections;
namespace System.Windows.Forms namespace System.Windows.Forms
{ {
#if NET_2_0
[ComVisible (true)] [ComVisible (true)]
[DefaultBindingProperty ("Text")] [DefaultBindingProperty ("Text")]
[ClassInterface (ClassInterfaceType.AutoDispatch)] [ClassInterface (ClassInterfaceType.AutoDispatch)]
#endif
[DefaultEvent("TextChanged")] [DefaultEvent("TextChanged")]
[Designer("System.Windows.Forms.Design.TextBoxBaseDesigner, " + Consts.AssemblySystem_Design)] [Designer("System.Windows.Forms.Design.TextBoxBaseDesigner, " + Consts.AssemblySystem_Design)]
public abstract class TextBoxBase : Control public abstract class TextBoxBase : Control
...@@ -154,11 +152,9 @@ namespace System.Windows.Forms ...@@ -154,11 +152,9 @@ namespace System.Windows.Forms
ResumeLayout (); ResumeLayout ();
SetStyle(ControlStyles.UserPaint | ControlStyles.StandardClick, false); SetStyle(ControlStyles.UserPaint | ControlStyles.StandardClick, false);
#if NET_2_0
SetStyle(ControlStyles.UseTextForAccessibility, false); SetStyle(ControlStyles.UseTextForAccessibility, false);
base.SetAutoSizeMode (AutoSizeMode.GrowAndShrink); base.SetAutoSizeMode (AutoSizeMode.GrowAndShrink);
#endif
canvas_width = ClientSize.Width; canvas_width = ClientSize.Width;
canvas_height = ClientSize.Height; canvas_height = ClientSize.Height;
...@@ -179,12 +175,10 @@ namespace System.Windows.Forms ...@@ -179,12 +175,10 @@ namespace System.Windows.Forms
return s.ToUpper(); return s.ToUpper();
} }
#if NET_2_0
internal override Size GetPreferredSizeCore (Size proposedSize) internal override Size GetPreferredSizeCore (Size proposedSize)
{ {
return new Size (Width, Height); return new Size (Width, Height);
} }
#endif
internal override void HandleClick (int clicks, MouseEventArgs me) internal override void HandleClick (int clicks, MouseEventArgs me)
{ {
...@@ -228,21 +222,13 @@ namespace System.Windows.Forms ...@@ -228,21 +222,13 @@ namespace System.Windows.Forms
} }
} }
#if NET_2_0
[Browsable (false)] [Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]
#endif
[DefaultValue(true)] [DefaultValue(true)]
[Localizable(true)] [Localizable(true)]
[RefreshProperties(RefreshProperties.Repaint)] [RefreshProperties(RefreshProperties.Repaint)]
[MWFCategory("Behavior")] [MWFCategory("Behavior")]
public public override bool AutoSize {
#if NET_2_0
override
#else
virtual
#endif
bool AutoSize {
get { get {
return auto_size; return auto_size;
} }
...@@ -255,9 +241,6 @@ namespace System.Windows.Forms ...@@ -255,9 +241,6 @@ namespace System.Windows.Forms
ClientSize = new Size(ClientSize.Width, PreferredHeight); ClientSize = new Size(ClientSize.Width, PreferredHeight);
} }
} }
#if NET_1_1
OnAutoSizeChanged(EventArgs.Empty);
#endif
} }
} }
} }
...@@ -342,9 +325,7 @@ namespace System.Windows.Forms ...@@ -342,9 +325,7 @@ namespace System.Windows.Forms
} }
} }
#if NET_2_0
[MergableProperty (false)] [MergableProperty (false)]
#endif
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Editor("System.Windows.Forms.Design.StringArrayEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))] [Editor("System.Windows.Forms.Design.StringArrayEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
[Localizable(true)] [Localizable(true)]
...@@ -496,9 +477,7 @@ namespace System.Windows.Forms ...@@ -496,9 +477,7 @@ namespace System.Windows.Forms
} }
} }
#if NET_2_0
[RefreshProperties (RefreshProperties.Repaint)] [RefreshProperties (RefreshProperties.Repaint)]
#endif
[DefaultValue(false)] [DefaultValue(false)]
[MWFCategory("Behavior")] [MWFCategory("Behavior")]
public bool ReadOnly { public bool ReadOnly {
...@@ -509,14 +488,12 @@ namespace System.Windows.Forms ...@@ -509,14 +488,12 @@ namespace System.Windows.Forms
set { set {
if (value != read_only) { if (value != read_only) {
read_only = value; read_only = value;
#if NET_2_0
if (!backcolor_set) { if (!backcolor_set) {
if (read_only) if (read_only)
background_color = SystemColors.Control; background_color = SystemColors.Control;
else else
background_color = SystemColors.Window; background_color = SystemColors.Window;
} }
#endif
OnReadOnlyChanged(EventArgs.Empty); OnReadOnlyChanged(EventArgs.Empty);
Invalidate (); Invalidate ();
} }
...@@ -529,10 +506,6 @@ namespace System.Windows.Forms ...@@ -529,10 +506,6 @@ namespace System.Windows.Forms
get { get {
string retval = document.GetSelection (); string retval = document.GetSelection ();
#if ONLY_1_1
if (!IsHandleCreated && retval == string.Empty)
return null;
#endif
return retval; return retval;
} }
...@@ -550,22 +523,13 @@ namespace System.Windows.Forms ...@@ -550,22 +523,13 @@ namespace System.Windows.Forms
get { get {
int res = document.SelectionLength (); int res = document.SelectionLength ();
#if !NET_2_0
if (res == 0 && !IsHandleCreated)
res = -1;
#endif
return res; return res;
} }
set { set {
if (value < 0) { if (value < 0) {
string msg = String.Format ("'{0}' is not a valid value for 'SelectionLength'", value); string msg = String.Format ("'{0}' is not a valid value for 'SelectionLength'", value);
#if NET_2_0
throw new ArgumentOutOfRangeException ("SelectionLength", msg); throw new ArgumentOutOfRangeException ("SelectionLength", msg);
#else
throw new ArgumentException (msg);
#endif
} }
document.InvalidateSelectionArea (); document.InvalidateSelectionArea ();
...@@ -599,11 +563,7 @@ namespace System.Windows.Forms ...@@ -599,11 +563,7 @@ namespace System.Windows.Forms
set { set {
if (value < 0) { if (value < 0) {
string msg = String.Format ("'{0}' is not a valid value for 'SelectionStart'", value); string msg = String.Format ("'{0}' is not a valid value for 'SelectionStart'", value);
#if NET_2_0
throw new ArgumentOutOfRangeException ("SelectionStart", msg); throw new ArgumentOutOfRangeException ("SelectionStart", msg);
#else
throw new ArgumentException (msg);
#endif
} }
// If SelectionStart has been used, we don't highlight on focus // If SelectionStart has been used, we don't highlight on focus
...@@ -620,7 +580,6 @@ namespace System.Windows.Forms ...@@ -620,7 +580,6 @@ namespace System.Windows.Forms
} }
} }
#if NET_2_0
[DefaultValue (true)] [DefaultValue (true)]
public virtual bool ShortcutsEnabled { public virtual bool ShortcutsEnabled {
get { return shortcuts_enabled; } get { return shortcuts_enabled; }
...@@ -629,7 +588,6 @@ namespace System.Windows.Forms ...@@ -629,7 +588,6 @@ namespace System.Windows.Forms
[Editor ("System.ComponentModel.Design.MultilineStringEditor, " + Consts.AssemblySystem_Design, [Editor ("System.ComponentModel.Design.MultilineStringEditor, " + Consts.AssemblySystem_Design,
"System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)] "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
#endif
[Localizable(true)] [Localizable(true)]
public override string Text { public override string Text {
get { get {
...@@ -701,7 +659,6 @@ namespace System.Windows.Forms ...@@ -701,7 +659,6 @@ namespace System.Windows.Forms
} }
} }
#if NET_2_0
[Browsable (false)] [Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]
public override ImageLayout BackgroundImageLayout { public override ImageLayout BackgroundImageLayout {
...@@ -720,11 +677,9 @@ namespace System.Windows.Forms ...@@ -720,11 +677,9 @@ namespace System.Windows.Forms
protected override Cursor DefaultCursor { protected override Cursor DefaultCursor {
get { return Cursors.IBeam; } get { return Cursors.IBeam; }
} }
#endif
#endregion // Public Instance Properties #endregion // Public Instance Properties
#region Protected Instance Properties #region Protected Instance Properties
#if NET_2_0
protected override bool CanEnableIme { protected override bool CanEnableIme {
get { get {
if (ReadOnly || password_char != '\0') if (ReadOnly || password_char != '\0')
...@@ -733,7 +688,6 @@ namespace System.Windows.Forms ...@@ -733,7 +688,6 @@ namespace System.Windows.Forms
return true; return true;
} }
} }
#endif
protected override CreateParams CreateParams { protected override CreateParams CreateParams {
get { get {
...@@ -747,14 +701,12 @@ namespace System.Windows.Forms ...@@ -747,14 +701,12 @@ namespace System.Windows.Forms
} }
} }
#if NET_2_0
// Currently our double buffering breaks our scrolling, so don't let people enable this // Currently our double buffering breaks our scrolling, so don't let people enable this
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]
protected override bool DoubleBuffered { protected override bool DoubleBuffered {
get { return false; } get { return false; }
set { } set { }
} }
#endif
#endregion // Protected Instance Properties #endregion // Protected Instance Properties
...@@ -882,7 +834,6 @@ namespace System.Windows.Forms ...@@ -882,7 +834,6 @@ namespace System.Windows.Forms
} }
} }
#if NET_2_0
public void DeselectAll () public void DeselectAll ()
{ {
SelectionLength = 0; SelectionLength = 0;
...@@ -974,7 +925,6 @@ namespace System.Windows.Forms ...@@ -974,7 +925,6 @@ namespace System.Windows.Forms
{ {
return document.LineTagToCharIndex (document.caret.line, 0); return document.LineTagToCharIndex (document.caret.line, 0);
} }
#endif
#endregion // Public Instance Methods #endregion // Public Instance Methods
#region Protected Instance Methods #region Protected Instance Methods
...@@ -1028,15 +978,6 @@ namespace System.Windows.Forms ...@@ -1028,15 +978,6 @@ namespace System.Windows.Forms
eh (this, e); eh (this, e);
} }
#if ONLY_1_1
protected virtual void OnAutoSizeChanged (EventArgs e)
{
EventHandler eh = (EventHandler)(Events [AutoSizeChangedEvent]);
if (eh != null)
eh (this, e);
}
#endif
protected virtual void OnBorderStyleChanged (EventArgs e) protected virtual void OnBorderStyleChanged (EventArgs e)
{ {
EventHandler eh = (EventHandler)(Events [BorderStyleChangedEvent]); EventHandler eh = (EventHandler)(Events [BorderStyleChangedEvent]);
...@@ -1087,12 +1028,10 @@ namespace System.Windows.Forms ...@@ -1087,12 +1028,10 @@ namespace System.Windows.Forms
eh (this, e); eh (this, e);
} }
#if NET_2_0
protected override void OnPaddingChanged (EventArgs e) protected override void OnPaddingChanged (EventArgs e)
{ {
base.OnPaddingChanged (e); base.OnPaddingChanged (e);
} }
#endif
protected virtual void OnReadOnlyChanged (EventArgs e) protected virtual void OnReadOnlyChanged (EventArgs e)
{ {
...@@ -1101,12 +1040,10 @@ namespace System.Windows.Forms ...@@ -1101,12 +1040,10 @@ namespace System.Windows.Forms
eh (this, e); eh (this, e);
} }
#if NET_2_0
protected override bool ProcessCmdKey (ref Message msg, Keys keyData) protected override bool ProcessCmdKey (ref Message msg, Keys keyData)
{ {
return base.ProcessCmdKey (ref msg, keyData); return base.ProcessCmdKey (ref msg, keyData);
} }
#endif
protected override bool ProcessDialogKey (Keys keyData) protected override bool ProcessDialogKey (Keys keyData)
{ {
// The user can use Ctrl-Tab or Ctrl-Shift-Tab to move control focus // The user can use Ctrl-Tab or Ctrl-Shift-Tab to move control focus
...@@ -1588,9 +1525,7 @@ namespace System.Windows.Forms ...@@ -1588,9 +1525,7 @@ namespace System.Windows.Forms
if (document.Length < max_length) { if (document.Length < max_length) {
document.InsertCharAtCaret(c, true); document.InsertCharAtCaret(c, true);
#if NET_2_0
OnTextUpdate (); OnTextUpdate ();
#endif
CaretMoved (this, null); CaretMoved (this, null);
Modified = true; Modified = true;
OnTextChanged(EventArgs.Empty); OnTextChanged(EventArgs.Empty);
...@@ -1646,15 +1581,9 @@ namespace System.Windows.Forms ...@@ -1646,15 +1581,9 @@ namespace System.Windows.Forms
remove { Events.RemoveHandler (AcceptsTabChangedEvent, value); } remove { Events.RemoveHandler (AcceptsTabChangedEvent, value); }
} }
#if NET_2_0
[Browsable (false)] [Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]
#endif public new event EventHandler AutoSizeChanged {
public
#if NET_2_0
new
#endif
event EventHandler AutoSizeChanged {
add { Events.AddHandler (AutoSizeChangedEvent, value); } add { Events.AddHandler (AutoSizeChangedEvent, value); }
remove { Events.RemoveHandler (AutoSizeChangedEvent, value); } remove { Events.RemoveHandler (AutoSizeChangedEvent, value); }
} }
...@@ -1701,7 +1630,6 @@ namespace System.Windows.Forms ...@@ -1701,7 +1630,6 @@ namespace System.Windows.Forms
remove { base.BackgroundImageChanged -= value; } remove { base.BackgroundImageChanged -= value; }
} }
#if NET_2_0
[Browsable (false)] [Browsable (false)]
[EditorBrowsable (EditorBrowsableState.Never)] [EditorBrowsable (EditorBrowsableState.Never)]
public new event EventHandler BackgroundImageLayoutChanged { public new event EventHandler BackgroundImageLayoutChanged {
...@@ -1726,10 +1654,6 @@ namespace System.Windows.Forms ...@@ -1726,10 +1654,6 @@ namespace System.Windows.Forms
[Browsable (true)] [Browsable (true)]
[EditorBrowsable (EditorBrowsableState.Always)] [EditorBrowsable (EditorBrowsableState.Always)]
#else
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
#endif
public new event EventHandler Click { public new event EventHandler Click {
add { base.Click += value; } add { base.Click += value; }
remove { base.Click -= value; } remove { base.Click -= value; }
...@@ -2297,11 +2221,7 @@ namespace System.Windows.Forms ...@@ -2297,11 +2221,7 @@ namespace System.Windows.Forms
} }
if (found_link == false) { if (found_link == false) {
#if NET_2_0
XplatUI.SetCursor (window.Handle, DefaultCursor.handle); XplatUI.SetCursor (window.Handle, DefaultCursor.handle);
#else
XplatUI.SetCursor(window.Handle, Cursors.IBeam.handle);
#endif
current_link = null; current_link = null;
} }
} }
...@@ -2532,7 +2452,6 @@ namespace System.Windows.Forms ...@@ -2532,7 +2452,6 @@ namespace System.Windows.Forms
} }
#endregion #endregion
#if NET_2_0
// This is called just before OnTextChanged is called. // This is called just before OnTextChanged is called.
internal virtual void OnTextUpdate () internal virtual void OnTextUpdate ()
{ {
...@@ -2558,6 +2477,5 @@ namespace System.Windows.Forms ...@@ -2558,6 +2477,5 @@ namespace System.Windows.Forms
{ {
base.OnMouseUp (mevent); base.OnMouseUp (mevent);
} }
#endif
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册