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