Selaa lähdekoodia

2006-11-14 Rolf Bjarne Kvinge <[email protected]>

        * XplatUIX11.cs: send a WM_NCPAINT on WM_NCCALCSIZE so that 
        the window gets to paint its borders even if the window is
        getting smaller.
        
        * Form.cs: on a WM_NCPAINT invalidate the entire menu, 
        otherwise the old control buttons would still be painted 
        if the window gets bigger.
        
        * PaintEventArgs.cs: add an internal method so that the clip 
        rectangle can be changed.


svn path=/trunk/mcs/; revision=67847
Rolf Bjarne Kvinge 19 vuotta sitten
vanhempi
sitoutus
0b79abe753

+ 13 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog

@@ -1,3 +1,16 @@
+2006-11-14  Rolf Bjarne Kvinge <[email protected]> 
+
+	* XplatUIX11.cs: send a WM_NCPAINT on WM_NCCALCSIZE so that 
+	the window gets to paint its borders even if the window is
+	getting	smaller.
+	
+	* Form.cs: on a WM_NCPAINT invalidate the entire menu, 
+	otherwise the old control buttons would still be painted 
+	if the window gets bigger.
+	
+	* PaintEventArgs.cs: add an internal method so that the clip 
+	rectangle can be changed.
+	
 2006-11-13  Chris Toshok  <[email protected]>
 
 	[ fixes bug #79745 ]

+ 8 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs

@@ -1871,6 +1871,14 @@ namespace System.Windows.Forms {
 						pe = XplatUI.PaintEventStart(Handle, false);
 						pnt = XplatUI.GetMenuOrigin(window.Handle);
 
+						// The entire menu has to be in the clip rectangle because the 
+						// control buttons are right-aligned and otherwise they would
+						// stay painted when the window gets resized.
+						Rectangle clip = new Rectangle (pnt.X, pnt.Y, ClientSize.Width, 0);
+						clip = Rectangle.Union(clip, pe.ClipRectangle);
+						pe.SetClip(clip);
+						pe.Graphics.SetClip(clip);
+						
 						ActiveMenu.Draw (pe, new Rectangle (pnt.X, pnt.Y, ClientSize.Width, 0));
 
 						if (ActiveMaximizedMdiChild != null) {

+ 5 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/PaintEventArgs.cs

@@ -77,6 +77,11 @@ namespace System.Windows.Forms {
 			return res;
 		}
 
+		internal void SetClip (Rectangle clip)
+		{
+			clip_rectangle = clip;
+		}
+		
 		#region Protected Instance Methods
 		~PaintEventArgs() {
 			Dispose(false);

+ 3 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs

@@ -1754,6 +1754,9 @@ namespace System.Windows.Forms {
 					XMoveResizeWindow(DisplayHandle, hwnd.client_window, rect.X, rect.Y, rect.Width, rect.Height);
 				}
 			}
+			
+			// Hack to get a paint
+			NativeWindow.WndProc (hwnd.client_window, Msg.WM_NCPAINT, IntPtr.Zero, IntPtr.Zero);
 		}
 		#endregion	// Private Methods