简体   繁体   中英

C# difference between XP and Windows 7

When I am running this code in Windows XP I get a rectangle around the radiobutton. In windows 7 not. If I remove the comments this will also work under XP good.

any idea why?

RadioButton rb1 = new RadioButton();
rb1.GroupName = kvp.Key.ToString();
rb1.Name = "Keep";
rb1.Margin = new Thickness(30, 5, 0, 0);
//rb1.HorizontalAlignment = HorizontalAlignment.Left;
//rb1.VerticalAlignment = VerticalAlignment.Top;
rb1.IsChecked = true;
rb1.Checked += OnRadioButton_Checked;
Grid.SetRow(rb1, grid.RowDefinitions.Count - 1);
Grid.SetColumn(rb1, 1);
grid.Children.Add(rb1);

Windows 7 and Windows XP will render the same XAML in slightly different ways because they have different default themes. Vista and Windows 7 use Aero, while XP uses Luna (Windows Server 2003 uses Classic - Windows Server 2008 seems to as well).

You can override this to see if it is causing the differences you are seeing.

http://arbel.net/blog/archive/2006/11/03/Forcing-WPF-to-use-a-specific-Windows-theme.aspx

http://msdn.microsoft.com/en-us/library/aa358533(v=VS.90).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM