2007-03-29 Jonathan Pobst <monkey@jpobst.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / UpDownBase.cs
1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
8 // 
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
11 // 
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 //
20 // Copyright (c) 2005 Novell, Inc.
21 //
22 // Authors:
23 //      Jonathan Gilbert        <logic@deltaq.org>
24 //
25 // Integration into MWF:
26 //      Peter Bartok            <pbartok@novell.com>
27 //
28
29 using System;
30 using System.Collections;
31 using System.ComponentModel;
32 using System.Drawing;
33 using System.Runtime.InteropServices;
34 using System.Windows.Forms;
35
36 namespace System.Windows.Forms
37 {
38 #if NET_2_0
39         [ClassInterface (ClassInterfaceType.AutoDispatch)]
40         [ComVisible (true)]
41 #endif
42         [Designer("System.Windows.Forms.Design.UpDownBaseDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
43         public abstract class UpDownBase : ContainerControl {
44                 #region UpDownSpinner Sub-class
45                 internal sealed class UpDownSpinner : Control {
46                         #region Local Variables
47                         private const int       InitialRepeatDelay = 50;
48                         private UpDownBase      owner;
49                         private Timer           tmrRepeat;
50                         private Rectangle       top_button_rect;
51                         private Rectangle       bottom_button_rect;
52                         private int             mouse_pressed;
53                         private int             mouse_x;
54                         private int             mouse_y;
55                         private int             repeat_delay;
56                         private int             repeat_counter;
57                         #endregion      // Local Variables
58
59                         #region Constructors
60                         public UpDownSpinner(UpDownBase owner)
61                         {
62                                 this.owner = owner;
63
64                                 mouse_pressed = 0;
65
66                                 SetStyle(ControlStyles.AllPaintingInWmPaint, true);
67                                 SetStyle(ControlStyles.DoubleBuffer, true);
68                                 SetStyle(ControlStyles.Opaque, true);
69                                 SetStyle(ControlStyles.ResizeRedraw, true);
70                                 SetStyle(ControlStyles.UserPaint, true);
71                                 SetStyle(ControlStyles.FixedHeight, true);
72                                 SetStyle(ControlStyles.Selectable, false);
73
74                                 tmrRepeat = new Timer();
75
76                                 tmrRepeat.Enabled = false;
77                                 tmrRepeat.Interval = 10;
78                                 tmrRepeat.Tick += new EventHandler(tmrRepeat_Tick);
79
80                                 compute_rects();
81                         }
82                         #endregion      // Constructors
83
84                         #region Private & Internal Methods
85                         private void compute_rects ()
86                         {
87                                 int top_button_height;
88                                 int bottom_button_height;
89
90                                 top_button_height = ClientSize.Height / 2;
91                                 bottom_button_height = ClientSize.Height - top_button_height;
92
93                                 top_button_rect = new Rectangle(0, 0, ClientSize.Width, top_button_height);
94                                 bottom_button_rect = new Rectangle(0, top_button_height, ClientSize.Width, bottom_button_height);
95                         }
96
97                         private void redraw (Graphics graphics)
98                         {
99                                 ButtonState top_button_state;
100                                 ButtonState bottom_button_state;
101
102                                 top_button_state = bottom_button_state = ButtonState.Normal;
103
104                                 if (mouse_pressed != 0) {
105                                         if ((mouse_pressed == 1) && top_button_rect.Contains(mouse_x, mouse_y)) {
106                                                 top_button_state = ButtonState.Pushed;
107                                         }
108
109                                         if ((mouse_pressed == 2) && bottom_button_rect.Contains(mouse_x, mouse_y)) {
110                                                 bottom_button_state = ButtonState.Pushed;
111                                         }
112                                 }
113
114                                 ControlPaint.DrawScrollButton(graphics, top_button_rect, ScrollButton.Up, top_button_state);
115                                 ControlPaint.DrawScrollButton(graphics, bottom_button_rect, ScrollButton.Down, bottom_button_state);
116                         }
117
118                         private void tmrRepeat_Tick (object sender, EventArgs e)
119                         {
120                                 if (repeat_delay > 1) {
121                                         repeat_counter++;
122
123                                         if (repeat_counter < repeat_delay) {
124                                                 return;
125                                         }
126
127                                         repeat_counter = 0;
128                                         repeat_delay = (repeat_delay * 3 / 4);
129                                 }
130
131                                 if (mouse_pressed == 0) {
132                                         tmrRepeat.Enabled = false;
133                                 }
134
135                                 if ((mouse_pressed == 1) && top_button_rect.Contains(mouse_x, mouse_y)) {
136                                         owner.UpButton();
137                                 }
138
139                                 if ((mouse_pressed == 2) && bottom_button_rect.Contains(mouse_x, mouse_y)) {
140                                         owner.DownButton();
141                                 }
142                         }
143                         #endregion      // Private & Internal Methods
144
145                         #region Protected Instance Methods
146                         protected override void OnMouseDown (MouseEventArgs e)
147                         {
148                                 if (e.Button != MouseButtons.Left) {
149                                         return;
150                                 }
151
152                                 if (top_button_rect.Contains(e.X, e.Y)) {
153                                         mouse_pressed = 1;
154                                         owner.UpButton();
155                                 } else if (bottom_button_rect.Contains(e.X, e.Y)) {
156                                         mouse_pressed = 2;
157                                         owner.DownButton();
158                                 }
159
160                                 mouse_x = e.X;
161                                 mouse_y = e.Y;
162                                 Capture = true;
163
164                                 tmrRepeat.Enabled = true;
165                                 repeat_counter = 0;
166                                 repeat_delay = InitialRepeatDelay;
167
168                                 Refresh ();
169                         }
170
171                         protected override void OnMouseMove (MouseEventArgs e)
172                         {
173                                 ButtonState before, after;
174
175                                 before = ButtonState.Normal;
176                                 if ((mouse_pressed == 1) && top_button_rect.Contains(mouse_x, mouse_y))
177                                         before = ButtonState.Pushed;
178                                 if ((mouse_pressed == 2) && bottom_button_rect.Contains(mouse_x, mouse_y))
179                                         before = ButtonState.Pushed;
180
181                                 mouse_x = e.X;
182                                 mouse_y = e.Y;
183
184                                 after = ButtonState.Normal;
185                                 if ((mouse_pressed == 1) && top_button_rect.Contains(mouse_x, mouse_y))
186                                         after = ButtonState.Pushed;
187                                 if ((mouse_pressed == 2) && bottom_button_rect.Contains(mouse_x, mouse_y))
188                                         after = ButtonState.Pushed;
189
190                                 if (before != after) {
191                                         if (after == ButtonState.Pushed) {
192                                                 tmrRepeat.Enabled = true;
193                                                 repeat_counter = 0;
194                                                 repeat_delay = InitialRepeatDelay;
195
196                                                 // fire off one right now too for good luck
197                                                 if (mouse_pressed == 1)
198                                                         owner.UpButton();
199                                                 if (mouse_pressed == 2)
200                                                         owner.DownButton();
201                                         }
202                                         else
203                                                 tmrRepeat.Enabled = false;
204
205                                         Refresh ();
206                                 }
207                         }
208
209                         protected override void OnMouseUp(MouseEventArgs e)
210                         {
211                                 mouse_pressed = 0;
212                                 Capture = false;
213
214                                 Refresh ();
215                         }
216
217                         protected override void OnMouseWheel(MouseEventArgs e)
218                         {
219                                 if (e.Delta > 0)
220                                         owner.UpButton();
221                                 else if (e.Delta < 0)
222                                         owner.DownButton();
223                         }
224
225                         protected override void OnPaint(PaintEventArgs e)
226                         {
227                                 redraw(e.Graphics);
228                         }
229
230                         protected override void OnResize(EventArgs e)
231                         {
232                                 base.OnResize(e);
233                                 compute_rects();
234                         }
235                         #endregion      // Protected Instance Methods
236                 }
237                 #endregion      // UpDownSpinner Sub-class
238
239                 internal class UpDownTextBox : TextBox {
240
241                         private UpDownBase owner;
242
243                         public UpDownTextBox (UpDownBase owner)
244                         {
245                                 this.owner = owner;
246
247                                 SetStyle (ControlStyles.FixedWidth, false);
248                                 SetStyle (ControlStyles.Selectable, false);
249                         }
250
251
252                         // The following can be shown to be present by
253                         // adding events to both the UpDown and the
254                         // internal textbox.  the textbox doesn't
255                         // generate any, and the updown generates them
256                         // all instead.
257                         protected override void OnGotFocus (EventArgs e)
258                         {
259                                 ShowSelection = true;
260                                 owner.OnGotFocus (e);
261                                 // doesn't chain up
262                         }
263
264                         protected override void OnLostFocus (EventArgs e)
265                         {
266                                 ShowSelection = false;
267                                 owner.OnLostFocus (e);
268                                 // doesn't chain up
269                         }
270
271                         protected override void OnMouseDown (MouseEventArgs e)
272                         {
273                                 // XXX look into whether or not the
274                                 // mouse event args are altered in
275                                 // some way.
276
277                                 owner.OnMouseDown (e);
278                                 // doesn't chain up
279                         }
280
281                         protected override void OnMouseUp (MouseEventArgs e)
282                         {
283                                 // XXX look into whether or not the
284                                 // mouse event args are altered in
285                                 // some way.
286
287                                 owner.OnMouseUp (e);
288                                 // doesn't chain up
289                         }
290
291                         // XXX there are likely more events that forward up to the UpDown
292                 }
293
294                 #region Local Variables
295                 internal UpDownTextBox          txtView;
296                 private UpDownSpinner           spnSpinner;
297                 private bool                    _InterceptArrowKeys = true;
298                 private LeftRightAlignment      _UpDownAlign;
299                 private bool                    changing_text;
300                 private bool                    user_edit;
301                 #endregion      // Local Variables
302
303                 #region Public Constructors
304                 public UpDownBase()
305                 {
306                         _UpDownAlign = LeftRightAlignment.Right;
307                         border_style = BorderStyle.Fixed3D;
308
309                         spnSpinner = new UpDownSpinner(this);
310
311                         txtView = new UpDownTextBox (this);
312                         txtView.ModifiedChanged += new EventHandler(OnChanged);
313                         txtView.AcceptsReturn = true;
314                         txtView.AutoSize = false;
315                         txtView.BorderStyle = BorderStyle.None;
316                         txtView.Location = new System.Drawing.Point(17, 17);
317                         txtView.TabIndex = TabIndex;
318
319                         SuspendLayout ();
320                         Controls.Add (spnSpinner);
321                         Controls.Add (txtView);
322                         ResumeLayout ();
323
324                         Height = PreferredHeight;
325                         base.BackColor = txtView.BackColor;
326
327                         TabIndexChanged += new EventHandler (TabIndexChangedHandler);
328                         
329                         txtView.KeyDown += new KeyEventHandler(OnTextBoxKeyDown);
330                         txtView.KeyPress += new KeyPressEventHandler(OnTextBoxKeyPress);
331 //                      txtView.LostFocus += new EventHandler(OnTextBoxLostFocus);
332                         txtView.Resize += new EventHandler(OnTextBoxResize);
333                         txtView.TextChanged += new EventHandler(OnTextBoxTextChanged);
334
335                         txtView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
336
337                         // So the child controls don't get auto selected when the updown is selected
338                         auto_select_child = false;
339                         SetStyle(ControlStyles.FixedHeight, true);
340                         SetStyle(ControlStyles.Selectable, true);
341 #if NET_2_0
342                         SetStyle (ControlStyles.Opaque | ControlStyles.ResizeRedraw, true);
343                         SetStyle (ControlStyles.StandardClick | ControlStyles.UseTextForAccessibility, false);
344 #endif
345                 }
346                 #endregion
347
348                 #region Private Methods
349                 void reseat_controls()
350                 {
351                         int text_displacement = 0;
352
353                         int spinner_width = 16;
354                         //int spinner_width = ClientSize.Height;
355
356                         if (_UpDownAlign == LeftRightAlignment.Left) {
357                                 spnSpinner.Bounds = new Rectangle(0, 0, spinner_width, ClientSize.Height);
358                                 text_displacement = spnSpinner.Width;
359
360                                 spnSpinner.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
361                         } else {
362                                 spnSpinner.Bounds = new Rectangle(ClientSize.Width - spinner_width, 0, spinner_width, ClientSize.Height);
363
364                                 spnSpinner.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
365                         }
366                         
367                         txtView.Bounds = new Rectangle(text_displacement, 0, ClientSize.Width - spinner_width, Height);
368                 }
369
370                 private void TabIndexChangedHandler (object sender, EventArgs e)
371                 {
372                         txtView.TabIndex = TabIndex;
373                 }
374
375                 internal override void OnPaintInternal (PaintEventArgs e)
376                 {
377                         e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(BackColor), ClientRectangle);
378                 }
379
380                 #endregion      // Private Methods
381
382                 #region Public Instance Properties
383                 [Browsable(false)]
384                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
385                 [EditorBrowsable(EditorBrowsableState.Never)]
386                 public override bool AutoScroll {
387                         get {
388                                 return base.AutoScroll;
389                         }
390
391                         set {
392                                 base.AutoScroll = value;
393                         }
394                 }
395
396                 [Browsable(false)]
397                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
398                 [EditorBrowsable(EditorBrowsableState.Never)]
399                 public new Size AutoScrollMargin {
400                         get { return base.AutoScrollMargin; }
401                         set { base.AutoScrollMargin = value; }
402                 }
403
404                 [Browsable(false)]
405                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
406                 [EditorBrowsable(EditorBrowsableState.Never)]
407                 public new Size AutoScrollMinSize {
408                         get { return base.AutoScrollMinSize; }
409                         set { base.AutoScrollMinSize = value; }
410                 }
411
412                 public override Color BackColor {
413                         get {
414                                 return base.BackColor;
415                         }
416
417                         set {
418                                 base.BackColor = value;
419                                 txtView.BackColor = value;
420                         }
421                 }
422
423                 [Browsable(false)]
424                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
425                 [EditorBrowsable(EditorBrowsableState.Never)]
426                 public override Image BackgroundImage {
427                         get {
428                                 return base.BackgroundImage;
429                         }
430                         set {
431                                 base.BackgroundImage = value;
432                                 txtView.BackgroundImage = value;
433                         }
434                 }
435
436
437                 [DefaultValue(BorderStyle.Fixed3D)]
438                 [DispId(-504)]
439                 public BorderStyle BorderStyle {
440                         get { return InternalBorderStyle; }
441                         set { InternalBorderStyle = value; }
442                 }
443
444                 public override ContextMenu ContextMenu {
445                         get {
446                                 return base.ContextMenu;
447                         }
448                         set {
449                                 base.ContextMenu = value;
450                                 txtView.ContextMenu = value;
451                                 spnSpinner.ContextMenu = value;
452                         }
453                 }
454
455                 [Browsable(false)]
456                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
457                 [EditorBrowsable(EditorBrowsableState.Never)]
458                 public new DockPaddingEdges DockPadding {
459                         get { return base.DockPadding; }
460                 }
461
462                 [Browsable(false)]
463                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
464                 public override bool Focused {
465                         get {
466                                 return txtView.Focused;
467                         }
468                 }
469
470                 public override Color ForeColor {
471                         get {
472                                 return base.ForeColor;
473                         }
474                         set {
475                                 base.ForeColor = value;
476                                 txtView.ForeColor = value;
477                         }
478                 }
479
480                 [DefaultValue(true)]
481                 public bool InterceptArrowKeys {
482                         get {
483                                 return _InterceptArrowKeys;
484                         }
485                         set {
486                                 _InterceptArrowKeys = value;
487                         }
488                 }
489
490                 [Browsable(false)]
491                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
492                 [EditorBrowsable(EditorBrowsableState.Advanced)]
493                 public int PreferredHeight {
494                         get {
495                                 // For some reason, the TextBox's PreferredHeight does not
496                                 // change when the Font property is assigned. Without a
497                                 // border, it will always be Font.Height anyway.
498                                 //int text_box_preferred_height = (txtView != null) ? txtView.PreferredHeight : Font.Height;
499                                 int text_box_preferred_height = Font.Height;
500
501                                 switch (border_style) {
502                                         case BorderStyle.FixedSingle:
503                                         case BorderStyle.Fixed3D:
504                                                 text_box_preferred_height += 3; // magic number? :-)
505
506                                                 return text_box_preferred_height + 4;
507
508                                         case BorderStyle.None:
509                                         default:
510                                                 return text_box_preferred_height;
511                                 }
512                         }
513                 }
514
515                 [DefaultValue(false)]
516                 public bool ReadOnly {
517                         get {
518                                 return txtView.ReadOnly;
519                         }
520                         set {
521                                 txtView.ReadOnly = value;
522                         }
523                 }
524
525                 [Localizable(true)]
526                 public override string Text {
527                         get {
528                                 if (txtView != null) {
529                                         return txtView.Text;
530                                 }
531                                 return "";
532                         }
533                         set {
534                                 bool suppress_validation = changing_text;
535
536                                 txtView.Text = value;
537
538                                 if (!suppress_validation)
539                                         ValidateEditText();
540
541                                 txtView.SelectionLength = 0;
542                         }
543                 }
544
545                 [DefaultValue(HorizontalAlignment.Left)]
546                 [Localizable(true)]
547                 public HorizontalAlignment TextAlign {
548                         get {
549                                 return txtView.TextAlign;
550                         }
551                         set{
552                                 txtView.TextAlign = value;
553                         }
554                 }
555
556                 [DefaultValue(LeftRightAlignment.Right)]
557                 [Localizable(true)]
558                 public LeftRightAlignment UpDownAlign {
559                         get {
560                                 return _UpDownAlign;
561                         }
562                         set {
563                                 _UpDownAlign = value;
564
565                                 reseat_controls();
566                         }
567                 }
568                 #endregion      // Public Instance Properties
569
570                 #region Protected Instance Properties
571                 protected bool ChangingText {
572                         get {
573                                 return changing_text;
574                         }
575                         set {
576                                 changing_text = value;
577                         }
578                 }
579
580                 protected override CreateParams CreateParams {
581                         get {
582                                 return base.CreateParams;
583                         }
584                 }
585
586                 protected override Size DefaultSize {
587                         get {
588                                 return new Size(120, this.PreferredHeight);
589                         }
590                 }
591
592                 protected bool UserEdit {
593                         get {
594                                 return user_edit;
595                         }
596                         set {
597                                 user_edit = value;
598                         }
599                 }
600                 #endregion      // Protected Instance Properties
601
602                 #region Public Instance Methods
603                 public abstract void DownButton ();
604                 public void Select(int start, int length)
605                 {
606                         txtView.Select(start, length);
607                 }
608
609                 public abstract void UpButton ();
610                 #endregion      // Public Instance Methods
611
612                 #region Protected Instance Methods
613                 protected override void Dispose (bool disposing)
614                 {
615                         if (disposing) {
616                                 txtView.Dispose();
617                                 txtView = null;
618
619                                 spnSpinner.Dispose();
620                                 spnSpinner = null;
621                         }
622                         base.Dispose (disposing);
623                 }
624
625                 protected virtual void OnChanged (object source, EventArgs e)
626                 {
627                 }
628
629                 protected override void OnFontChanged (EventArgs e)
630                 {
631                         txtView.Font = this.Font;
632                         Height = PreferredHeight;
633                 }
634
635                 protected override void OnHandleCreated (EventArgs e)
636                 {
637                         base.OnHandleCreated (e);
638                 }
639
640                 protected override void OnLayout (LayoutEventArgs e)
641                 {
642                         base.OnLayout(e);
643                 }
644
645                 protected override void OnMouseWheel (MouseEventArgs e)
646                 {
647                         if (e.Delta > 0)
648                                 UpButton();
649                         else if (e.Delta < 0)
650                                 DownButton();
651                 }
652
653                 protected virtual void OnTextBoxKeyDown (object source, KeyEventArgs e)
654                 {
655                         if (_InterceptArrowKeys) {
656                                 if ((e.KeyCode == Keys.Up) || (e.KeyCode == Keys.Down)) {
657                                         e.Handled = true;
658
659                                         if (e.KeyCode == Keys.Up)
660                                                 UpButton();
661                                         if (e.KeyCode == Keys.Down)
662                                                 DownButton();
663                                 }
664                         }
665
666                         OnKeyDown(e);
667                 }
668
669                 protected virtual void OnTextBoxKeyPress (object source, KeyPressEventArgs e)
670                 {
671                         if (e.KeyChar == '\r') {
672                                 e.Handled = true;
673                                 ValidateEditText();
674                         }
675                         OnKeyPress(e);
676                 }
677
678                 protected virtual void OnTextBoxLostFocus (object source, EventArgs e)
679                 {
680                         if (user_edit) {
681                                 ValidateEditText();
682                         }
683                 }
684
685                 protected virtual void OnTextBoxResize (object source, EventArgs e)
686                 {
687                         // compute the new height, taking the border into account
688                         Height = PreferredHeight;
689
690                         // let anchoring reposition the controls
691                 }
692
693                 protected virtual void OnTextBoxTextChanged (object source, EventArgs e)
694                 {
695                         if (changing_text)
696                                 ChangingText = false;
697                         else
698                                 UserEdit = true;
699
700                         OnTextChanged(e);
701                 }
702
703                 protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)
704                 {
705                         base.SetBoundsCore(x, y, width, height, specified);
706
707                         if ((specified & BoundsSpecified.Size) != BoundsSpecified.None)
708                                 reseat_controls();
709                 }
710
711                 protected abstract void UpdateEditText ();
712
713                 protected virtual void ValidateEditText ()
714                 {
715                         // to be overridden by subclassers
716                 }
717
718                 [EditorBrowsable(EditorBrowsableState.Advanced)]
719                 protected override void WndProc (ref Message m)
720                 {
721                         switch((Msg) m.Msg) {
722                         case Msg.WM_KEYUP:
723                         case Msg.WM_KEYDOWN:
724                         case Msg.WM_CHAR:
725                                 XplatUI.SendMessage (txtView.Handle, (Msg) m.Msg, m.WParam, m.LParam);
726                                 break;
727                         case Msg.WM_SETFOCUS:
728                                 ActiveControl = txtView;
729                                 break;
730                         case Msg.WM_KILLFOCUS:
731                                 ActiveControl = null;
732                                 break;
733                         default:
734                                 base.WndProc (ref m);
735                                 break;
736                         }
737                 }
738                 #endregion      // Protected Instance Methods
739
740                 #region Events
741                 [Browsable(false)]
742                 [EditorBrowsable(EditorBrowsableState.Never)]
743                 public new event EventHandler BackgroundImageChanged {
744                         add { base.BackgroundImageChanged += value; }
745                         remove { base.BackgroundImageChanged -= value; }
746                 }
747
748                 [Browsable(false)]
749                 [EditorBrowsable(EditorBrowsableState.Never)]
750                 public new event EventHandler MouseEnter {
751                         add { base.MouseEnter += value; }
752                         remove { base.MouseEnter -= value; }
753                 }
754
755                 [Browsable(false)]
756                 [EditorBrowsable(EditorBrowsableState.Never)]
757                 public new event EventHandler MouseHover {
758                         add { base.MouseHover += value; }
759                         remove { base.MouseHover -= value; }
760                 }
761
762                 [Browsable(false)]
763                 [EditorBrowsable(EditorBrowsableState.Never)]
764                 public new event EventHandler MouseLeave {
765                         add { base.MouseLeave += value; }
766                         remove { base.MouseLeave -= value; }
767                 }
768
769                 [Browsable(false)]
770                 [EditorBrowsable(EditorBrowsableState.Never)]
771                 public new event MouseEventHandler MouseMove {
772                         add { base.MouseMove += value; }
773                         remove { base.MouseMove -= value; }
774                 }
775                 #endregion      // Events
776         }
777 }