dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms Control.cs,1.7,


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms Control.cs,1.7,1.8 Form.cs,1.6,1.7
Date: Thu, 12 Jun 2003 22:39:31 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms
In directory subversions:/tmp/cvs-serv19676/System.Windows.Forms

Modified Files:
        Control.cs Form.cs 
Log Message:


Implement form centering, in response to "StartPosition".


Index: Control.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Control.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** Control.cs  13 Jun 2003 01:30:23 -0000      1.7
--- Control.cs  13 Jun 2003 02:39:29 -0000      1.8
***************
*** 415,423 ****
                                get
                                {
!                                       CreateControl();
                                        int leftAdjust = 0;
                                        int topAdjust = 0;
                                        int rightAdjust = 0;
                                        int bottomAdjust = 0;
                                        if(toolkitWindow != null)
                                        {
--- 415,424 ----
                                get
                                {
!                                       //CreateControl();
                                        int leftAdjust = 0;
                                        int topAdjust = 0;
                                        int rightAdjust = 0;
                                        int bottomAdjust = 0;
+                               #if false       // TODO: fix this so that it 
doesn't need a window
                                        if(toolkitWindow != null)
                                        {
***************
*** 426,429 ****
--- 427,431 ----
                                                         ref rightAdjust, ref 
bottomAdjust);
                                        }
+                               #endif
                                        return new Size(width - leftAdjust - 
rightAdjust,
                                                                        height 
- topAdjust - bottomAdjust);
***************
*** 2025,2033 ****
        protected virtual void SetClientSizeCore(int x, int y)
                        {
!                               CreateControl();
                                int leftAdjust = 0;
                                int topAdjust = 0;
                                int rightAdjust = 0;
                                int bottomAdjust = 0;
                                if(toolkitWindow != null)
                                {
--- 2027,2036 ----
        protected virtual void SetClientSizeCore(int x, int y)
                        {
!                               //CreateControl();
                                int leftAdjust = 0;
                                int topAdjust = 0;
                                int rightAdjust = 0;
                                int bottomAdjust = 0;
+                       #if false       // TODO: fix this so that it doesn't 
need a window
                                if(toolkitWindow != null)
                                {
***************
*** 2036,2039 ****
--- 2039,2043 ----
                                                 ref rightAdjust, ref 
bottomAdjust);
                                }
+                       #endif
                                SetBoundsCore
                                        (left, top,

Index: Form.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Form.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** Form.cs     13 Jun 2003 01:42:34 -0000      1.6
--- Form.cs     13 Jun 2003 02:39:29 -0000      1.7
***************
*** 501,509 ****
--- 501,523 ----
                                // TODO: dialog forms
                                CreateParams cp = CreateParams;
+ 
+                               // Create the window and set its initial 
caption.
                                IToolkitWindow window =
                                        
ToolkitManager.Toolkit.CreateTopLevelWindow
                                                (cp.Width, cp.Height);
                                window.SetTitle(cp.Caption);
+ 
+                               // Adjust the window decorations to match our 
requirements.
                                SetWindowFlags(window);
+ 
+                               // Center the window on-screen if necessary.
+                               if(formStartPosition == 
FormStartPosition.CenterScreen)
+                               {
+                                       Size screenSize = 
ToolkitManager.Toolkit.GetScreenSize();
+                                       window.MoveResize
+                                                       ((screenSize.Width - 
cp.Width) / 2,
+                                                        (screenSize.Height - 
cp.Height) / 2,
+                                                        cp.Width, cp.Height);
+                               }
                                return window;
                        }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]