PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Probleme mit .NET 1.1 ServicePack1!


Elemental
2004-09-29, 15:14:24
Hat ausser mir iegentlich niemand Probleme mit dem .NET 1.1 SP1?

Das erste was mir nach dem installieren aufgefallen ist, ist das bei GroupBoxes die in einer anderen GroupBox ist, der Text total mies aussieht, wenn man Visualstyles verwendet (sieht so aus, als würde der Font nicht stimmen; der Text ist zu fett und lang).


Ausserdem krieg ich die tollsten exceptions in dem .Net Framework code, z.b.:


Error creating window handle. at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)


oder


Object reference not set to an instance of an object. at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)


oder


Object reference not set to an instance of an object. at System.Windows.Forms.WndProc.Invoke(IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)



Ich hab ja eigentlich nicht erwartet, dass ein ServicePack solche Probleme verursacht.


Gruss
Bernd

Jesus
2004-09-29, 15:42:28
hm bei mir is alles ok soweit ich bisher gesheen hab. Hast du die richtige Sprachversion genommen ( falls es sowas überhaupt gibt )?

Elemental
2004-09-29, 15:59:30
Ja, hab die richtige Version. Macht WindowsUpdate ja selber...

Hast du WindowsXP? Vielleicht könntest du das mit den GroupBoxes und visualstyles mal testen?


Gruss
Bernd

Elemental
2004-09-30, 08:43:58
OK, also das mit den GroupBoxes ist definitiv ein SP Bug!

Elemental
2004-10-07, 15:19:33
Problem ist bei MS bekannt:


Problem Description: After updating to .NET Framework 1.1 SP1, the text in nested groupbox controls does not appear correctly when using XP styles (Flatstyle.System). The parent groupbox is OK, but the text of the child groupboxes is larger than the parent, and it gets clipped. To reproduce the problem:

1. Open a new Windows Application C# project in Visual Studio on a Windows XP SP2
machine with .NET Framework 1.1 SP1
2. Create a groupbox control in the main form
3. Create another groupbox inside of the first groupbox
4. In the Main() function, add the following code:
Application.EnableVisualStyles();
5. In the Form1() function, after InitializeComponent(), add the following lines of
code:
groupBox1.FlatStyle = FlatStyle.System;
groupBox2.FlatStyle = FlatStyle.System;
6. Build and run the solution, see that "groupBox2" is clipped and larger than
"groupBox1"

This worked fine before upgrading to .NET 1.1 SP1.

Für das Problem ist kein Fix verfügbar, lediglich zwei Workarounds:

Workaround 1:
Currently a workaround here is that we may put the nested child GroupBoxes into a Panel. This works fine on my side. Since the Panel is invisible, this can have the same visual effect.

Workaround 2:
In addition to the workaround I mentioned in my previous email (e.g. putting the child GroupBox into a Panel), we may also derive from the GroupBox class and override its WndProc function to process the ¡°WM_PRINTCLIENT¡± message correctly:

//Please add the following using statement:
//using System.Runtime.InteropServices;
public class FixedGroupBox : GroupBox
{
[DllImport("User32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
public static extern bool GetClientRect(HandleRef hWnd, [In, Out] ref RECT
rect);
private const int WM_PRINTCLIENT = 0x0318;
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
public RECT(int left, int top, int right, int bottom)
{
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
public RECT(System.Drawing.Rectangle r)
{
this.left = r.Left;
this.top = r.Top;
this.right = r.Right;
this.bottom = r.Bottom;
}
public static RECT FromXYWH(int x, int y, int width, int height)
{
return new RECT(x, y, x + width, y + height);
}
public System.Drawing.Size Size
{
get
{
return new System.Drawing.Size(this.right - this.left, this.bottom - this.top);
}
}
}
private void WmPrintClient(ref Message m)
{
RECT rect = new RECT();
GetClientRect(new HandleRef(this, Handle), ref rect);
Graphics graphics = Graphics.FromHdc(m.WParam);
Brush b = new SolidBrush(BackColor);
graphics.FillRectangle(b, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top);
graphics.Dispose();
b.Dispose();
m.Result = (IntPtr)1;
}
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_PRINTCLIENT:
WmPrintClient(ref m);
break;
default:
base.WndProc(ref m);
break;
}
}
}