Skip to content

[VisualStylesMode: Net11] An exception pops up for checkbox after setting the FlatStyle = System & Appearance = ToggleSwitch with set VisualStylesMode as NET11 #14754

Description

@Zheng-Li01

.NET version

11.0.0-preview.7.26365.114 + private dlls built from Net11/Integration-2 branch of https://github.com/KlausLoeffelmann/winforms repo

Did it work in .NET Framework?

Not tested/verified

Did it work in any of the earlier releases of .NET Core or .NET 5+?

This is new API introduced by #14746

Issue description

An exception pops up for checkbox after setting the FlatStyle = System & Appearance = ToggleSwitch with set VisualStylesMode as NET11

Image

Steps to reproduce

  1. Create a .NET winforms project
  2. Set the VisualStylesMode as NET11 for the form1
  3. Add CheckBox contorl on the form1.cs[Design]
  4. Set the Appearance as  ToggleSwitch & FlatStyle as System for the checbox1
  5. Build & run the project
  6. Click the checkbox1

**Call Stack: **

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Windows.Forms.CheckBox.get_DownChangeRectangle() in C:\Klaus\winforms\src\System.Windows.Forms\System\Windows\Forms\Controls\Buttons\CheckBox.cs:line 420
   at System.Windows.Forms.ButtonBase.OnMouseDown(MouseEventArgs mevent) in C:\Klaus\winforms\src\System.Windows.Forms\System\Windows\Forms\Controls\Buttons\ButtonBase.cs:line 965
   at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks) in C:\Klaus\winforms\src\System.Windows.Forms\System\Windows\Forms\Control.cs:line 11756
   at System.Windows.Forms.Control.WndProc(Message& m) in C:\Klaus\winforms\src\System.Windows.Forms\System\Windows\Forms\Control.cs:line 12700
   at System.Windows.Forms.ButtonBase.WndProc(Message& m) in C:\Klaus\winforms\src\System.Windows.Forms\System\Windows\Forms\Controls\Buttons\ButtonBase.cs:line 1516
   at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, UInt32 msg, WPARAM wparam, LPARAM lparam) in C:\Klaus\winforms\src\System.Windows.Forms\System\Windows\Forms\NativeWindow.cs:line 351


************** Loaded Assemblies **************

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions