558 references to Application
Accessibility_Core_App (4)
Program.cs (4)
16
Application
.SetHighDpiMode(HighDpiMode.PerMonitorV2);
17
Application
.EnableVisualStyles();
18
Application
.SetCompatibleTextRenderingDefault(false);
19
Application
.Run(new Main());
DesignSurface (2)
Program.cs (2)
14
Application
.EnableVisualStyles();
15
Application
.SetCompatibleTextRenderingDefault(false);
InteractiveHost32 (1)
src\Interactive\HostProcess\InteractiveHostEntryPoint.cs (1)
45
Application
.Run();
InteractiveHost64 (1)
src\Interactive\HostProcess\InteractiveHostEntryPoint.cs (1)
45
Application
.Run();
Microsoft.VisualBasic.Forms (21)
Microsoft\VisualBasic\ApplicationServices\ApplyApplicationDefaultsEventArgs.vb (1)
35
''' <see cref="
Application
.ColorMode"/> for the application.
Microsoft\VisualBasic\ApplicationServices\WindowsFormsApplicationBase.vb (12)
344
Return
Application
.OpenForms
387
AddHandler
Application
.ThreadException, AddressOf OnUnhandledExceptionEventAdaptor
398
RemoveHandler
Application
.ThreadException, AddressOf OnUnhandledExceptionEventAdaptor
505
Application
.Run(_splashScreen)
758
Application
.SetDefaultFont(applicationDefaultsEventArgs.Font)
774
Dim dpiSetResult As Boolean =
Application
.SetHighDpiMode(_highDpiMode)
777
_highDpiMode =
Application
.HighDpiMode
783
Application
.EnableVisualStyles()
786
Application
.SetColorMode(_colorMode)
833
Application
.Run(_appContext)
921
If e.ExitApplication Then
Application
.Exit()
1022
Application
.DoEvents()
Microsoft\VisualBasic\ApplicationServices\WindowsFormsApplicationBase.WinFormsAppContext.vb (1)
43
Dim forms As FormCollection =
Application
.OpenForms
Microsoft\VisualBasic\Logging\FileLogTraceListener.vb (7)
38
Private _baseFileName As String = Path.GetFileNameWithoutExtension(
Application
.ExecutablePath)
41
Private _customLocation As String =
Application
.UserAppDataPath
135
basePath =
Application
.CommonAppDataPath
137
basePath = Path.GetDirectoryName(
Application
.ExecutablePath)
139
basePath =
Application
.UserAppDataPath
144
basePath =
Application
.UserAppDataPath
150
basePath =
Application
.UserAppDataPath
Microsoft.VisualBasic.Forms.Tests (9)
System\Windows\Forms\FileLogTraceListenerTests.vb (9)
27
Dim expectedBaseFileName As String = Path.GetFileNameWithoutExtension(
Application
.ExecutablePath)
86
If DirectoryIsAccessible(
Application
.CommonAppDataPath) Then
152
fullLogFileName.Should.StartWith(
Application
.CommonAppDataPath)
159
If DirectoryIsAccessible(
Application
.CommonAppDataPath) Then
218
fullLogFileName.Should.StartWith(Path.GetDirectoryName(
Application
.ExecutablePath))
225
If DirectoryIsAccessible(Path.GetDirectoryName(
Application
.ExecutablePath)) Then
239
fullLogFileName.Should.StartWith(
Application
.UserAppDataPath)
246
If DirectoryIsAccessible(
Application
.UserAppDataPath) Then
267
If DirectoryIsAccessible(
Application
.UserAppDataPath) Then
PresentationUI (3)
MS\Internal\Documents\DialogBaseForm.cs (1)
68
System.Windows.Forms.
Application
.EnableVisualStyles();
MS\Internal\Documents\SigningProgress.cs (2)
95
System.Windows.Forms.
Application
.Run();
118
System.Windows.Forms.
Application
.ExitThread();
ScratchProject (3)
Program.cs (3)
13
Application
.EnableVisualStyles();
14
Application
.SetHighDpiMode(HighDpiMode.PerMonitorV2);
15
Application
.Run(new Form1());
ScratchProjectWithInternals (3)
Program.cs (3)
14
Application
.EnableVisualStyles();
15
Application
.SetHighDpiMode(HighDpiMode.PerMonitorV2);
16
Application
.Run(new Form1());
System.Windows.Forms (241)
System\Windows\Forms\ActiveX\AxHost.cs (6)
49
= PInvoke.RegisterWindowMessage($"{
Application
.WindowMessagesVersion}_subclassCheck");
181
if (
Application
.OleRequired() != ApartmentState.STA)
2526
Application
.Idle += OnIdle;
2531
Application
.Idle -= OnIdle;
3141
Application
.ParkHandle(new HandleRef<HWND>(this, hwnd), DpiAwarenessContext);
3284
if (
Application
.OleRequired() != ApartmentState.STA)
System\Windows\Forms\Application.ComponentThreadContext.cs (5)
89
Application
.OleRequired();
144
if (result && _componentManager is not
Application
.ComponentManager)
209
if (activate && ComponentManager is { } manager && manager is not
Application
.ComponentManager)
218
if (_trackingComponent != track && ComponentManager is { } manager && manager is not
Application
.ComponentManager)
470
if (_messageLoopCount > 0 && ComponentManager is not
Application
.ComponentManager)
System\Windows\Forms\Application.cs (1)
919
Module module = typeof(
Application
).Module;
System\Windows\Forms\ApplicationContext.cs (1)
35
if (GetType() == typeof(ApplicationContext) || GetType() ==
Application
.s_typeOfModalApplicationContext)
System\Windows\Forms\Control.ControlNativeWindow.cs (1)
59
Application
.OnThreadException(e);
System\Windows\Forms\Control.cs (26)
913
Application
.ThreadContext.FromCurrent().ActivatingControl = value ? this : null;
1293
|| (PInvoke.LoadComctl32(
Application
.StartupPath) != 0))
1565
s_defaultFont =
Application
.DefaultFont ?? SystemFonts.MessageBoxFont;
3467
Application
.ThreadContext? ctx =
Application
.ThreadContext.FromId(threadId);
4485
using ThemingScope scope = new(
Application
.UseVisualStyles);
4513
Application
.ParkHandle(cp, DpiAwarenessContext);
6111
Application
.OnThreadException(current._exception);
6398
s_threadCallbackMessage = PInvoke.RegisterWindowMessage($"{
Application
.WindowMessagesVersion}_ThreadCallbackMessage");
6487
/// This will usually be rerouted to the <see cref="
Application
.ThreadException"/>, but in certain
6495
/// It gets marshalled down to <see cref="
Application
.ThreadException"/>, which is an extreme
6989
Application
.ParkHandle(handle: new(this), DpiAwarenessContext);
7265
if (
Application
.IsDarkModeEnabled && GetStyle(ControlStyles.ApplyThemingImplicitly))
8163
if (
Application
.RenderWithVisualStyles && parent.RenderTransparencyWithVisualStyles)
8414
Application
.OnThreadException(e);
8572
/// This is the method that is called directly by the <see cref="
Application
"/>'s message loop.
8573
/// See <see cref="
Application
.ThreadContext.PreTranslateMessage(ref MSG)"/>.
9427
if (
Application
.OleRequired() != ApartmentState.STA)
10173
Application
.ParkHandle(handle: new(this), DpiAwarenessContext);
10187
Application
.UnparkHandle(this, _window.DpiAwarenessContext);
10201
Application
.UnparkHandle(this, _window.DpiAwarenessContext);
10287
if (value &&
Application
.ColorModeSet)
10289
PrepareDarkMode(HWND,
Application
.IsDarkModeEnabled);
12488
if (
Application
.DefaultFont is null) // auto system font
12505
Application
.ScaleDefaultFont(); // will update Application.s_defaultFont or Application.s_defaultFontScaled only if needed
12506
s_defaultFont =
Application
.DefaultFont; // Application.s_defaultFontScaled ?? Application.s_defaultFont
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.cs (2)
70
&&
Application
.RenderWithVisualStyles
493
if (
Application
.RenderWithVisualStyles)
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.LayoutOptions.cs (1)
631
else if (!
Application
.RenderWithVisualStyles)
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonStandardAdapter.cs (5)
112
if (
Application
.RenderWithVisualStyles)
123
if (
Application
.RenderWithVisualStyles)
160
if (
Application
.RenderWithVisualStyles && Control.FlatStyle != FlatStyle.Standard)
185
if (!
Application
.RenderWithVisualStyles)
220
layout.DotNetOneButtonCompat = !
Application
.RenderWithVisualStyles;
System\Windows\Forms\Controls\Buttons\ButtonInternal\CheckBoxBaseAdapter.cs (2)
264
if (
Application
.RenderWithVisualStyles)
279
if (
Application
.RenderWithVisualStyles)
System\Windows\Forms\Controls\Buttons\ButtonInternal\CheckBoxStandardAdapter.cs (3)
40
if (!
Application
.RenderWithVisualStyles)
116
layout.DotNetOneButtonCompat = !
Application
.RenderWithVisualStyles;
118
if (
Application
.RenderWithVisualStyles)
System\Windows\Forms\Controls\Buttons\ButtonInternal\RadioButtonBaseAdapter.cs (2)
197
if (!
Application
.RenderWithVisualStyles)
204
if (
Application
.RenderWithVisualStyles)
System\Windows\Forms\Controls\Buttons\ButtonInternal\RadioButtonStandardAdapter.cs (2)
61
layout.DotNetOneButtonCompat = !
Application
.RenderWithVisualStyles;
63
if (
Application
.RenderWithVisualStyles)
System\Windows\Forms\Controls\Buttons\ButtonRenderer.cs (2)
25
/// uses the setting from the <see cref="
Application
.RenderWithVisualStyles"/> property to determine the
32
private static bool RenderWithVisualStyles => !RenderMatchingApplicationState ||
Application
.RenderWithVisualStyles;
System\Windows\Forms\Controls\Buttons\CheckBoxRenderer.cs (1)
22
private static bool RenderWithVisualStyles => !RenderMatchingApplicationState ||
Application
.RenderWithVisualStyles;
System\Windows\Forms\Controls\Buttons\RadioButtonRenderer.cs (1)
23
private static bool RenderWithVisualStyles => !RenderMatchingApplicationState ||
Application
.RenderWithVisualStyles;
System\Windows\Forms\Controls\ComboBox\ComboBox.cs (5)
154
if (
Application
.OleRequired() != ApartmentState.STA)
196
if (
Application
.OleRequired() != ApartmentState.STA)
718
if ((!ContainsFocus || !
Application
.RenderWithVisualStyles) && FlatStyle == FlatStyle.Popup)
2337
if (
Application
.IsDarkModeEnabled)
3661
if (!
Application
.RenderWithVisualStyles && !GetStyle(ControlStyles.UserPaint)
System\Windows\Forms\Controls\ComboBox\ComboBox.ObjectCollection.cs (1)
474
CompareInfo compInfo =
Application
.CurrentCulture.CompareInfo;
System\Windows\Forms\Controls\DataGridView\DataGridView.cs (3)
832
internal static bool ApplyVisualStylesToInnerCells =>
Application
.RenderWithVisualStyles;
834
internal bool ApplyVisualStylesToHeaderCells =>
Application
.RenderWithVisualStyles && EnableHeadersVisualStyles;
1115
return
Application
.RenderWithVisualStyles ? 1 : SystemInformation.Border3DSize.Width;
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (1)
19301
if (
Application
.RenderWithVisualStyles)
System\Windows\Forms\Controls\DataGridView\DataGridViewComboBoxCell.ItemComparer.cs (1)
29
CompareInfo compInfo =
Application
.CurrentCulture.CompareInfo;
System\Windows\Forms\Controls\DateTimePicker\DateTimePicker.cs (3)
493
||
Application
.IsDarkModeEnabled
961
using ThemingScope scope = new(
Application
.UseVisualStyles);
1122
if (IsHandleCreated &&
Application
.RenderWithVisualStyles)
System\Windows\Forms\Controls\GroupBox\GroupBox.cs (2)
404
if (!
Application
.RenderWithVisualStyles || Width < 10 || Height < 10)
428
if (ShouldSerializeForeColor() ||
Application
.IsDarkModeEnabled || !Enabled)
System\Windows\Forms\Controls\GroupBox\GroupBoxRenderer.cs (1)
28
=> (!RenderMatchingApplicationState ||
Application
.RenderWithVisualStyles);
System\Windows\Forms\Controls\ImageList\ImageList.cs (1)
426
using (ThemingScope scope = new(
Application
.UseVisualStyles))
System\Windows\Forms\Controls\ImageList\ImageListStreamer.cs (1)
71
using ThemingScope scope = new(
Application
.UseVisualStyles);
System\Windows\Forms\Controls\ListBoxes\CheckedListBox.cs (3)
521
if (
Application
.RenderWithVisualStyles)
554
if (
Application
.RenderWithVisualStyles)
736
else if (!
Application
.RenderWithVisualStyles)
System\Windows\Forms\Controls\ListBoxes\ListBox.cs (1)
2324
if (((nint)m.LParamInternal & PInvoke.PRF_NONCLIENT) != 0 &&
Application
.RenderWithVisualStyles && BorderStyle == BorderStyle.Fixed3D)
System\Windows\Forms\Controls\ListView\DrawListViewColumnHeaderEventArgs.cs (1)
88
if (
Application
.RenderWithVisualStyles)
System\Windows\Forms\Controls\ListView\ListView.cs (20)
850
Debug.Assert(!_listViewState[LISTVIEWSTATE_flipViewToLargeIconAndSmallIcon] ||
Application
.ComCtlSupportsVisualStyles, "we need this bit only when loading ComCtl 6.0");
858
Debug.Assert(!value ||
Application
.ComCtlSupportsVisualStyles, "we need this bit only when loading ComCtl 6.0");
985
=> ShowGroups && _groups is not null && _groups.Count > 0 &&
Application
.ComCtlSupportsVisualStyles && !VirtualMode;
1614
internal bool SupportsListViewSubItems => View == View.Details || (View == View.Tile &&
Application
.ComCtlSupportsVisualStyles);
1823
if (IsHandleCreated &&
Application
.ComCtlSupportsVisualStyles)
2472
if (
Application
.ComCtlSupportsVisualStyles
2498
if (
Application
.ComCtlSupportsVisualStyles &&
2546
using ThemingScope scope = new(
Application
.UseVisualStyles);
3993
if (IsHandleCreated && Items.Count == 0 && View == View.SmallIcon &&
Application
.ComCtlSupportsVisualStyles)
4529
if (
Application
.IsDarkModeEnabled)
4567
if (
Application
.ComCtlSupportsVisualStyles)
4636
if (
Application
.ComCtlSupportsVisualStyles && (InsertionMark.Index > 0))
4935
if (c != SystemColors.Window ||
Application
.IsDarkModeEnabled)
4942
if (c != SystemColors.WindowText ||
Application
.IsDarkModeEnabled)
5109
Application
.OleRequired();
5782
if (IsHandleCreated &&
Application
.ComCtlSupportsVisualStyles && !VirtualMode)
5792
Debug.Assert(
Application
.ComCtlSupportsVisualStyles, "this function works only when ComCtl 6.0 and higher is loaded");
5939
if (
Application
.IsDarkModeEnabled
6892
if (((nint)m.LParamInternal & PInvoke.PRF_NONCLIENT) != 0 &&
Application
.RenderWithVisualStyles && BorderStyle == BorderStyle.Fixed3D)
7076
if (m.WParamInternal != LVTOOLTIPTRACKING || !
Application
.ComCtlSupportsVisualStyles)
System\Windows\Forms\Controls\ListView\ListView.ListViewNativeItemCollection.cs (1)
267
if (
Application
.ComCtlSupportsVisualStyles)
System\Windows\Forms\Controls\MonthCalendar\MonthCalendar.cs (3)
200
if (ShouldSerializeBackColor() ||
Application
.IsDarkModeEnabled)
416
if (ShouldSerializeForeColor() ||
Application
.IsDarkModeEnabled)
1123
using ThemingScope scope = new(
Application
.UseVisualStyles);
System\Windows\Forms\Controls\ProgressBar\ProgressBar.cs (2)
84
if (
Application
.IsDarkModeEnabled)
555
using ThemingScope scope = new(
Application
.UseVisualStyles);
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\CommandsPane.cs (1)
217
sb.Append(
Application
.CurrentCulture.TextInfo.ListSeparator);
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\DropDownButton.cs (1)
71
if (
Application
.RenderWithVisualStyles & _useComboBoxTheme)
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\DropDownButton.DropDownButtonAdapter.cs (1)
69
if (!
Application
.RenderWithVisualStyles)
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyDescriptorGridEntry.cs (2)
898
Application
.Idle += ShowCodeIdle;
921
Application
.Idle -= ShowCodeIdle;
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.DropDownHolder.cs (1)
166
Application
.DoEventsModal();
System\Windows\Forms\Controls\Splitter\Splitter.cs (3)
419
Application
.DoEvents();
910
Application
.AddMessageFilter(_splitterMessageFilter);
927
Application
.RemoveMessageFilter(_splitterMessageFilter);
System\Windows\Forms\Controls\TabControl\TabControl.cs (2)
64
private readonly MessageId _tabBaseReLayoutMessage = PInvoke.RegisterWindowMessage($"{
Application
.WindowMessagesVersion}{TabBaseReLayoutMessageName}");
961
using ThemingScope scope = new(
Application
.UseVisualStyles);
System\Windows\Forms\Controls\TabControl\TabPage.cs (4)
108
else if (!
Application
.IsDarkModeEnabled
109
&&
Application
.RenderWithVisualStyles
601
if (
Application
.RenderWithVisualStyles
606
Color bkColor = (UseVisualStyleBackColor && !
Application
.IsDarkModeEnabled)
System\Windows\Forms\Controls\TextBox\MaskedTextBox.cs (2)
1798
if (
Application
.RenderWithVisualStyles && IsHandleCreated && BorderStyle == BorderStyle.Fixed3D)
2907
&&
Application
.RenderWithVisualStyles && BorderStyle == BorderStyle.Fixed3D)
System\Windows\Forms\Controls\TextBox\TextBox.cs (2)
560
if (
Application
.RenderWithVisualStyles && IsHandleCreated && BorderStyle == BorderStyle.Fixed3D)
822
if (((nint)m.LParamInternal & PInvoke.PRF_NONCLIENT) != 0 &&
Application
.RenderWithVisualStyles
System\Windows\Forms\Controls\ToolStrips\ToolStrip.cs (4)
1930
Application
.ThreadContext.FromCurrent().RemoveMessageFilter(_restoreFocusFilter);
3298
Application
.ThreadContext.FromCurrent().RemoveMessageFilter(RestoreFocusFilter);
3976
Application
.ThreadContext.FromCurrent().RemoveMessageFilter(RestoreFocusFilter);
4631
Application
.ThreadContext.FromCurrent().AddMessageFilter(RestoreFocusFilter);
System\Windows\Forms\Controls\ToolStrips\ToolStrip.RestoreFocusMessageFilter.cs (1)
58
Application
.ThreadContext.FromCurrent().RemoveMessageFilter(this);
System\Windows\Forms\Controls\ToolStrips\ToolStripComboBox.cs (2)
364
Application
.ThreadContext.FromCurrent().RemoveMessageFilter(ParentInternal.RestoreFocusFilter);
377
Application
.ThreadContext.FromCurrent().RemoveMessageFilter(ParentInternal.RestoreFocusFilter);
System\Windows\Forms\Controls\ToolStrips\ToolStripDropDown.cs (1)
920
Application
.MessageLoop && base.CanProcessMnemonic();
System\Windows\Forms\Controls\ToolStrips\ToolStripDropTargetManager.cs (1)
170
if (
Application
.OleRequired() != ApartmentState.STA)
System\Windows\Forms\Controls\ToolStrips\ToolStripManager.cs (2)
538
get => s_visualStylesEnabledIfPossible &&
Application
.RenderWithVisualStyles;
559
if (
Application
.IsDarkModeEnabled)
System\Windows\Forms\Controls\ToolStrips\ToolStripManager.ModalMenuFilter.cs (5)
146
Application
.ThreadContext.FromCurrent().AddMessageFilter(this);
147
Application
.ThreadContext.FromCurrent().TrackInput(true);
149
if (!
Application
.ThreadContext.FromCurrent().GetMessageLoop(true))
196
Application
.ThreadContext.FromCurrent().RemoveMessageFilter(this);
197
Application
.ThreadContext.FromCurrent().TrackInput(false);
System\Windows\Forms\Controls\ToolStrips\ToolStripManager.ModalMenuFilter.HostedWindowsFormsMessageHook.cs (1)
91
if (
Application
.ThreadContext.FromCurrent().PreTranslateMessage(ref *msg))
System\Windows\Forms\Controls\ToolStrips\ToolstripProfessionalRenderer.cs (1)
301
using var brush =
Application
.IsDarkModeEnabled ?
System\Windows\Forms\Controls\ToolStrips\ToolStripSystemRenderer.cs (3)
55
if (
Application
.RenderWithVisualStyles)
764
if (!
Application
.RenderWithVisualStyles)
772
if (
Application
.RenderWithVisualStyles)
System\Windows\Forms\Controls\TrackBar\TrackBar.cs (1)
758
using ThemingScope scope = new(
Application
.UseVisualStyles);
System\Windows\Forms\Controls\TreeView\TreeNode.cs (2)
1135
CompareInfo compare =
Application
.CurrentCulture.CompareInfo;
1203
CompareInfo compare =
Application
.CurrentCulture.CompareInfo;
System\Windows\Forms\Controls\TreeView\TreeView.cs (4)
1518
using ThemingScope scope = new(
Application
.UseVisualStyles);
1885
if (c != SystemColors.Window ||
Application
.IsDarkModeEnabled)
1892
if (c != SystemColors.WindowText ||
Application
.IsDarkModeEnabled)
3148
&&
Application
.RenderWithVisualStyles && BorderStyle == BorderStyle.Fixed3D)
System\Windows\Forms\Controls\UpDown\UpDownBase.cs (3)
225
if (!
Application
.RenderWithVisualStyles)
521
if (
Application
.RenderWithVisualStyles)
839
bool themed =
Application
.RenderWithVisualStyles;
System\Windows\Forms\Controls\UpDown\UpDownBase.UpDownButtons.cs (1)
262
if (
Application
.RenderWithVisualStyles)
System\Windows\Forms\Controls\WebBrowser\HtmlShim.cs (1)
113
Application
.OnThreadException(ex);
System\Windows\Forms\Controls\WebBrowser\WebBrowser.WebBrowserSite.cs (1)
81
if (
Application
.RenderWithVisualStyles)
System\Windows\Forms\Controls\WebBrowser\WebBrowserBase.cs (4)
72
if (
Application
.OleRequired() != ApartmentState.STA)
428
Application
.ParkHandle(new HandleRef<HWND>(AXInPlaceObject, hwndInPlaceObject), DpiAwarenessContext);
1160
if (containerControl is
Application
.ParkingWindow)
1215
if (
Application
.OleRequired() != ApartmentState.STA)
System\Windows\Forms\Controls\WebBrowser\WebBrowserHelper.cs (1)
44
internal static uint REGMSG_MSG { get; } = PInvoke.RegisterWindowMessage($"{
Application
.WindowMessagesVersion}_subclassCheck");
System\Windows\Forms\Dialogs\CommonDialogs\CommonDialog.cs (4)
138
Application
.OnThreadException(e);
216
using ThemingScope scope = new(
Application
.UseVisualStyles);
217
Application
.BeginModalMessageLoop();
224
Application
.EndModalMessageLoop();
System\Windows\Forms\Dialogs\CommonDialogs\FileDialog.cs (2)
422
Application
.OnThreadException(e);
728
if (Control.CheckForIllegalCrossThreadCalls &&
Application
.OleRequired() != ApartmentState.STA)
System\Windows\Forms\Dialogs\CommonDialogs\FileDialog.Vista.cs (2)
14
=> !ShowHelp &&
Application
.VisualStyleState.HasFlag(VisualStyles.VisualStyleState.ClientAreaEnabled);
155
Application
.OnThreadException(e);
System\Windows\Forms\Dialogs\CommonDialogs\FolderBrowserDialog.cs (1)
448
if (Control.CheckForIllegalCrossThreadCalls &&
Application
.OleRequired() != ApartmentState.STA)
System\Windows\Forms\Dialogs\CommonDialogs\FontDialog.cs (1)
338
Application
.OnThreadException(e);
System\Windows\Forms\Dialogs\MessageBox.cs (4)
463
if (
Application
.UseVisualStyles)
478
using ThemingScope scope = new(
Application
.UseVisualStyles);
480
Application
.BeginModalMessageLoop();
487
Application
.EndModalMessageLoop();
System\Windows\Forms\Dialogs\TaskDialog\TaskDialog.cs (5)
25
/// Note: In order to use the dialog, you need ensure <see cref="
Application
.EnableVisualStyles"/>
610
using ThemingScope scope = new(
Application
.UseVisualStyles);
621
$"{nameof(
Application
)}.{nameof(
Application
.EnableVisualStyles)}"),
1661
private static void HandleCallbackException(Exception e) =>
Application
.OnThreadException(e);
System\Windows\Forms\Dialogs\ThreadExceptionDialog.cs (3)
120
if (
Application
.AllowQuit)
165
if (
Application
.CustomThreadExceptionHandlerAttached)
187
if (
Application
.CustomThreadExceptionHandlerAttached)
System\Windows\Forms\ErrorProvider\ErrorProvider.ErrorWindow.cs (1)
206
Application
.OnThreadException(e);
System\Windows\Forms\Form.cs (15)
2076
if (!
Application
.OpenForms.Contains(this))
2078
Application
.OpenForms.Add(this);
3171
Application
.OnThreadException(e);
4025
Application
.OpenForms.Remove(this);
4182
Application
.OpenForms.Remove(this);
4226
Application
.OpenForms.Add(this);
4227
if (
Application
.UseWaitCursor)
4278
if (
Application
.IsDarkModeEnabled)
4404
if (
Application
.RenderWithVisualStyles)
4811
if (!
Application
.OpenForms.Contains(ownedForms[i]))
4839
if (ownedForms[i] is not null && !
Application
.OpenForms.Contains(ownedForms[i]))
5521
Application
.OnThreadException(ex);
5674
Application
.RunDialog(this);
6518
Application
.FormActivated(Modal, true);
6520
Application
.FormActivated(Modal, Active);
System\Windows\Forms\Input\InputLanguage.cs (2)
38
Application
.OleRequired();
44
Application
.OleRequired();
System\Windows\Forms\Internal\ItemArray.cs (1)
309
CompareInfo compInfo =
Application
.CurrentCulture.CompareInfo;
System\Windows\Forms\Internal\WinFormsMetadataUpdateHandler.cs (1)
18
foreach (Form openForm in
Application
.OpenForms)
System\Windows\Forms\Layout\Containers\ContainerControl.cs (2)
1586
Application
.OnThreadException(e);
1655
Application
.OnThreadException(e);
System\Windows\Forms\Layout\Containers\SplitContainer.cs (3)
2097
Application
.AddMessageFilter(_splitContainerMessageFilter);
2140
Application
.RemoveMessageFilter(_splitContainerMessageFilter);
2394
Application
.RemoveMessageFilter(_splitContainerMessageFilter);
System\Windows\Forms\MDI\MDIClient.cs (2)
374
Application
.Idle += OnIdle; // do this on idle (it must be mega-delayed).
379
Application
.Idle -= OnIdle;
System\Windows\Forms\NativeWindow.cs (3)
108
Application
.ThreadContext? context =
Application
.ThreadContext.FromId(id);
208
else if (!
Application
.CustomThreadExceptionHandlerAttached)
System\Windows\Forms\NativeWindow.WindowClass.cs (1)
116
return $"{
Application
.WindowsFormsVersion}.{className}.app.0.{s_currentAppDomainHash}{versionSuffix}";
System\Windows\Forms\NotifyIcon.NotifyIconNativeWindow.cs (1)
57
Application
.OnThreadException(e);
System\Windows\Forms\OLE\Clipboard.cs (4)
34
if (
Application
.OleRequired() != ApartmentState.STA)
81
if (
Application
.OleRequired() != ApartmentState.STA)
85
return
Application
.MessageLoop ? throw new ThreadStateException(SR.ThreadMustBeSTA) : null;
156
if (
Application
.OleRequired() != ApartmentState.STA)
System\Windows\Forms\OLE\DragDropHelper.cs (1)
520
if (Control.CheckForIllegalCrossThreadCalls &&
Application
.OleRequired() != ApartmentState.STA)
System\Windows\Forms\Printing\PrintControllerWithStatusDialog.BackgroundThread.cs (1)
73
Application
.Run(_dialog);
System\Windows\Forms\SendKeys\SendKeys.cs (4)
103
Application
.ThreadExit += OnThreadExit;
910
if (!wait && !
Application
.MessageLoop)
991
Application
.DoEvents();
994
Application
.DoEvents();
System\Windows\Forms\Timer.cs (1)
331
Application
.OnThreadException(e);
System\Windows\Forms\ToolTip\ToolTip.cs (1)
700
using (ThemingScope scope = new(
Application
.UseVisualStyles))
System\Windows\Forms\VisualStyles\VisualStyleInformation.cs (4)
152
Application
.RenderWithVisualStyles
164
if (!
Application
.UseVisualStyles)
181
public static Color TextControlBorder =>
Application
.RenderWithVisualStyles
188
public static Color ControlHighlightHot =>
Application
.RenderWithVisualStyles
System\Windows\Forms\VisualStyles\VisualStyleRenderer.cs (1)
39
((
Application
.VisualStyleState & VisualStyleState.ClientAreaEnabled) == VisualStyleState.ClientAreaEnabled));
System\Windows\Forms\WindowsFormsSynchronizationContext.cs (1)
30
_controlToSendTo =
Application
.ThreadContext.FromCurrent().MarshallingControl;
System.Windows.Forms.Design (15)
System\ComponentModel\Design\CollectionEditor.FilterListBox.cs (2)
59
Application
.DoEvents();
86
Application
.DoEvents();
System\ComponentModel\Design\DesignerActionPanel.EditorPropertyLine.FlyoutDialog.cs (1)
90
Application
.DoEvents();
System\ComponentModel\Design\EventBindingService.cs (2)
245
Application
.Idle += ShowCodeIdle;
256
Application
.Idle -= ShowCodeIdle;
System\ComponentModel\Design\SelectionService.cs (2)
178
Application
.Idle -= ApplicationIdle;
195
Application
.Idle += ApplicationIdle;
System\ComponentModel\Design\Serialization\BasicDesignerLoader.cs (3)
246
Application
.Idle -= OnIdle;
725
Application
.Idle -= OnIdle;
836
Application
.Idle += OnIdle;
System\Windows\Forms\Design\ControlDesigner.cs (2)
518
Application
.OleRequired();
879
Application
.OleRequired();
System\Windows\Forms\Design\DocumentDesigner.AxToolboxItem.cs (1)
299
(uint)
Application
.CurrentCulture.LCID,
System\Windows\Forms\Design\FolderNameEditor.FolderBrowser.cs (1)
56
Application
.OleRequired();
System\Windows\Forms\Design\FormatStringEditor.cs (1)
30
Application
.SetHighDpiMode(HighDpiMode.SystemAware);
System.Windows.Forms.Tests (220)
ExceptionHandlingTests.cs (1)
16
Application
.DoEvents();
ModuleInitializer.cs (1)
18
Application
.EnableVisualStyles();
NumericUpDownTests.cs (3)
23
if (
Application
.RenderWithVisualStyles)
66
if (
Application
.RenderWithVisualStyles)
102
if (!
Application
.RenderWithVisualStyles)
System\Windows\Forms\AccessibleObjects\ListVIew.ListViewAccessibleObjectTests.cs (12)
79
if (!
Application
.UseVisualStyles)
109
if (
Application
.UseVisualStyles)
1448
if (!
Application
.UseVisualStyles)
1474
if (!
Application
.UseVisualStyles)
1511
if (!
Application
.UseVisualStyles)
1544
if (!
Application
.UseVisualStyles)
1563
if (!
Application
.UseVisualStyles)
1591
if (!
Application
.UseVisualStyles)
1615
if (!
Application
.UseVisualStyles)
1637
if (!
Application
.UseVisualStyles)
1661
if (!
Application
.UseVisualStyles)
1695
if (!
Application
.UseVisualStyles)
System\Windows\Forms\AccessibleObjects\ListViewGroup.ListViewGroupAccessibleObjectTests.cs (15)
78
if (!
Application
.UseVisualStyles)
852
if (!
Application
.UseVisualStyles)
876
if (!
Application
.UseVisualStyles)
916
if (!
Application
.UseVisualStyles)
945
if (!
Application
.UseVisualStyles)
965
if (!
Application
.UseVisualStyles)
991
if (!
Application
.UseVisualStyles)
1016
if (!
Application
.UseVisualStyles)
1035
if (!
Application
.UseVisualStyles)
1059
if (!
Application
.UseVisualStyles)
1086
if (!
Application
.UseVisualStyles)
1107
if (!
Application
.UseVisualStyles)
1133
if (!
Application
.UseVisualStyles)
1190
if (!
Application
.UseVisualStyles)
1211
if (!
Application
.UseVisualStyles)
System\Windows\Forms\AccessibleObjects\ListViewItem.ListViewItemAccessibleObjectTests.cs (7)
157
return
Application
.UseVisualStyles
201
if (
Application
.UseVisualStyles && showGroups && !virtualMode && listView.View != View.List)
248
if (
Application
.UseVisualStyles && showGroups && !virtualMode && listView.View != View.List)
977
if (!
Application
.UseVisualStyles)
1280
if (!
Application
.UseVisualStyles)
1337
if (!
Application
.UseVisualStyles)
1395
if (!
Application
.UseVisualStyles)
System\Windows\Forms\AccessibleObjects\TabPage.TabAccessibleObjectTests.cs (5)
622
Application
.DoEvents();
711
Application
.DoEvents();
776
Application
.DoEvents();
881
Application
.DoEvents();
970
Application
.DoEvents();
System\Windows\Forms\AccessibleObjects\ToolStripMenuItem.ToolStripMenuItemAccessibleObjectTests.cs (1)
55
foreach (Form form in
Application
.OpenForms)
System\Windows\Forms\Application.ComponentManagerTests.cs (1)
14
typeof(
Application
).Assembly.GetType("System.Windows.Forms.Application+ComponentManager")!,
System\Windows\Forms\Application.ParkingWindowTests.cs (1)
5
using static System.Windows.Forms.
Application
;
System\Windows\Forms\ApplicationContextTests.cs (2)
391
Assert.True(type == typeof(ApplicationContext) || type ==
Application
.s_typeOfModalApplicationContext,
392
$"Type {type} is not one of [{typeof(ApplicationContext)}, {
Application
.s_typeOfModalApplicationContext}]. " +
System\Windows\Forms\ApplicationTests.cs (68)
18
Assert.Same(Thread.CurrentThread.CurrentCulture,
Application
.CurrentCulture);
45
CultureInfo oldValue =
Application
.CurrentCulture;
48
Application
.CurrentCulture = value;
49
Assert.Same(value,
Application
.CurrentCulture);
55
Application
.CurrentCulture = value;
56
Assert.Same(value,
Application
.CurrentCulture);
63
Application
.CurrentCulture = oldValue;
72
Assert.Throws<ArgumentNullException>("value", () =>
Application
.CurrentCulture = null);
80
Application
.EnableVisualStyles();
81
Assert.True(
Application
.UseVisualStyles);
82
Assert.True(
Application
.RenderWithVisualStyles);
94
Assert.False(
Application
.UseVisualStyles);
95
Assert.False(
Application
.RenderWithVisualStyles);
97
Application
.EnableVisualStyles();
98
Assert.True(
Application
.UseVisualStyles, "New Visual Styles will not be applied on WinForms app. This is a high priority bug and must be looked into");
99
Assert.True(
Application
.RenderWithVisualStyles);
106
FormCollection forms =
Application
.OpenForms;
107
Assert.Same(forms,
Application
.OpenForms);
113
VisualStyleState state =
Application
.VisualStyleState;
115
Assert.Equal(state,
Application
.VisualStyleState);
128
VisualStyleState state =
Application
.VisualStyleState;
131
Application
.VisualStyleState = value;
132
Assert.Equal(value,
Application
.VisualStyleState);
136
Application
.VisualStyleState = state;
145
using Stream stream = typeof(
Application
).Module.Assembly.GetManifestResourceStream(
161
SystemColorMode systemColorMode =
Application
.SystemColorMode;
163
Application
.SetColorMode(SystemColorMode.Classic);
164
Assert.False(
Application
.IsDarkModeEnabled);
165
Assert.Equal(SystemColorMode.Classic,
Application
.ColorMode);
168
Application
.SetColorMode(SystemColorMode.Dark);
169
Assert.True(
Application
.IsDarkModeEnabled);
170
Assert.Equal(SystemColorMode.Dark,
Application
.ColorMode);
173
Application
.SetColorMode(SystemColorMode.System);
174
Assert.False(
Application
.IsDarkModeEnabled ^ systemColorMode == SystemColorMode.Dark);
175
Assert.Equal(SystemColorMode.System,
Application
.ColorMode);
184
var applicationTestAccessor = typeof(
Application
).TestAccessor().Dynamic;
187
Assert.Null(
Application
.DefaultFont);
193
var applicationTestAccessor = typeof(
Application
).TestAccessor().Dynamic;
202
AreFontEqual(customFont,
Application
.DefaultFont);
216
var applicationTestAccessor = typeof(
Application
).TestAccessor().Dynamic;
227
AreFontEqual(scaled,
Application
.DefaultFont);
241
Assert.Throws<ArgumentNullException>("font", () =>
Application
.SetDefaultFont(null));
251
Assert.Throws<InvalidOperationException>(() =>
Application
.SetDefaultFont(SystemFonts.CaptionFont));
257
var applicationTestAccessor = typeof(
Application
).TestAccessor().Dynamic;
272
Application
.SetDefaultFont(sysFont);
278
Application
.DefaultFont.Should().BeSameAs(sysFont);
285
Application
.SetDefaultFont(fakeSysFont);
288
Application
.DefaultFont.Should().NotBe(fakeSysFont, "Because we got a new real system font.");
289
Application
.DefaultFont.Should().NotBeSameAs(sysFont, "Because we got a new system font.");
290
Application
.DefaultFont.Should().Be(sysFont, "Because the new system font is the same as our original system font.");
304
var applicationTestAccessor = typeof(
Application
).TestAccessor().Dynamic;
320
Application
.SetDefaultFont(customFont);
325
Application
.DefaultFont.Should().BeSameAs(customFont);
335
Application
.DefaultFont.Should().BeSameAs(customFont, "Because TextScaleFactor == 100.");
340
Application
.DefaultFont.Should().NotBe(customFont, "Because textScaleFactor != 100 and we got a new scaled font.");
358
Assert.Throws<InvalidEnumArgumentException>("highDpiMode", () =>
Application
.SetHighDpiMode(value));
362
/// Test <see cref="
Application
.Exit()"/> fire Closing events in correct order for MDI windows.
388
Application
.EnableVisualStyles();
390
Assert.Empty(
Application
.OpenForms);
410
Application
.Exit();
472
/// Test <see cref="
Application
.Exit()"/> fire Closing events in which we close existing and open new forms.
526
Application
.EnableVisualStyles();
528
Assert.Empty(
Application
.OpenForms);
580
Application
.OpenForms[rnd.Next(1,
Application
.OpenForms.Count - 1)].Close();
605
Application
.Exit();
614
Assert.Empty(
Application
.OpenForms);
619
Assert.Equal(1 + childFormCount + addFormCount - removedFormCount,
Application
.OpenForms.Count);
System\Windows\Forms\ButtonRenderingTests.cs (4)
31
if (
Application
.RenderWithVisualStyles)
75
if (!
Application
.RenderWithVisualStyles)
115
if (
Application
.RenderWithVisualStyles)
161
if (!
Application
.RenderWithVisualStyles)
System\Windows\Forms\CheckBoxRendererTests.cs (4)
35
Application
.RenderWithVisualStyles
72
Application
.RenderWithVisualStyles
109
Application
.RenderWithVisualStyles
143
Application
.RenderWithVisualStyles
System\Windows\Forms\CommonDialogTests.cs (3)
130
Application
.EnableVisualStyles();
168
Application
.EnableVisualStyles();
204
Application
.EnableVisualStyles();
System\Windows\Forms\ControlTests.Properties.cs (1)
252
Assert.Equal(ApartmentState.STA,
Application
.OleRequired());
System\Windows\Forms\DataGridViewHeaderCellTests.cs (12)
3877
Application
.EnableVisualStyles();
4026
Application
.EnableVisualStyles();
4067
Application
.EnableVisualStyles();
4174
Application
.EnableVisualStyles();
4200
Application
.EnableVisualStyles();
4282
if (!
Application
.RenderWithVisualStyles)
4350
if (!
Application
.RenderWithVisualStyles)
4385
Application
.EnableVisualStyles();
4415
Application
.EnableVisualStyles();
4495
if (!
Application
.RenderWithVisualStyles)
4556
Application
.EnableVisualStyles();
4583
Application
.EnableVisualStyles();
System\Windows\Forms\DataGridViewRowTests.cs (4)
2021
var oldApplicationDefaultFont =
Application
.DefaultFont;
2024
var applicationTestAccessor = typeof(
Application
).TestAccessor().Dynamic;
2029
Assert.NotEqual(oldApplicationDefaultFont,
Application
.DefaultFont);
3726
if (!
Application
.RenderWithVisualStyles && row.DataGridView.EnableHeadersVisualStyles)
System\Windows\Forms\DomainUpDownTests.cs (2)
55
if (
Application
.UseVisualStyles)
167
if (
Application
.UseVisualStyles)
System\Windows\Forms\GroupBoxTests.cs (6)
699
if (
Application
.UseVisualStyles)
753
if (!
Application
.UseVisualStyles)
813
if (
Application
.UseVisualStyles)
876
if (!
Application
.UseVisualStyles)
1938
if (!
Application
.RenderWithVisualStyles)
1950
if (
Application
.RenderWithVisualStyles)
System\Windows\Forms\ListViewGroupTests.cs (9)
211
Application
.EnableVisualStyles();
352
Application
.EnableVisualStyles();
496
Application
.EnableVisualStyles();
609
Application
.EnableVisualStyles();
749
Application
.EnableVisualStyles();
870
Application
.EnableVisualStyles();
1001
Application
.EnableVisualStyles();
1126
Application
.EnableVisualStyles();
1275
Application
.EnableVisualStyles();
System\Windows\Forms\ListViewInsertionMarkTests.cs (5)
87
Application
.EnableVisualStyles();
137
Application
.EnableVisualStyles();
363
Application
.EnableVisualStyles();
460
Application
.EnableVisualStyles();
514
Application
.EnableVisualStyles();
System\Windows\Forms\ListViewItem.IKeyboardToolTipTests.cs (3)
148
int expectedWidth =
Application
.UseVisualStyles
183
int expectedWidth =
Application
.UseVisualStyles
199
int expectedWidth =
Application
.UseVisualStyles
System\Windows\Forms\ListViewTests.cs (5)
1914
Application
.EnableVisualStyles();
1985
int version =
Application
.UseVisualStyles ? 6 : 5;
3248
if (
Application
.UseVisualStyles)
3359
if (
Application
.UseVisualStyles)
4564
Application
.EnableVisualStyles();
System\Windows\Forms\RadioButtonRendererTests.cs (4)
32
if (
Application
.RenderWithVisualStyles)
36
Application
.RenderWithVisualStyles
66
Application
.RenderWithVisualStyles
132
Application
.RenderWithVisualStyles
System\Windows\Forms\RichTextBoxTests.cs (2)
313
Assert.Equal(ApartmentState.STA,
Application
.OleRequired());
1265
Assert.Equal(ApartmentState.STA,
Application
.OleRequired());
System\Windows\Forms\ScrollBarTests.cs (2)
3115
Application
.DoEvents();
3134
Application
.DoEvents();
System\Windows\Forms\TabPageTests.cs (4)
546
Application
.EnableVisualStyles();
566
if (
Application
.UseVisualStyles)
597
if (
Application
.UseVisualStyles)
628
Application
.EnableVisualStyles();
System\Windows\Forms\TaskDialogTests.cs (2)
16
Application
.EnableVisualStyles();
40
Application
.EnableVisualStyles();
System\Windows\Forms\TextBoxBase.TextBoxBaseUiaTextProviderTests.cs (2)
475
if (
Application
.UseVisualStyles)
645
if (
Application
.UseVisualStyles)
System\Windows\Forms\ToolStripTests.cs (8)
71
if (
Application
.UseVisualStyles)
225
if (
Application
.UseVisualStyles)
460
Assert.Equal(ApartmentState.STA,
Application
.OleRequired());
2262
int x =
Application
.UseVisualStyles ? 9 : 7;
2263
int width =
Application
.UseVisualStyles ? 90 : 92;
2264
int height =
Application
.UseVisualStyles ? 16 : 18;
6668
int x =
Application
.UseVisualStyles ? 9 : 7;
6713
int x =
Application
.UseVisualStyles ? 9 : 7;
System\Windows\Forms\TreeViewTests.cs (1)
1678
int version =
Application
.UseVisualStyles ? 6 : 5;
System\Windows\Forms\UpDownBaseTests.cs (12)
42
if (
Application
.UseVisualStyles)
150
if (
Application
.UseVisualStyles)
175
if (
Application
.RenderWithVisualStyles)
717
if (
Application
.UseVisualStyles)
754
if (
Application
.UseVisualStyles)
1592
int expectedWidth =
Application
.UseVisualStyles ? 122 : 123;
1612
int expectedWidth =
Application
.UseVisualStyles ? 32 : 33;
1624
int expectedWidth =
Application
.UseVisualStyles ? 122 : 123;
2330
if (!
Application
.RenderWithVisualStyles)
2342
if (
Application
.RenderWithVisualStyles)
2753
if (
Application
.UseVisualStyles)
2785
if (
Application
.UseVisualStyles)
ThreadContextTests.cs (8)
21
Application
.ThreadContext threadContext = new
Application
.LightThreadContext();
30
Application
.ThreadContext threadContext = new
Application
.LightThreadContext();
50
Application
.ThreadContext threadContext = new
Application
.LightThreadContext();
70
Application
.ThreadContext threadContext = new
Application
.LightThreadContext();
System.Windows.Forms.UI.IntegrationTests (23)
ApplicationTests.cs (4)
28
Assert.Equal(expectedFormCount,
Application
.OpenForms.Count);
30
Assert.Equal(expectedFormCount,
Application
.OpenForms.Count);
32
Assert.Equal(expectedFormCount,
Application
.OpenForms.Count);
34
Assert.Equal(expectedFormCount,
Application
.OpenForms.Count);
DesignBehaviorsTests.cs (1)
28
Application
.ThreadException += (s, e) =>
Infra\ControlTestBase.cs (6)
40
Application
.EnableVisualStyles();
147
Application
.Idle += HandleApplicationIdle;
148
Application
.LeaveThreadModal += HandleApplicationIdle;
156
if (
Application
.OpenForms.Count > 0)
163
Application
.Idle -= HandleApplicationIdle;
164
Application
.LeaveThreadModal -= HandleApplicationIdle;
ListViewTests.cs (12)
126
Application
.DoEvents();
192
Application
.DoEvents();
209
Application
.DoEvents();
249
Application
.DoEvents();
266
Application
.DoEvents();
287
Application
.DoEvents();
331
Application
.DoEvents();
348
Application
.DoEvents();
368
Application
.DoEvents();
390
Application
.DoEvents();
409
Application
.DoEvents();
446
Application
.DoEvents();
TrimTest (3)
Program.cs (3)
13
Application
.EnableVisualStyles();
14
Application
.SetHighDpiMode(HighDpiMode.PerMonitorV2);
15
Application
.Run(new Form1());
TrimTestBinaryDeserialization (3)
Program.cs (3)
14
Application
.EnableVisualStyles();
15
Application
.SetHighDpiMode(HighDpiMode.PerMonitorV2);
16
Application
.Run(new Form1());
WindowsFormsIntegration (3)
System\Windows\Integration\ApplicationInterop.cs (3)
51
SWF.
Application
.AddMessageFilter(filter);
99
if (
Application
.FilterMessage(ref m))
234
SWF.
Application
.RemoveMessageFilter(windowFilter);
WinFormsControlsTest (3)
CustomComCtl32Button.cs (1)
92
if (
Application
.RenderWithVisualStyles && !isPressed)
Program.cs (2)
12
Application
.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
22
Application
.Run(form);