2 // System.Windows.Forms.Panel.cs
5 // stubbed out by Paul Osman (paul.osman@sympatico.ca)
6 // Dennis Hayes (dennish@raytek.com)
8 // (C) 2002 Ximian, Inc
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System
.Runtime
.Remoting
;
33 using System
.ComponentModel
;
35 namespace System
.Windows
.Forms
{
38 // Represents a Windows Panel control
41 public class Panel
: ScrollableControl
{
43 BorderStyle borderStyle
= BorderStyle
.None
;
49 SetStyle ( ControlStyles
.Selectable
, false );
50 SetStyle ( ControlStyles
.UserPaint
, true );
54 // --- Public Properties
56 public BorderStyle BorderStyle
{
57 get { return borderStyle; }
59 if ( !Enum
.IsDefined ( typeof(BorderStyle
), value ) )
60 throw new InvalidEnumArgumentException( "BorderStyle",
64 if ( borderStyle
!= value ) {
65 int oldStyle
= Win32
.getBorderStyle ( borderStyle
);
66 int oldExStyle
= Win32
.getBorderExStyle ( borderStyle
);
69 if ( IsHandleCreated
) {
70 Win32
.UpdateWindowStyle ( Handle
, oldStyle
, Win32
.getBorderStyle ( borderStyle
) );
71 Win32
.UpdateWindowExStyle ( Handle
, oldExStyle
, Win32
.getBorderExStyle ( borderStyle
) );
78 public override ISite Site
{
89 [EditorBrowsable (EditorBrowsableState
.Never
)]
90 public override string Text
{
91 get { return base.Text; }
92 set { base.Text = value;}
96 // --- Protected Properties
99 protected override CreateParams CreateParams
{
101 CreateParams createParams
= base.CreateParams
;
103 createParams
.Style
|= (int) (
104 WindowStyles
.WS_CHILD
|
105 WindowStyles
.WS_CLIPCHILDREN
|
106 WindowStyles
.WS_CLIPSIBLINGS
);
108 createParams
.Style
|= Win32
.getBorderStyle ( BorderStyle
);
109 createParams
.ExStyle
|= Win32
.getBorderExStyle ( BorderStyle
);
115 protected override Size DefaultSize
{
116 get { return new Size(219,109); }
119 protected override void OnResize(EventArgs e
) {
124 public override string ToString()
126 return GetType().FullName
.ToString() + ", BorderStyle: " + BorderStyle
.ToString();