From 827db4fc0d819e5b8d2fbfa0fce5bf6ea820e158 Mon Sep 17 00:00:00 2001 From: Igor Velikorossov Date: Mon, 3 Feb 2020 17:00:09 +1100 Subject: [PATCH] Remove deprecated API - Remove the following API because they have been obsolete since .NET 2.0: * `StatusBar` * `StatusBarDrawItemEventArgs` * `StatusBarDrawItemEventHandler` * `StatusBarPanel` * `StatusBarPanelAutoSize` * `StatusBarPanelBorderStyle` * `StatusBarPanelClickEventArgs` * `StatusBarPanelClickEventHandler` * `StatusBarPanelStyle` Relates to #2091 --- .../src/PublicAPI.Shipped.txt | 118 - .../src/Resources/SR.resx | 51 - .../System/Windows/Forms/StatusBar.ico | Bin 1086 -> 0 bytes .../src/Resources/xlf/SR.cs.xlf | 85 - .../src/Resources/xlf/SR.de.xlf | 85 - .../src/Resources/xlf/SR.es.xlf | 85 - .../src/Resources/xlf/SR.fr.xlf | 85 - .../src/Resources/xlf/SR.it.xlf | 85 - .../src/Resources/xlf/SR.ja.xlf | 85 - .../src/Resources/xlf/SR.ko.xlf | 85 - .../src/Resources/xlf/SR.pl.xlf | 85 - .../src/Resources/xlf/SR.pt-BR.xlf | 85 - .../src/Resources/xlf/SR.ru.xlf | 85 - .../src/Resources/xlf/SR.tr.xlf | 85 - .../src/Resources/xlf/SR.zh-Hans.xlf | 85 - .../src/Resources/xlf/SR.zh-Hant.xlf | 85 - .../src/System.Windows.Forms.csproj | 3 - .../src/System/Windows/Forms/StatusBar.cs | 1911 ----------------- .../Forms/StatusBarDrawItemEventArgs.cs | 45 - .../Forms/StatusBarDrawItemEventHandler.cs | 14 - .../System/Windows/Forms/StatusBarPanel.cs | 708 ------ .../Windows/Forms/StatusBarPanelAutoSize.cs | 29 - .../Forms/StatusBarPanelBorderStyle.cs | 27 - .../Forms/StatusBarPanelClickEventArgs.cs | 29 - .../Forms/StatusBarPanelClickEventHandler.cs | 14 - .../Windows/Forms/StatusBarPanelStyle.cs | 22 - .../src/System/Windows/Forms/ToolTip.cs | 5 - .../Forms/StatusBarDrawItemEventArgsTests.cs | 69 - .../StatusBarPanelClickEventArgsTests.cs | 34 - .../Windows/Forms/StatusBarPanelTests.cs | 382 ---- 30 files changed, 4566 deletions(-) delete mode 100644 src/System.Windows.Forms/src/Resources/System/Windows/Forms/StatusBar.ico delete mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/StatusBar.cs delete mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/StatusBarDrawItemEventArgs.cs delete mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/StatusBarDrawItemEventHandler.cs delete mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanel.cs delete mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelAutoSize.cs delete mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelBorderStyle.cs delete mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelClickEventArgs.cs delete mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelClickEventHandler.cs delete mode 100644 src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelStyle.cs delete mode 100644 src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/StatusBarDrawItemEventArgsTests.cs delete mode 100644 src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/StatusBarPanelClickEventArgsTests.cs delete mode 100644 src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/StatusBarPanelTests.cs diff --git a/src/System.Windows.Forms/src/PublicAPI.Shipped.txt b/src/System.Windows.Forms/src/PublicAPI.Shipped.txt index eb16232e75e..ad9c279182d 100644 --- a/src/System.Windows.Forms/src/PublicAPI.Shipped.txt +++ b/src/System.Windows.Forms/src/PublicAPI.Shipped.txt @@ -6063,79 +6063,6 @@ System.Windows.Forms.SplitterPanel.Visible.set -> void System.Windows.Forms.SplitterPanel.VisibleChanged -> System.EventHandler System.Windows.Forms.SplitterPanel.Width.get -> int System.Windows.Forms.SplitterPanel.Width.set -> void -System.Windows.Forms.StatusBar -System.Windows.Forms.StatusBar.BackColorChanged -> System.EventHandler -System.Windows.Forms.StatusBar.BackgroundImageChanged -> System.EventHandler -System.Windows.Forms.StatusBar.BackgroundImageLayoutChanged -> System.EventHandler -System.Windows.Forms.StatusBar.DrawItem -> System.Windows.Forms.StatusBarDrawItemEventHandler -System.Windows.Forms.StatusBar.ForeColorChanged -> System.EventHandler -System.Windows.Forms.StatusBar.ImeMode.get -> System.Windows.Forms.ImeMode -System.Windows.Forms.StatusBar.ImeMode.set -> void -System.Windows.Forms.StatusBar.ImeModeChanged -> System.EventHandler -System.Windows.Forms.StatusBar.Paint -> System.Windows.Forms.PaintEventHandler -System.Windows.Forms.StatusBar.PanelClick -> System.Windows.Forms.StatusBarPanelClickEventHandler -System.Windows.Forms.StatusBar.Panels.get -> System.Windows.Forms.StatusBar.StatusBarPanelCollection -System.Windows.Forms.StatusBar.ShowPanels.get -> bool -System.Windows.Forms.StatusBar.ShowPanels.set -> void -System.Windows.Forms.StatusBar.SizingGrip.get -> bool -System.Windows.Forms.StatusBar.SizingGrip.set -> void -System.Windows.Forms.StatusBar.StatusBar() -> void -System.Windows.Forms.StatusBar.StatusBarPanelCollection -System.Windows.Forms.StatusBar.StatusBarPanelCollection.Contains(System.Windows.Forms.StatusBarPanel panel) -> bool -System.Windows.Forms.StatusBar.StatusBarPanelCollection.Count.get -> int -System.Windows.Forms.StatusBar.StatusBarPanelCollection.GetEnumerator() -> System.Collections.IEnumerator -System.Windows.Forms.StatusBar.StatusBarPanelCollection.IndexOf(System.Windows.Forms.StatusBarPanel panel) -> int -System.Windows.Forms.StatusBar.StatusBarPanelCollection.IsReadOnly.get -> bool -System.Windows.Forms.StatusBar.StatusBarPanelCollection.StatusBarPanelCollection(System.Windows.Forms.StatusBar owner) -> void -System.Windows.Forms.StatusBar.TabStop.get -> bool -System.Windows.Forms.StatusBar.TabStop.set -> void -System.Windows.Forms.StatusBarDrawItemEventArgs -System.Windows.Forms.StatusBarDrawItemEventArgs.Panel.get -> System.Windows.Forms.StatusBarPanel -System.Windows.Forms.StatusBarDrawItemEventArgs.StatusBarDrawItemEventArgs(System.Drawing.Graphics g, System.Drawing.Font font, System.Drawing.Rectangle r, int itemId, System.Windows.Forms.DrawItemState itemState, System.Windows.Forms.StatusBarPanel panel) -> void -System.Windows.Forms.StatusBarDrawItemEventArgs.StatusBarDrawItemEventArgs(System.Drawing.Graphics g, System.Drawing.Font font, System.Drawing.Rectangle r, int itemId, System.Windows.Forms.DrawItemState itemState, System.Windows.Forms.StatusBarPanel panel, System.Drawing.Color foreColor, System.Drawing.Color backColor) -> void -System.Windows.Forms.StatusBarDrawItemEventHandler -System.Windows.Forms.StatusBarPanel -System.Windows.Forms.StatusBarPanel.Alignment.get -> System.Windows.Forms.HorizontalAlignment -System.Windows.Forms.StatusBarPanel.Alignment.set -> void -System.Windows.Forms.StatusBarPanel.AutoSize.get -> System.Windows.Forms.StatusBarPanelAutoSize -System.Windows.Forms.StatusBarPanel.AutoSize.set -> void -System.Windows.Forms.StatusBarPanel.BeginInit() -> void -System.Windows.Forms.StatusBarPanel.BorderStyle.get -> System.Windows.Forms.StatusBarPanelBorderStyle -System.Windows.Forms.StatusBarPanel.BorderStyle.set -> void -System.Windows.Forms.StatusBarPanel.EndInit() -> void -System.Windows.Forms.StatusBarPanel.Icon.get -> System.Drawing.Icon -System.Windows.Forms.StatusBarPanel.Icon.set -> void -System.Windows.Forms.StatusBarPanel.MinWidth.get -> int -System.Windows.Forms.StatusBarPanel.MinWidth.set -> void -System.Windows.Forms.StatusBarPanel.Name.get -> string -System.Windows.Forms.StatusBarPanel.Name.set -> void -System.Windows.Forms.StatusBarPanel.Parent.get -> System.Windows.Forms.StatusBar -System.Windows.Forms.StatusBarPanel.StatusBarPanel() -> void -System.Windows.Forms.StatusBarPanel.Style.get -> System.Windows.Forms.StatusBarPanelStyle -System.Windows.Forms.StatusBarPanel.Style.set -> void -System.Windows.Forms.StatusBarPanel.Tag.get -> object -System.Windows.Forms.StatusBarPanel.Tag.set -> void -System.Windows.Forms.StatusBarPanel.Text.get -> string -System.Windows.Forms.StatusBarPanel.Text.set -> void -System.Windows.Forms.StatusBarPanel.ToolTipText.get -> string -System.Windows.Forms.StatusBarPanel.ToolTipText.set -> void -System.Windows.Forms.StatusBarPanel.Width.get -> int -System.Windows.Forms.StatusBarPanel.Width.set -> void -System.Windows.Forms.StatusBarPanelAutoSize -System.Windows.Forms.StatusBarPanelAutoSize.Contents = 3 -> System.Windows.Forms.StatusBarPanelAutoSize -System.Windows.Forms.StatusBarPanelAutoSize.None = 1 -> System.Windows.Forms.StatusBarPanelAutoSize -System.Windows.Forms.StatusBarPanelAutoSize.Spring = 2 -> System.Windows.Forms.StatusBarPanelAutoSize -System.Windows.Forms.StatusBarPanelBorderStyle -System.Windows.Forms.StatusBarPanelBorderStyle.None = 1 -> System.Windows.Forms.StatusBarPanelBorderStyle -System.Windows.Forms.StatusBarPanelBorderStyle.Raised = 2 -> System.Windows.Forms.StatusBarPanelBorderStyle -System.Windows.Forms.StatusBarPanelBorderStyle.Sunken = 3 -> System.Windows.Forms.StatusBarPanelBorderStyle -System.Windows.Forms.StatusBarPanelClickEventArgs -System.Windows.Forms.StatusBarPanelClickEventArgs.StatusBarPanel.get -> System.Windows.Forms.StatusBarPanel -System.Windows.Forms.StatusBarPanelClickEventArgs.StatusBarPanelClickEventArgs(System.Windows.Forms.StatusBarPanel statusBarPanel, System.Windows.Forms.MouseButtons button, int clicks, int x, int y) -> void -System.Windows.Forms.StatusBarPanelClickEventHandler -System.Windows.Forms.StatusBarPanelStyle -System.Windows.Forms.StatusBarPanelStyle.OwnerDraw = 2 -> System.Windows.Forms.StatusBarPanelStyle -System.Windows.Forms.StatusBarPanelStyle.Text = 1 -> System.Windows.Forms.StatusBarPanelStyle System.Windows.Forms.StatusStrip System.Windows.Forms.StatusStrip.CanOverflow.get -> bool System.Windows.Forms.StatusStrip.CanOverflow.set -> void @@ -10107,36 +10034,6 @@ override System.Windows.Forms.Splitter.Text.set -> void override System.Windows.Forms.Splitter.ToString() -> string override System.Windows.Forms.SplitterPanel.AutoSizeMode.get -> System.Windows.Forms.AutoSizeMode override System.Windows.Forms.SplitterPanel.AutoSizeMode.set -> void -override System.Windows.Forms.StatusBar.BackColor.get -> System.Drawing.Color -override System.Windows.Forms.StatusBar.BackColor.set -> void -override System.Windows.Forms.StatusBar.BackgroundImage.get -> System.Drawing.Image -override System.Windows.Forms.StatusBar.BackgroundImage.set -> void -override System.Windows.Forms.StatusBar.BackgroundImageLayout.get -> System.Windows.Forms.ImageLayout -override System.Windows.Forms.StatusBar.BackgroundImageLayout.set -> void -override System.Windows.Forms.StatusBar.CreateHandle() -> void -override System.Windows.Forms.StatusBar.CreateParams.get -> System.Windows.Forms.CreateParams -override System.Windows.Forms.StatusBar.DefaultImeMode.get -> System.Windows.Forms.ImeMode -override System.Windows.Forms.StatusBar.DefaultSize.get -> System.Drawing.Size -override System.Windows.Forms.StatusBar.Dispose(bool disposing) -> void -override System.Windows.Forms.StatusBar.Dock.get -> System.Windows.Forms.DockStyle -override System.Windows.Forms.StatusBar.Dock.set -> void -override System.Windows.Forms.StatusBar.DoubleBuffered.get -> bool -override System.Windows.Forms.StatusBar.DoubleBuffered.set -> void -override System.Windows.Forms.StatusBar.Font.get -> System.Drawing.Font -override System.Windows.Forms.StatusBar.Font.set -> void -override System.Windows.Forms.StatusBar.ForeColor.get -> System.Drawing.Color -override System.Windows.Forms.StatusBar.ForeColor.set -> void -override System.Windows.Forms.StatusBar.OnHandleCreated(System.EventArgs e) -> void -override System.Windows.Forms.StatusBar.OnHandleDestroyed(System.EventArgs e) -> void -override System.Windows.Forms.StatusBar.OnLayout(System.Windows.Forms.LayoutEventArgs levent) -> void -override System.Windows.Forms.StatusBar.OnMouseDown(System.Windows.Forms.MouseEventArgs e) -> void -override System.Windows.Forms.StatusBar.OnResize(System.EventArgs e) -> void -override System.Windows.Forms.StatusBar.Text.get -> string -override System.Windows.Forms.StatusBar.Text.set -> void -override System.Windows.Forms.StatusBar.ToString() -> string -override System.Windows.Forms.StatusBar.WndProc(ref System.Windows.Forms.Message m) -> void -override System.Windows.Forms.StatusBarPanel.Dispose(bool disposing) -> void -override System.Windows.Forms.StatusBarPanel.ToString() -> string override System.Windows.Forms.StatusStrip.CreateAccessibilityInstance() -> System.Windows.Forms.AccessibleObject override System.Windows.Forms.StatusStrip.CreateDefaultItem(string text, System.Drawing.Image image, System.EventHandler onClick) -> System.Windows.Forms.ToolStripItem override System.Windows.Forms.StatusStrip.DefaultDock.get -> System.Windows.Forms.DockStyle @@ -12905,21 +12802,6 @@ virtual System.Windows.Forms.ScrollableControl.OnScroll(System.Windows.Forms.Scr virtual System.Windows.Forms.ScrollableControl.ScrollToControl(System.Windows.Forms.Control activeControl) -> System.Drawing.Point virtual System.Windows.Forms.Splitter.OnSplitterMoved(System.Windows.Forms.SplitterEventArgs sevent) -> void virtual System.Windows.Forms.Splitter.OnSplitterMoving(System.Windows.Forms.SplitterEventArgs sevent) -> void -virtual System.Windows.Forms.StatusBar.OnDrawItem(System.Windows.Forms.StatusBarDrawItemEventArgs sbdievent) -> void -virtual System.Windows.Forms.StatusBar.OnPanelClick(System.Windows.Forms.StatusBarPanelClickEventArgs e) -> void -virtual System.Windows.Forms.StatusBar.StatusBarPanelCollection.Add(System.Windows.Forms.StatusBarPanel value) -> int -virtual System.Windows.Forms.StatusBar.StatusBarPanelCollection.Add(string text) -> System.Windows.Forms.StatusBarPanel -virtual System.Windows.Forms.StatusBar.StatusBarPanelCollection.AddRange(System.Windows.Forms.StatusBarPanel[] panels) -> void -virtual System.Windows.Forms.StatusBar.StatusBarPanelCollection.Clear() -> void -virtual System.Windows.Forms.StatusBar.StatusBarPanelCollection.ContainsKey(string key) -> bool -virtual System.Windows.Forms.StatusBar.StatusBarPanelCollection.IndexOfKey(string key) -> int -virtual System.Windows.Forms.StatusBar.StatusBarPanelCollection.Insert(int index, System.Windows.Forms.StatusBarPanel value) -> void -virtual System.Windows.Forms.StatusBar.StatusBarPanelCollection.Remove(System.Windows.Forms.StatusBarPanel value) -> void -virtual System.Windows.Forms.StatusBar.StatusBarPanelCollection.RemoveAt(int index) -> void -virtual System.Windows.Forms.StatusBar.StatusBarPanelCollection.RemoveByKey(string key) -> void -virtual System.Windows.Forms.StatusBar.StatusBarPanelCollection.this[int index].get -> System.Windows.Forms.StatusBarPanel -virtual System.Windows.Forms.StatusBar.StatusBarPanelCollection.this[int index].set -> void -virtual System.Windows.Forms.StatusBar.StatusBarPanelCollection.this[string key].get -> System.Windows.Forms.StatusBarPanel virtual System.Windows.Forms.StatusStrip.OnSpringTableLayoutCore() -> void virtual System.Windows.Forms.TabControl.GetItems() -> object[] virtual System.Windows.Forms.TabControl.GetItems(System.Type baseType) -> object[] diff --git a/src/System.Windows.Forms/src/Resources/SR.resx b/src/System.Windows.Forms/src/Resources/SR.resx index 59ea204813d..3db1beaf45e 100644 --- a/src/System.Windows.Forms/src/Resources/SR.resx +++ b/src/System.Windows.Forms/src/Resources/SR.resx @@ -5285,57 +5285,6 @@ Stack trace where the illegal operation occurred was: Occurs when the splitter is being moved. - - Adding the panel to the native status bar control has not succeeded. - - - Parameter must be of type StatusBarPanel. - - - Occurs whenever a panel in the StatusBar needs to be painted. - - - Occurs when a panel within the status bar is clicked. - - - The alignment of the panel's text. - - - Determines how a panel will resize when the parent changes size. - - - Determines what type of border a panel has. - - - Determines what icon is displayed in the panel. - - - The minimum width of the panel. - - - The name of the panel. - - - The panels in the status bar. - - - The style of the panel. - - - The text displayed in the panel. - - - The panel's ToolTip text. - - - The width of the panel. - - - Determines if a status bar displays panels, or if it displays a single line of text. - - - Determines whether a status bar has a sizing grip. - Specifies the sides of the panel that should display borders. diff --git a/src/System.Windows.Forms/src/Resources/System/Windows/Forms/StatusBar.ico b/src/System.Windows.Forms/src/Resources/System/Windows/Forms/StatusBar.ico deleted file mode 100644 index 862dba163dc8621905f50911b64de46baab762a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1086 zcmZQzU<5(|0R|vYV9;P;U=RbcG=LZ+qyWT>U=qjx%AtdA-@g5)6gxRN{U-;*>?KDp zNDsRHkMBSH$A)3%qsvjM|NsC03?MUbnGdrMmpr=tFm=Sz$ogSya%hl!AblYJkcvV2 RM)ePD_`%|w)VKqw2LLbp|F{4E diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.cs.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.cs.xlf index 362868bd7d3..9966f9c2850 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.cs.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.cs.xlf @@ -8841,91 +8841,6 @@ Trasování zásobníku, kde došlo k neplatné operaci: Získání zařazovacího modulu pro IID {0} se nezdařilo. - - Adding the panel to the native status bar control has not succeeded. - Přidání panelu do ovládacího prvku nativního stavového řádku se nezdařilo. - - - - Parameter must be of type StatusBarPanel. - Parametr musí být typu StatusBarPanel. - - - - Occurs whenever a panel in the StatusBar needs to be painted. - Vyvolá se vždy, když je nutné překreslit panel ve stavovém řádku (StatusBar). - - - - Occurs when a panel within the status bar is clicked. - Vyvolá se při každém kliknutí na panel ve stavovém řádku. - - - - The alignment of the panel's text. - Zarovnání textu panelu. - - - - Determines how a panel will resize when the parent changes size. - Určuje změnu velikosti panelu, pokud dojde ke změně velikosti nadřazeného objektu. - - - - Determines what type of border a panel has. - Určuje typ ohraničení panelu. - - - - Determines what icon is displayed in the panel. - Určuje, jaká ikona je zobrazena na panelu. - - - - The minimum width of the panel. - Minimální šířka panelu - - - - The name of the panel. - Název panelu - - - - The style of the panel. - Styl panelu - - - - The text displayed in the panel. - Text zobrazený na panelu - - - - The panel's ToolTip text. - Text popisu panelu - - - - The width of the panel. - Šířka panelu - - - - The panels in the status bar. - Panely ve stavovém řádku - - - - Determines if a status bar displays panels, or if it displays a single line of text. - Určuje, zda se ve stavovém řádku zobrazí panely nebo pouze jeden řádek textu. - - - - Determines whether a status bar has a sizing grip. - Určuje, zda stavový řádek obsahuje úchyt pro změnu velikosti. - - Specifies the sides of the panel that should display borders. Určuje strany panelu, na kterých by se měla zobrazovat ohraničení. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.de.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.de.xlf index 24b0f319d03..9172a994d35 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.de.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.de.xlf @@ -8841,91 +8841,6 @@ Stapelüberwachung, in der der unzulässige Vorgang auftrat: Fehler beim Abrufen des Marshallers für IID {0}. - - Adding the panel to the native status bar control has not succeeded. - Fehler beim Hinzufügen des Bereichs zum nativen Statusleisten-Steuerelement. - - - - Parameter must be of type StatusBarPanel. - Der Parameter muss den Typ StatusBarPanel haben. - - - - Occurs whenever a panel in the StatusBar needs to be painted. - Tritt ein, wenn ein Bereich in der StatusBar gezeichnet werden muss. - - - - Occurs when a panel within the status bar is clicked. - Tritt ein, wenn auf einen Bereich in der Statusleiste geklickt wird - - - - The alignment of the panel's text. - Die Ausrichtung des Bereichtexts. - - - - Determines how a panel will resize when the parent changes size. - Bestimmt, wie die Bereichsgröße geändert wird, wenn sich die Größe des übergeordneten Bereichs ändert. - - - - Determines what type of border a panel has. - Bestimmt den Rahmentyp eines Bereichs. - - - - Determines what icon is displayed in the panel. - Bestimmt, welches Symbol im Bereich angezeigt wird. - - - - The minimum width of the panel. - Die minimale Breite des Bereichs. - - - - The name of the panel. - Der Name des Bereichs. - - - - The style of the panel. - Der Bereichsstil. - - - - The text displayed in the panel. - Der in dem Bereich angezeigte Text. - - - - The panel's ToolTip text. - Der QuickInfo-Text für den Bereich. - - - - The width of the panel. - Die Bereichsbreite. - - - - The panels in the status bar. - Die Bereiche in der Statusleiste. - - - - Determines if a status bar displays panels, or if it displays a single line of text. - Bestimmt, ob eine Statusleiste Bereiche oder eine einzelne Textzeile anzeigt. - - - - Determines whether a status bar has a sizing grip. - Bestimmt, ob eine Statusleiste einen Größenziehpunkt hat. - - Specifies the sides of the panel that should display borders. Gibt die Seiten des Bereichs an, die Rahmen anzeigen sollen. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.es.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.es.xlf index a81c6fe8be2..e8497a9e6f0 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.es.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.es.xlf @@ -8841,91 +8841,6 @@ El seguimiento de la pila donde tuvo lugar la operación no válida fue: No se pudo obtener el cálculo de referencias para IID {0}. - - Adding the panel to the native status bar control has not succeeded. - No se pudo agregar el panel al control nativo de barra de estado. - - - - Parameter must be of type StatusBarPanel. - El parámetro debe ser de tipo StatusBarPanel. - - - - Occurs whenever a panel in the StatusBar needs to be painted. - Tiene lugar siempre que se debe pintar un panel en StatusBar. - - - - Occurs when a panel within the status bar is clicked. - Tiene lugar cuando se hace clic en un panel dentro de la barra de estado. - - - - The alignment of the panel's text. - Alineación del texto del panel. - - - - Determines how a panel will resize when the parent changes size. - Determina cómo cambiará el tamaño del panel cuando cambie el tamaño del primario. - - - - Determines what type of border a panel has. - Determina qué tipo de borde tiene el panel. - - - - Determines what icon is displayed in the panel. - Determina qué icono se muestra en el panel. - - - - The minimum width of the panel. - Ancho mínimo del panel. - - - - The name of the panel. - El nombre del panel. - - - - The style of the panel. - Estilo del panel. - - - - The text displayed in the panel. - Texto mostrado en el panel. - - - - The panel's ToolTip text. - Texto de información sobre herramientas del panel. - - - - The width of the panel. - Ancho del panel. - - - - The panels in the status bar. - Paneles en la barra de estado. - - - - Determines if a status bar displays panels, or if it displays a single line of text. - Determina si la barra de estado muestra varios paneles o si muestra una sola línea de texto. - - - - Determines whether a status bar has a sizing grip. - Determina si la barra de estado tiene un control de tamaño. - - Specifies the sides of the panel that should display borders. Especifica los lados del panel que deberían mostrar bordes. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.fr.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.fr.xlf index 025ba01e1e2..d83922d86a0 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.fr.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.fr.xlf @@ -8841,91 +8841,6 @@ Cette opération non conforme s'est produite sur la trace de la pile : Impossible d'obtenir le marshaleur pour IID {0}. - - Adding the panel to the native status bar control has not succeeded. - Échec de l'ajout du panneau au contrôle de barre d'état natif. - - - - Parameter must be of type StatusBarPanel. - Le paramètre doit être de type StatusBarPanel. - - - - Occurs whenever a panel in the StatusBar needs to be painted. - Se produit lorsqu'un panneau dans le StatusBar doit être peint. - - - - Occurs when a panel within the status bar is clicked. - Se produit lors d'un clic sur un panneau de la barre d'état. - - - - The alignment of the panel's text. - L'alignement du texte du panneau. - - - - Determines how a panel will resize when the parent changes size. - Détermine la façon dont un panneau est redimensionné lorsque la taille du parent change. - - - - Determines what type of border a panel has. - Détermine le type de bordure d'un panneau. - - - - Determines what icon is displayed in the panel. - Détermine l'icône affichée dans le panneau. - - - - The minimum width of the panel. - La largeur minimale du panneau. - - - - The name of the panel. - Le nom du panneau. - - - - The style of the panel. - Le style du panneau. - - - - The text displayed in the panel. - Le texte affiché dans le panneau. - - - - The panel's ToolTip text. - Le texte info-bulle du panneau. - - - - The width of the panel. - La largeur du panneau. - - - - The panels in the status bar. - Les panneaux dans la barre d'état. - - - - Determines if a status bar displays panels, or if it displays a single line of text. - Détermine si une barre d'état affiche des panneaux ou si elle affiche une seule ligne de texte. - - - - Determines whether a status bar has a sizing grip. - Détermine si une barre d'état a une poignée de dimensionnement. - - Specifies the sides of the panel that should display borders. Spécifie les côtés du panneau qui doivent afficher des bordures. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.it.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.it.xlf index f3f267ad1bd..03256d1a2a7 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.it.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.it.xlf @@ -8841,91 +8841,6 @@ Traccia dello stack da cui si è verificata l'operazione non valida: Impossibile ottenere il gestore di marshalling per IID {0}. - - Adding the panel to the native status bar control has not succeeded. - Aggiunta del riquadro al controllo barra di stato originale non riuscita. - - - - Parameter must be of type StatusBarPanel. - Il parametro deve essere di tipo StatusBarPanel. - - - - Occurs whenever a panel in the StatusBar needs to be painted. - Generato ogni volta che è necessario tracciare un pannello nel controllo StatusBar. - - - - Occurs when a panel within the status bar is clicked. - Generato quando si fa clic su un pannello all'interno della barra di stato. - - - - The alignment of the panel's text. - L'allineamento del testo del pannello. - - - - Determines how a panel will resize when the parent changes size. - Determina in che modo un pannello verrà ridimensionato quando la dimensione dell'elemento padre cambia. - - - - Determines what type of border a panel has. - Determina il tipo di bordo di un pannello. - - - - Determines what icon is displayed in the panel. - Determina l'icona visualizzata nel pannello. - - - - The minimum width of the panel. - La larghezza minima del pannello. - - - - The name of the panel. - Il nome del pannello. - - - - The style of the panel. - Lo stile del pannello. - - - - The text displayed in the panel. - Il testo visualizzato nel pannello. - - - - The panel's ToolTip text. - Il testo di ToolTip per il pannello. - - - - The width of the panel. - La larghezza del pannello. - - - - The panels in the status bar. - I pannelli sulla barra di stato. - - - - Determines if a status bar displays panels, or if it displays a single line of text. - Determina se la barra di stato visualizza pannelli o una sola riga di testo. - - - - Determines whether a status bar has a sizing grip. - Determina se una barra di stato dispone di un riquadro di ridimensionamento. - - Specifies the sides of the panel that should display borders. Specifica i lati del riquadro per i quali devono essere visualizzati i bordi. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.ja.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.ja.xlf index 232b62af849..533e7722851 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.ja.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.ja.xlf @@ -8841,91 +8841,6 @@ Stack trace where the illegal operation occurred was: IID {0} のマーシャラーを取得できませんでした。 - - Adding the panel to the native status bar control has not succeeded. - ネイティブ ステータス バー コントロールにパネルを追加できませんでした。 - - - - Parameter must be of type StatusBarPanel. - パラメーターは型 StatusBarPanel でなければなりません。 - - - - Occurs whenever a panel in the StatusBar needs to be painted. - ステータス バー内のパネルを描画する必要があるときに発生します。 - - - - Occurs when a panel within the status bar is clicked. - ステータス バー内のパネルがクリックされたときに発生します。 - - - - The alignment of the panel's text. - パネルのテキストの配置です。 - - - - Determines how a panel will resize when the parent changes size. - 親がサイズを変更したときに、パネルがどのようにサイズを変更するかを決定します。 - - - - Determines what type of border a panel has. - パネルの境界線の種類を決定します。 - - - - Determines what icon is displayed in the panel. - どのアイコンをパネルに表示するかを決定します。 - - - - The minimum width of the panel. - パネル幅の最小値です。 - - - - The name of the panel. - パネルの名前です。 - - - - The style of the panel. - パネルのスタイルです。 - - - - The text displayed in the panel. - パネルに表示されるテキストです。 - - - - The panel's ToolTip text. - パネルのツールヒント文字列です。 - - - - The width of the panel. - パネルの幅です。 - - - - The panels in the status bar. - ステータス バーのパネルです。 - - - - Determines if a status bar displays panels, or if it displays a single line of text. - ステータス バーがパネルを表示するか、または単一行のテキストを表示するかを決定します。 - - - - Determines whether a status bar has a sizing grip. - ステータスバーにサイズ変更ハンドルを付けるかどうかを決定します。 - - Specifies the sides of the panel that should display borders. 境界線を表示するパネルの側面を指定します。 diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.ko.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.ko.xlf index 26f3714bad7..02c818df2d4 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.ko.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.ko.xlf @@ -8841,91 +8841,6 @@ Stack trace where the illegal operation occurred was: IID {0}의 마샬러를 가져오지 못했습니다. - - Adding the panel to the native status bar control has not succeeded. - 기본 상태 표시줄 컨트롤에 패널을 추가하지 못했습니다. - - - - Parameter must be of type StatusBarPanel. - 매개 변수는 StatusBarPanel 형식이어야 합니다. - - - - Occurs whenever a panel in the StatusBar needs to be painted. - StatusBar의 패널을 그려야 할 때마다 발생합니다. - - - - Occurs when a panel within the status bar is clicked. - 상태 표시줄의 패널을 클릭할 때 발생합니다. - - - - The alignment of the panel's text. - 패널 텍스트를 맞춥니다. - - - - Determines how a panel will resize when the parent changes size. - 부모의 크기가 변경될 때 패널의 크기를 조정하는 방법을 결정합니다. - - - - Determines what type of border a panel has. - 패널의 테두리 형식을 결정합니다. - - - - Determines what icon is displayed in the panel. - 패널에 표시되는 아이콘 종류를 결정합니다. - - - - The minimum width of the panel. - 패널의 최소 너비입니다. - - - - The name of the panel. - 패널의 이름입니다. - - - - The style of the panel. - 패널의 스타일입니다. - - - - The text displayed in the panel. - 패널에 표시되는 텍스트입니다. - - - - The panel's ToolTip text. - 패널의 도구 설명 텍스트입니다. - - - - The width of the panel. - 패널의 너비입니다. - - - - The panels in the status bar. - 상태 표시줄의 패널입니다. - - - - Determines if a status bar displays panels, or if it displays a single line of text. - 상태 표시줄에서 패널을 표시할지 아니면 한 줄 텍스트를 표시할지 결정합니다. - - - - Determines whether a status bar has a sizing grip. - 상태 표시줄에 크기 조정 그립을 포함할지 여부를 결정합니다. - - Specifies the sides of the panel that should display borders. 테두리를 표시할 패널 면을 지정합니다. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.pl.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.pl.xlf index 864b2c4ace3..4ede0ba52ae 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.pl.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.pl.xlf @@ -8841,91 +8841,6 @@ Stos śledzenia, w którym wystąpiła zabroniona operacja: Nie można uzyskać modułu serializacji dla identyfikatora IID {0}. - - Adding the panel to the native status bar control has not succeeded. - Nie można dodać panelu do formantu paska stanu macierzystego. - - - - Parameter must be of type StatusBarPanel. - Parametr musi być typu StatusBarPanel. - - - - Occurs whenever a panel in the StatusBar needs to be painted. - Występuje za każdym razem, gdy w elemencie StatusBar musi zostać narysowany panel. - - - - Occurs when a panel within the status bar is clicked. - Występuje, gdy zostanie kliknięty panel na pasku stanu. - - - - The alignment of the panel's text. - Wyrównanie tekstu panelu. - - - - Determines how a panel will resize when the parent changes size. - Określa, w jaki sposób zmieni się rozmiar panelu, gdy zmienia się rozmiar elementu nadrzędnego. - - - - Determines what type of border a panel has. - Określa typ obramowania panelu. - - - - Determines what icon is displayed in the panel. - Określa, jaka ikona jest wyświetlana na panelu. - - - - The minimum width of the panel. - Minimalna szerokość panelu. - - - - The name of the panel. - Nazwa panelu. - - - - The style of the panel. - Styl panelu. - - - - The text displayed in the panel. - Tekst wyświetlany w panelu. - - - - The panel's ToolTip text. - Tekst elementu ToolTip panelu. - - - - The width of the panel. - Szerokość panelu. - - - - The panels in the status bar. - Panele na pasku stanu. - - - - Determines if a status bar displays panels, or if it displays a single line of text. - Określa, czy pasek stanu wyświetla panele, czy pojedynczy wiersz tekstu. - - - - Determines whether a status bar has a sizing grip. - Określa, czy pasek stanu ma uchwyt zmiany rozmiaru. - - Specifies the sides of the panel that should display borders. Określa strony panelu, które mają wyświetlać obramowanie. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.pt-BR.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.pt-BR.xlf index 496669cfa2d..96813878712 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.pt-BR.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.pt-BR.xlf @@ -8841,91 +8841,6 @@ Rastreamento de pilha em que a operação ilegal ocorreu: Falha ao obter marshaler para IID {0}. - - Adding the panel to the native status bar control has not succeeded. - A adição do painel ao controle nativo da barra de status não teve êxito. - - - - Parameter must be of type StatusBarPanel. - O parâmetro deve ser do tipo StatusBarPanel. - - - - Occurs whenever a panel in the StatusBar needs to be painted. - Ocorre sempre que um painel em StatusBar precisar ser pintado. - - - - Occurs when a panel within the status bar is clicked. - Ocorre quando um painel dentro da barra de status é clicado. - - - - The alignment of the panel's text. - O alinhamento do texto do painel. - - - - Determines how a panel will resize when the parent changes size. - Determina como um painel será redimensionado quando o tamanho do pai for alterado. - - - - Determines what type of border a panel has. - Determina o tipo de borda que um painel tem. - - - - Determines what icon is displayed in the panel. - Determina o ícone a ser exibido no painel. - - - - The minimum width of the panel. - A largura mínima do painel. - - - - The name of the panel. - O nome do painel. - - - - The style of the panel. - O estilo do painel. - - - - The text displayed in the panel. - O texto exibido no painel. - - - - The panel's ToolTip text. - O texto de dica de ferramenta do painel. - - - - The width of the panel. - A largura do painel. - - - - The panels in the status bar. - Os painéis na barra de status. - - - - Determines if a status bar displays panels, or if it displays a single line of text. - Determina se uma barra de status exibe painéis ou se exibe uma linha única de texto. - - - - Determines whether a status bar has a sizing grip. - Determina se uma barra de status tem uma alça de dimensionamento. - - Specifies the sides of the panel that should display borders. Especifica os lados do painel que deverão exibir bordas. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.ru.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.ru.xlf index 9857422fbfb..822044780dc 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.ru.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.ru.xlf @@ -8842,91 +8842,6 @@ Stack trace where the illegal operation occurred was: Не удалось получить упаковщик ("маршалер") для IID {0}. - - Adding the panel to the native status bar control has not succeeded. - Добавление панели к исходной строке состояния не удалось. - - - - Parameter must be of type StatusBarPanel. - Параметр должен быть типа StatusBarPanel. - - - - Occurs whenever a panel in the StatusBar needs to be painted. - Происходит при необходимости прорисовать панель в StatusBar. - - - - Occurs when a panel within the status bar is clicked. - Возникает при щелчке панели в строке состояния. - - - - The alignment of the panel's text. - Выравнивание текста панели. - - - - Determines how a panel will resize when the parent changes size. - Определяет принцип изменения размера панели при изменении размера родительского окна. - - - - Determines what type of border a panel has. - Задает тип границы панели. - - - - Determines what icon is displayed in the panel. - Задает значок, отображаемый на данной панели. - - - - The minimum width of the panel. - Минимальная ширина данной панели. - - - - The name of the panel. - Имя этой панели. - - - - The style of the panel. - Стиль данной панели. - - - - The text displayed in the panel. - Заголовок на панели. - - - - The panel's ToolTip text. - Текст подсказки для данной панели. - - - - The width of the panel. - Ширина данной панели. - - - - The panels in the status bar. - Панели в строке состояния. - - - - Determines if a status bar displays panels, or if it displays a single line of text. - Указывает, отображать в строке состояния панели или только одну строку текста. - - - - Determines whether a status bar has a sizing grip. - Определяет, содержит ли строка состояния захват для изменения размера окна. - - Specifies the sides of the panel that should display borders. Задает стороны панели, на которых должны отображаться границы. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.tr.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.tr.xlf index 13936ab85a5..2623e1181c4 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.tr.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.tr.xlf @@ -8841,91 +8841,6 @@ Geçersiz işlemin gerçekleştiği yığın izi: {0} IID için sıralayıcı alınamadı. - - Adding the panel to the native status bar control has not succeeded. - Yerel durum çubuğu denetimine bölme eklenemedi. - - - - Parameter must be of type StatusBarPanel. - Parametrenin StatusBarPanel türünde olması gerekir. - - - - Occurs whenever a panel in the StatusBar needs to be painted. - Durum Çubuğu'ndaki bir bölmenin her boyanması gerektiğinde gerçekleşir. - - - - Occurs when a panel within the status bar is clicked. - Durum çubuğundaki bir bölme tıklatıldığında gerçekleşir. - - - - The alignment of the panel's text. - Bölme metninin hizalaması. - - - - Determines how a panel will resize when the parent changes size. - Üstünün boyutu değiştiğinde bölmenin nasıl yeniden boyutlandırılacağını belirler. - - - - Determines what type of border a panel has. - Bölmenin ne tür kenarlığı olduğunu belirler. - - - - Determines what icon is displayed in the panel. - Bölmede hangi simgenin görüntüleneceğini belirler. - - - - The minimum width of the panel. - Bölmenin en küçük genişliği. - - - - The name of the panel. - Bölmenin adı. - - - - The style of the panel. - Bölmenin stili. - - - - The text displayed in the panel. - Bölmede görüntülenen metin. - - - - The panel's ToolTip text. - Bölmenin ToolTip metni. - - - - The width of the panel. - Bölmenin genişliği. - - - - The panels in the status bar. - Durum çubuğundaki bölmeler. - - - - Determines if a status bar displays panels, or if it displays a single line of text. - Durum Çubuğu'nun bölmeleri mi yoksa tek satırlık bir metin mi görüntüleyeceğini belirler. - - - - Determines whether a status bar has a sizing grip. - Durum çubuğunun boyutlandırma tutamacı olup olmadığını belirler. - - Specifies the sides of the panel that should display borders. Bölmenin kenarlıkları görüntüleyecek taraflarını belirtir. diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hans.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hans.xlf index 2c7350ba7a8..5d4ad77bdf3 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hans.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hans.xlf @@ -8841,91 +8841,6 @@ Stack trace where the illegal operation occurred was: 未能获取 IID {0} 的封送处理程序。 - - Adding the panel to the native status bar control has not succeeded. - 将面板添加到本机状态栏控件失败。 - - - - Parameter must be of type StatusBarPanel. - 参数必须是 StatusBarPanel 类型。 - - - - Occurs whenever a panel in the StatusBar needs to be painted. - 每当 StatusBar 中的面板需要绘制时发生。 - - - - Occurs when a panel within the status bar is clicked. - 在单击状态栏中的面板时发生。 - - - - The alignment of the panel's text. - 面板文本的对齐方式。 - - - - Determines how a panel will resize when the parent changes size. - 确定当父级更改大小时,面板将如何调整大小。 - - - - Determines what type of border a panel has. - 确定面板具有的边框类型。 - - - - Determines what icon is displayed in the panel. - 确定在面板中显示的图标。 - - - - The minimum width of the panel. - 面板的最小宽度。 - - - - The name of the panel. - 面板的名称。 - - - - The style of the panel. - 面板的样式。 - - - - The text displayed in the panel. - 面板中显示的文本。 - - - - The panel's ToolTip text. - 面板的工具提示文本。 - - - - The width of the panel. - 面板的宽度。 - - - - The panels in the status bar. - 状态栏中的面板。 - - - - Determines if a status bar displays panels, or if it displays a single line of text. - 确定状态栏是否显示面板,或者是否显示单行文本。 - - - - Determines whether a status bar has a sizing grip. - 确定状态栏是否具有大小调整手柄。 - - Specifies the sides of the panel that should display borders. 指定应显示边框的面板的边。 diff --git a/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hant.xlf b/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hant.xlf index 88a541fd145..0c98f4577bb 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hant.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.zh-Hant.xlf @@ -8841,91 +8841,6 @@ Stack trace where the illegal operation occurred was: 無法取得 IID {0} 的封送處理器。 - - Adding the panel to the native status bar control has not succeeded. - 在原生狀態列控制項中加入面板失敗。 - - - - Parameter must be of type StatusBarPanel. - 參數必須屬於 StatusBarPanel 類型。 - - - - Occurs whenever a panel in the StatusBar needs to be painted. - 當需要繪製 StatusBar 中的面板時發生。 - - - - Occurs when a panel within the status bar is clicked. - 當按一下狀態列內的面板時發生。 - - - - The alignment of the panel's text. - 面板文字的對齊方式。 - - - - Determines how a panel will resize when the parent changes size. - 決定當父系變更大小時,面板將如何調整大小。 - - - - Determines what type of border a panel has. - 決定面板的框線類型。 - - - - Determines what icon is displayed in the panel. - 決定在面板中顯示何種圖示。 - - - - The minimum width of the panel. - 面板的最小寬度。 - - - - The name of the panel. - 面板的名稱。 - - - - The style of the panel. - 面板的樣式。 - - - - The text displayed in the panel. - 面板中顯示的文字。 - - - - The panel's ToolTip text. - 面板的工具提示文字。 - - - - The width of the panel. - 面板的寬度。 - - - - The panels in the status bar. - 狀態列中的面板。 - - - - Determines if a status bar displays panels, or if it displays a single line of text. - 決定狀態列是否顯示面板,或是否顯示單行文字。 - - - - Determines whether a status bar has a sizing grip. - 決定狀態列是否有可調整大小的底框。 - - Specifies the sides of the panel that should display borders. 指定面板中應該顯示框線的邊。 diff --git a/src/System.Windows.Forms/src/System.Windows.Forms.csproj b/src/System.Windows.Forms/src/System.Windows.Forms.csproj index 1eebad00e7a..e32181f12f4 100644 --- a/src/System.Windows.Forms/src/System.Windows.Forms.csproj +++ b/src/System.Windows.Forms/src/System.Windows.Forms.csproj @@ -344,9 +344,6 @@ System.Windows.Forms.ErrorControl - - System.Windows.Forms.StatusBar - System.Windows.Forms.TabControl diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBar.cs b/src/System.Windows.Forms/src/System/Windows/Forms/StatusBar.cs deleted file mode 100644 index 99cb404036c..00000000000 --- a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBar.cs +++ /dev/null @@ -1,1911 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#nullable disable - -using System.Collections; -using System.ComponentModel; -using System.Diagnostics; -using System.Drawing; -using System.Globalization; -using System.Runtime.InteropServices; -using System.Windows.Forms.VisualStyles; -using static Interop; -using static Interop.ComCtl32; - -namespace System.Windows.Forms -{ - /// - /// Represents a Windows status bar control. - /// - [ - ComVisible(true), - ClassInterface(ClassInterfaceType.AutoDispatch), - DefaultEvent(nameof(PanelClick)), - DefaultProperty(nameof(Text)), - Designer("System.Windows.Forms.Design.StatusBarDesigner, " + AssemblyRef.SystemDesign), - ] - public class StatusBar : Control - { - private int sizeGripWidth = 0; - private const int SIMPLE_INDEX = 0xFF; - - private static readonly object EVENT_PANELCLICK = new object(); - private static readonly object EVENT_SBDRAWITEM = new object(); - - private bool showPanels; - private bool layoutDirty; - private int panelsRealized; - private bool sizeGrip = true; - private string simpleText; - private Point lastClick = new Point(0, 0); - private readonly IList panels = new ArrayList(); - private StatusBarPanelCollection panelsCollection; - private ControlToolTip tooltips; - - private ToolTip mainToolTip = null; - private bool toolTipSet = false; - - /// - /// Initializes a new default instance of the class. - /// - public StatusBar() - : base() - { - base.SetStyle(ControlStyles.UserPaint | ControlStyles.Selectable, false); - - Dock = DockStyle.Bottom; - TabStop = false; - } - - private static VisualStyleRenderer renderer = null; - - /// - /// A VisualStyleRenderer we can use to get information about the current UI theme - /// - private static VisualStyleRenderer VisualStyleRenderer - { - get - { - if (VisualStyleRenderer.IsSupported) - { - if (renderer == null) - { - renderer = new VisualStyleRenderer(VisualStyleElement.ToolBar.Button.Normal); - } - } - else - { - renderer = null; - } - return renderer; - } - } - - private int SizeGripWidth - { - get - { - if (sizeGripWidth == 0) - { - if (Application.RenderWithVisualStyles && VisualStyleRenderer != null) - { - // Need to build up accurate gripper width to avoid cutting off other panes. - VisualStyleRenderer vsRenderer = VisualStyleRenderer; - VisualStyleElement thisElement; - Size elementSize; - - // gripper pane width... - thisElement = VisualStyleElement.Status.GripperPane.Normal; - vsRenderer.SetParameters(thisElement); - elementSize = vsRenderer.GetPartSize(Graphics.FromHwndInternal(Handle), ThemeSizeType.True); - sizeGripWidth = elementSize.Width; - - // ...plus gripper width - thisElement = VisualStyleElement.Status.Gripper.Normal; - vsRenderer.SetParameters(thisElement); - elementSize = vsRenderer.GetPartSize(Graphics.FromHwndInternal(Handle), ThemeSizeType.True); - sizeGripWidth += elementSize.Width; - - // Either GetPartSize could have returned a width of zero, so make sure we have a reasonable number: - sizeGripWidth = Math.Max(sizeGripWidth, 16); - } - else - { - sizeGripWidth = 16; - } - } - return sizeGripWidth; - } - } - - /// - /// The background color of this control. This is an ambient property and will - /// always return a non-null value. - /// - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public override Color BackColor - { - get - { - // not supported, always return CONTROL - return SystemColors.Control; - } - set - { - // no op, not supported. - } - } - - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - new public event EventHandler BackColorChanged - { - add => base.BackColorChanged += value; - remove => base.BackColorChanged -= value; - } - - /// - /// Gets or sets the image rendered on the background of the - /// - /// control. - /// - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public override Image BackgroundImage - { - get - { - return base.BackgroundImage; - } - set - { - base.BackgroundImage = value; - } - } - - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - new public event EventHandler BackgroundImageChanged - { - add => base.BackgroundImageChanged += value; - remove => base.BackgroundImageChanged -= value; - } - - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public override ImageLayout BackgroundImageLayout - { - get - { - return base.BackgroundImageLayout; - } - set - { - base.BackgroundImageLayout = value; - } - } - - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - new public event EventHandler BackgroundImageLayoutChanged - { - add => base.BackgroundImageLayoutChanged += value; - remove => base.BackgroundImageLayoutChanged -= value; - } - - /// - /// Returns the CreateParams used to create the handle for this control. - /// Inheriting classes should call base.getCreateParams in the manor below: - /// - protected override CreateParams CreateParams - { - get - { - CreateParams cp = base.CreateParams; - cp.ClassName = WindowClasses.WC_STATUSBAR; - - if (sizeGrip) - { - cp.Style |= (int)SBARS.SIZEGRIP; - } - else - { - cp.Style &= ~(int)SBARS.SIZEGRIP; - } - cp.Style |= (int)(CCS.NOPARENTALIGN | CCS.NORESIZE); - - return cp; - } - } - - protected override ImeMode DefaultImeMode - { - get - { - return ImeMode.Disable; - } - } - - /// - /// Deriving classes can override this to configure a default size for their control. - /// This is more efficient than setting the size in the control's constructor. - /// - protected override Size DefaultSize - { - get - { - return new Size(100, 22); - } - } - - /// - /// This property is overridden and hidden from statement completion - /// on controls that are based on Win32 Native Controls. - /// - [EditorBrowsable(EditorBrowsableState.Never)] - protected override bool DoubleBuffered - { - get - { - return base.DoubleBuffered; - } - set - { - base.DoubleBuffered = value; - } - } - - /// - /// Gets or sets the docking behavior of the control. - /// - [ - Localizable(true), - DefaultValue(DockStyle.Bottom) - ] - public override DockStyle Dock - { - get - { - return base.Dock; - } - set - { - base.Dock = value; - } - } - - /// - /// Gets or sets the font the - /// control will use to display - /// information. - /// - [ - Localizable(true) - ] - public override Font Font - { - get { return base.Font; } - set - { - base.Font = value; - SetPanelContentsWidths(false); - } - } - - /// - /// Gets or sets - /// the forecolor for the control. - /// - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public override Color ForeColor - { - get - { - return base.ForeColor; - } - set - { - base.ForeColor = value; - } - } - - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - new public event EventHandler ForeColorChanged - { - add => base.ForeColorChanged += value; - remove => base.ForeColorChanged -= value; - } - - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - new public ImeMode ImeMode - { - get - { - return base.ImeMode; - } - set - { - base.ImeMode = value; - } - } - - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public new event EventHandler ImeModeChanged - { - add => base.ImeModeChanged += value; - remove => base.ImeModeChanged -= value; - } - - /// - /// Gets the collection of - /// panels contained within the - /// control. - /// - [ - DesignerSerializationVisibility(DesignerSerializationVisibility.Content), - SRDescription(nameof(SR.StatusBarPanelsDescr)), - Localizable(true), - SRCategory(nameof(SR.CatAppearance)), - MergableProperty(false) - ] - public StatusBarPanelCollection Panels - { - get - { - if (panelsCollection == null) - { - panelsCollection = new StatusBarPanelCollection(this); - } - - return panelsCollection; - } - } - - /// - /// The status bar text. - /// - [ - Localizable(true) - ] - public override string Text - { - get - { - if (simpleText == null) - { - return ""; - } - else - { - return simpleText; - } - } - set - { - SetSimpleText(value); - if (simpleText != value) - { - simpleText = value; - OnTextChanged(EventArgs.Empty); - } - } - } - - /// - /// Gets or sets a value indicating whether panels should be shown. - /// - [ - SRCategory(nameof(SR.CatBehavior)), - DefaultValue(false), - SRDescription(nameof(SR.StatusBarShowPanelsDescr)) - ] - public bool ShowPanels - { - get - { - return showPanels; - } - set - { - if (showPanels != value) - { - showPanels = value; - - layoutDirty = true; - if (IsHandleCreated) - { - User32.SendMessageW(this, (User32.WM)SB.SIMPLE, PARAM.FromBool(!showPanels), IntPtr.Zero); - - if (showPanels) - { - PerformLayout(); - RealizePanels(); - } - else if (tooltips != null) - { - for (int i = 0; i < panels.Count; i++) - { - tooltips.SetTool(panels[i], null); - } - } - - SetSimpleText(simpleText); - } - } - } - } - - /// - /// Gets or sets a value indicating whether a sizing grip - /// will be rendered on the corner of the - /// control. - /// - [ - SRCategory(nameof(SR.CatAppearance)), - DefaultValue(true), - SRDescription(nameof(SR.StatusBarSizingGripDescr)) - ] - public bool SizingGrip - { - get - { - return sizeGrip; - } - set - { - if (value != sizeGrip) - { - sizeGrip = value; - RecreateHandle(); - } - } - } - - /// - /// Gets or sets a value indicating whether the user will be able to tab to the - /// . - /// - [DefaultValue(false)] - new public bool TabStop - { - get - { - return base.TabStop; - } - set - { - base.TabStop = value; - } - } - - internal bool ToolTipSet - { - get - { - return toolTipSet; - } - } - - internal ToolTip MainToolTip - { - get - { - return mainToolTip; - } - } - - /// - /// Occurs when a visual aspect of an owner-drawn status bar changes. - /// - [SRCategory(nameof(SR.CatBehavior)), SRDescription(nameof(SR.StatusBarDrawItem))] - public event StatusBarDrawItemEventHandler DrawItem - { - add => Events.AddHandler(EVENT_SBDRAWITEM, value); - remove => Events.RemoveHandler(EVENT_SBDRAWITEM, value); - } - - /// - /// Occurs when a panel on the status bar is clicked. - /// - [SRCategory(nameof(SR.CatMouse)), SRDescription(nameof(SR.StatusBarOnPanelClickDescr))] - public event StatusBarPanelClickEventHandler PanelClick - { - add => Events.AddHandler(EVENT_PANELCLICK, value); - remove => Events.RemoveHandler(EVENT_PANELCLICK, value); - } - - /// - /// StatusBar Onpaint. - /// - /// - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public new event PaintEventHandler Paint - { - add => base.Paint += value; - remove => base.Paint -= value; - } - - /// - /// Tells whether the panels have been realized. - /// - internal bool ArePanelsRealized() - { - return showPanels && IsHandleCreated; - } - - internal void DirtyLayout() - { - layoutDirty = true; - } - - /// - /// Makes the panel according to the sizes in the panel list. - /// - private unsafe void ApplyPanelWidths() - { - // This forces handle creation every time any time the StatusBar - // has to be re-laidout. - if (!IsHandleCreated) - { - return; - } - - StatusBarPanel panel = null; - int length = panels.Count; - - if (length == 0) - { - Size sz = Size; - Span offsets = stackalloc int[1]; - offsets[0] = sz.Width; - if (sizeGrip) - { - offsets[0] -= SizeGripWidth; - } - User32.SendMessageW(this, (User32.WM)SB.SETPARTS, (IntPtr)1, ref offsets[0]); - User32.SendMessageW(this, (User32.WM)SB.SETICON, IntPtr.Zero, IntPtr.Zero); - - return; - } - - int[] offsets2 = new int[length]; - int currentOffset = 0; - for (int i = 0; i < length; i++) - { - panel = (StatusBarPanel)panels[i]; - currentOffset += panel.Width; - offsets2[i] = currentOffset; - panel.Right = offsets2[i]; - } - - fixed (int* pOffsets = offsets2) - { - User32.SendMessageW(this, (User32.WM)SB.SETPARTS, (IntPtr)length, (IntPtr)pOffsets); - } - - // Tooltip setup... - for (int i = 0; i < length; i++) - { - panel = (StatusBarPanel)panels[i]; - UpdateTooltip(panel); - } - - layoutDirty = false; - } - - protected override void CreateHandle() - { - if (!RecreatingHandle) - { - IntPtr userCookie = ThemingScope.Activate(Application.UseVisualStyles); - - try - { - var icc = new INITCOMMONCONTROLSEX - { - dwICC = ICC.BAR_CLASSES - }; - InitCommonControlsEx(ref icc); - } - finally - { - ThemingScope.Deactivate(userCookie); - } - } - - base.CreateHandle(); - } - - /// - /// Disposes this control - /// - protected override void Dispose(bool disposing) - { - if (disposing) - { - if (panelsCollection != null) - { - StatusBarPanel[] panelCopy = new StatusBarPanel[panelsCollection.Count]; - ((ICollection)panelsCollection).CopyTo(panelCopy, 0); - panelsCollection.Clear(); - - foreach (StatusBarPanel p in panelCopy) - { - p.Dispose(); - } - } - } - base.Dispose(disposing); - } - - /// - /// Forces the panels to be updated, location, repainting, etc. - /// - private void ForcePanelUpdate() - { - if (ArePanelsRealized()) - { - layoutDirty = true; - SetPanelContentsWidths(true); - PerformLayout(); - RealizePanels(); - } - } - - /// - /// Raises the - /// event. - /// - protected override void OnHandleCreated(EventArgs e) - { - base.OnHandleCreated(e); - if (!DesignMode) - { - tooltips = new ControlToolTip(this); - } - - if (!showPanels) - { - User32.SendMessageW(this, (User32.WM)SB.SIMPLE, (IntPtr)1, IntPtr.Zero); - SetSimpleText(simpleText); - } - else - { - ForcePanelUpdate(); - } - } - - /// - /// Raises the event. - /// - protected override void OnHandleDestroyed(EventArgs e) - { - base.OnHandleDestroyed(e); - if (tooltips != null) - { - tooltips.Dispose(); - tooltips = null; - } - } - - /// - /// Raises the event. - /// - protected override void OnMouseDown(MouseEventArgs e) - { - lastClick.X = e.X; - lastClick.Y = e.Y; - base.OnMouseDown(e); - } - - /// - /// Raises the event. - /// - protected virtual void OnPanelClick(StatusBarPanelClickEventArgs e) - { - ((StatusBarPanelClickEventHandler)Events[EVENT_PANELCLICK])?.Invoke(this, e); - } - - protected override void OnLayout(LayoutEventArgs levent) - { - if (showPanels) - { - LayoutPanels(); - if (IsHandleCreated && panelsRealized != panels.Count) - { - RealizePanels(); - } - } - base.OnLayout(levent); - } - - /// - /// This function sets up all the panel on the status bar according to - /// the internal this.panels List. - /// - internal void RealizePanels() - { - StatusBarPanel panel = null; - int length = panels.Count; - int old = panelsRealized; - - panelsRealized = 0; - - if (length == 0) - { - User32.SendMessageW(this, (User32.WM)SB.SETTEXT, IntPtr.Zero, string.Empty); - } - - int i; - for (i = 0; i < length; i++) - { - panel = (StatusBarPanel)panels[i]; - try - { - panel.Realize(); - panelsRealized++; - } - catch - { - } - } - for (; i < old; i++) - { - User32.SendMessageW(this, (User32.WM)SB.SETTEXT, IntPtr.Zero, null); - } - } - - /// - /// Remove the internal list of panels without updating the control. - /// - internal void RemoveAllPanelsWithoutUpdate() - { - int size = panels.Count; - // remove the parent reference - for (int i = 0; i < size; i++) - { - StatusBarPanel sbp = (StatusBarPanel)panels[i]; - sbp.ParentInternal = null; - } - - panels.Clear(); - if (showPanels == true) - { - ApplyPanelWidths(); - ForcePanelUpdate(); - } - } - - /// - /// Sets the widths of any panels that have the - /// StatusBarPanelAutoSize.CONTENTS property set. - /// - internal void SetPanelContentsWidths(bool newPanels) - { - int size = panels.Count; - bool changed = false; - for (int i = 0; i < size; i++) - { - StatusBarPanel sbp = (StatusBarPanel)panels[i]; - if (sbp.AutoSize == StatusBarPanelAutoSize.Contents) - { - int newWidth = sbp.GetContentsWidth(newPanels); - if (sbp.Width != newWidth) - { - sbp.Width = newWidth; - changed = true; - } - } - } - if (changed) - { - DirtyLayout(); - PerformLayout(); - } - } - - private void SetSimpleText(string simpleText) - { - if (!showPanels && IsHandleCreated) - { - int wparam = SIMPLE_INDEX + (int)SBT.NOBORDERS; - if (RightToLeft == RightToLeft.Yes) - { - wparam |= (int)SBT.RTLREADING; - } - - User32.SendMessageW(this, (User32.WM)SB.SETTEXT, (IntPtr)wparam, simpleText); - } - } - - /// - /// Sizes the the panels appropriately. It looks at the SPRING AutoSize - /// property. - /// - private void LayoutPanels() - { - StatusBarPanel panel = null; - int barPanelWidth = 0; - int springNum = 0; - StatusBarPanel[] pArray = new StatusBarPanel[panels.Count]; - bool changed = false; - - for (int i = 0; i < pArray.Length; i++) - { - panel = (StatusBarPanel)panels[i]; - if (panel.AutoSize == StatusBarPanelAutoSize.Spring) - { - pArray[springNum] = panel; - springNum++; - } - else - { - barPanelWidth += panel.Width; - } - } - - if (springNum > 0) - { - Rectangle rect = Bounds; - int springPanelsLeft = springNum; - int leftoverWidth = rect.Width - barPanelWidth; - if (sizeGrip) - { - leftoverWidth -= SizeGripWidth; - } - int copyOfLeftoverWidth = unchecked((int)0x80000000); - while (springPanelsLeft > 0) - { - int widthOfSpringPanel = (leftoverWidth) / springPanelsLeft; - if (leftoverWidth == copyOfLeftoverWidth) - { - break; - } - - copyOfLeftoverWidth = leftoverWidth; - - for (int i = 0; i < springNum; i++) - { - panel = pArray[i]; - if (panel == null) - { - continue; - } - - if (widthOfSpringPanel < panel.MinWidth) - { - if (panel.Width != panel.MinWidth) - { - changed = true; - } - panel.Width = panel.MinWidth; - pArray[i] = null; - springPanelsLeft--; - leftoverWidth -= panel.MinWidth; - } - else - { - if (panel.Width != widthOfSpringPanel) - { - changed = true; - } - panel.Width = widthOfSpringPanel; - } - } - } - } - - if (changed || layoutDirty) - { - ApplyPanelWidths(); - } - } - - /// - /// Raises the - /// event. - /// - protected virtual void OnDrawItem(StatusBarDrawItemEventArgs sbdievent) - { - ((StatusBarDrawItemEventHandler)Events[EVENT_SBDRAWITEM])?.Invoke(this, sbdievent); - } - - /// - /// Raises the event. - /// - protected override void OnResize(EventArgs e) - { - Invalidate(); - base.OnResize(e); - } - - /// - /// Returns a string representation for this control. - /// - public override string ToString() - { - string s = base.ToString(); - if (Panels != null) - { - s += ", Panels.Count: " + Panels.Count.ToString(CultureInfo.CurrentCulture); - if (Panels.Count > 0) - { - s += ", Panels[0]: " + Panels[0].ToString(); - } - } - return s; - } - - // call this when System.Windows.forms.toolTip is Associated with Statusbar.... - internal void SetToolTip(ToolTip t) - { - mainToolTip = t; - toolTipSet = true; - } - - internal void UpdateTooltip(StatusBarPanel panel) - { - if (tooltips == null) - { - if (IsHandleCreated && !DesignMode) - { - //This shouldn't happen: tooltips should've already been set. The best we can - //do here is reset it. - tooltips = new ControlToolTip(this); - } - else - { - return; - } - } - - if (panel.Parent == this && panel.ToolTipText.Length > 0) - { - int border = SystemInformation.Border3DSize.Width; - ControlToolTip.Tool t = tooltips.GetTool(panel); - if (t == null) - { - t = new ControlToolTip.Tool(); - } - t.text = panel.ToolTipText; - t.rect = new Rectangle(panel.Right - panel.Width + border, 0, panel.Width - border, Height); - tooltips.SetTool(panel, t); - } - else - { - tooltips.SetTool(panel, null); - } - } - - private void UpdatePanelIndex() - { - int length = panels.Count; - for (int i = 0; i < length; i++) - { - ((StatusBarPanel)panels[i]).Index = i; - } - } - - /// - /// Processes messages for ownerdraw panels. - /// - private unsafe void WmDrawItem(ref Message m) - { - User32.DRAWITEMSTRUCT* dis = (User32.DRAWITEMSTRUCT*)m.LParam; - - int length = panels.Count; - if (dis->itemID < 0 || dis->itemID >= length) - { - Debug.Fail("OwnerDraw item out of range"); - } - - // The itemState is not defined for a statusbar control - StatusBarPanel panel = (StatusBarPanel)panels[(int)dis->itemID]; - Graphics g = Graphics.FromHdcInternal(dis->hDC); - OnDrawItem(new StatusBarDrawItemEventArgs(g, Font, dis->rcItem, (int)dis->itemID, DrawItemState.None, panel, ForeColor, BackColor)); - } - - private unsafe void WmNotifyNMClick(User32.NMHDR* note) - { - if (!showPanels) - { - return; - } - - int size = panels.Count; - int currentOffset = 0; - int index = -1; - for (int i = 0; i < size; i++) - { - StatusBarPanel panel = (StatusBarPanel)panels[i]; - currentOffset += panel.Width; - if (lastClick.X < currentOffset) - { - // this is where the mouse was clicked. - index = i; - break; - } - } - if (index != -1) - { - MouseButtons button = MouseButtons.Left; - int clicks = 0; - switch ((NM)note->code) - { - case NM.CLICK: - button = MouseButtons.Left; - clicks = 1; - break; - case NM.RCLICK: - button = MouseButtons.Right; - clicks = 1; - break; - case NM.DBLCLK: - button = MouseButtons.Left; - clicks = 2; - break; - case NM.RDBLCLK: - button = MouseButtons.Right; - clicks = 2; - break; - } - - Point pt = lastClick; - StatusBarPanel panel = (StatusBarPanel)panels[index]; - - StatusBarPanelClickEventArgs sbpce = new StatusBarPanelClickEventArgs(panel, - button, clicks, pt.X, pt.Y); - OnPanelClick(sbpce); - } - } - - private void WmNCHitTest(ref Message m) - { - int x = PARAM.SignedLOWORD(m.LParam); - Rectangle bounds = Bounds; - bool callSuper = true; - - // The default implementation of the statusbar - // will let you size the form when it is docked on the bottom, - // but when it is anywhere else, the statusbar will be resized. - // to prevent that we provide a little bit a sanity to only - // allow resizing, when it would resize the form. - if (x > bounds.X + bounds.Width - SizeGripWidth) - { - Control parent = ParentInternal; - if (parent != null && parent is Form) - { - FormBorderStyle bs = ((Form)parent).FormBorderStyle; - - if (bs != FormBorderStyle.Sizable - && bs != FormBorderStyle.SizableToolWindow) - { - callSuper = false; - } - - if (!((Form)parent).TopLevel - || Dock != DockStyle.Bottom) - { - callSuper = false; - } - - if (callSuper) - { - ControlCollection children = parent.Controls; - int c = children.Count; - for (int i = 0; i < c; i++) - { - Control ctl = children[i]; - if (ctl != this && ctl.Dock == DockStyle.Bottom) - { - if (ctl.Top > Top) - { - callSuper = false; - break; - } - } - } - } - } - else - { - callSuper = false; - } - } - - if (callSuper) - { - base.WndProc(ref m); - } - else - { - m.Result = (IntPtr)NativeMethods.HTCLIENT; - } - } - - /// - /// Base wndProc. All messages are sent to wndProc after getting filtered through - /// the preProcessMessage function. Inheriting controls should call base.wndProc - /// for any messages that they don't handle. - /// - protected unsafe override void WndProc(ref Message m) - { - switch ((User32.WM)m.Msg) - { - case User32.WM.NCHITTEST: - WmNCHitTest(ref m); - break; - case User32.WM.REFLECT| User32.WM.DRAWITEM: - WmDrawItem(ref m); - break; - case User32.WM.NOTIFY: - case User32.WM.NOTIFY | User32.WM.REFLECT: - User32.NMHDR* note = (User32.NMHDR*)m.LParam; - switch ((NM)note->code) - { - case NM.CLICK: - case NM.RCLICK: - case NM.DBLCLK: - case NM.RDBLCLK: - WmNotifyNMClick(note); - break; - default: - base.WndProc(ref m); - break; - } - break; - - default: - base.WndProc(ref m); - break; - } - } - - /// - /// The collection of StatusBarPanels that the StatusBar manages. - /// event. - /// - [ListBindable(false)] - public class StatusBarPanelCollection : IList - { - private readonly StatusBar owner; - - // A caching mechanism for key accessor - // We use an index here rather than control so that we don't have lifetime - // issues by holding on to extra references. - private int lastAccessedIndex = -1; - - /// - /// Constructor for the StatusBarPanelCollection class - /// - public StatusBarPanelCollection(StatusBar owner) - { - this.owner = owner; - } - - /// - /// This method will return an individual StatusBarPanel with the appropriate index. - /// - public virtual StatusBarPanel this[int index] - { - get - { - return (StatusBarPanel)owner.panels[index]; - } - set - { - if (value == null) - { - throw new ArgumentNullException(nameof(StatusBarPanel)); - } - - owner.layoutDirty = true; - - if (value.Parent != null) - { - throw new ArgumentException(SR.ObjectHasParent, "value"); - } - - int length = owner.panels.Count; - - if (index < 0 || index >= length) - { - throw new ArgumentOutOfRangeException(nameof(index), index, string.Format(SR.InvalidArgument, nameof(index), index)); - } - - StatusBarPanel oldPanel = (StatusBarPanel)owner.panels[index]; - oldPanel.ParentInternal = null; - value.ParentInternal = owner; - if (value.AutoSize == StatusBarPanelAutoSize.Contents) - { - value.Width = value.GetContentsWidth(true); - } - owner.panels[index] = value; - value.Index = index; - - if (owner.ArePanelsRealized()) - { - owner.PerformLayout(); - value.Realize(); - } - } - } - - object IList.this[int index] - { - get - { - return this[index]; - } - set - { - if (value is StatusBarPanel) - { - this[index] = (StatusBarPanel)value; - } - else - { - throw new ArgumentException(SR.StatusBarBadStatusBarPanel, "value"); - } - } - } - - /// - /// Retrieves the child control with the specified key. - /// - public virtual StatusBarPanel this[string key] - { - get - { - // We do not support null and empty string as valid keys. - if (string.IsNullOrEmpty(key)) - { - return null; - } - - // Search for the key in our collection - int index = IndexOfKey(key); - if (IsValidIndex(index)) - { - return this[index]; - } - else - { - return null; - } - } - } - - /// - /// Returns an integer representing the number of StatusBarPanels - /// in this collection. - /// - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public int Count - { - get - { - return owner.panels.Count; - } - } - - object ICollection.SyncRoot - { - get - { - return this; - } - } - - bool ICollection.IsSynchronized - { - get - { - return false; - } - } - - bool IList.IsFixedSize - { - get - { - return false; - } - } - - public bool IsReadOnly - { - get - { - return false; - } - } - - /// - /// Adds a StatusBarPanel to the collection. - /// - public virtual StatusBarPanel Add(string text) - { - StatusBarPanel panel = new StatusBarPanel - { - Text = text - }; - Add(panel); - return panel; - } - - /// - /// Adds a StatusBarPanel to the collection. - /// - public virtual int Add(StatusBarPanel value) - { - int index = owner.panels.Count; - Insert(index, value); - return index; - } - - int IList.Add(object value) - { - if (value is StatusBarPanel) - { - return Add((StatusBarPanel)value); - } - else - { - throw new ArgumentException(SR.StatusBarBadStatusBarPanel, "value"); - } - } - - public virtual void AddRange(StatusBarPanel[] panels) - { - if (panels == null) - { - throw new ArgumentNullException(nameof(panels)); - } - foreach (StatusBarPanel panel in panels) - { - Add(panel); - } - } - - public bool Contains(StatusBarPanel panel) - { - return IndexOf(panel) != -1; - } - - bool IList.Contains(object panel) - { - if (panel is StatusBarPanel) - { - return Contains((StatusBarPanel)panel); - } - else - { - return false; - } - } - - /// - /// Returns true if the collection contains an item with the specified key, false otherwise. - /// - public virtual bool ContainsKey(string key) - { - return IsValidIndex(IndexOfKey(key)); - } - - public int IndexOf(StatusBarPanel panel) - { - for (int index = 0; index < Count; ++index) - { - if (this[index] == panel) - { - return index; - } - } - return -1; - } - - int IList.IndexOf(object panel) - { - if (panel is StatusBarPanel) - { - return IndexOf((StatusBarPanel)panel); - } - else - { - return -1; - } - } - - /// - /// The zero-based index of the first occurrence of value within the entire CollectionBase, if found; otherwise, -1. - /// - public virtual int IndexOfKey(string key) - { - // Step 0 - Arg validation - if (string.IsNullOrEmpty(key)) - { - return -1; // we dont support empty or null keys. - } - - // step 1 - check the last cached item - if (IsValidIndex(lastAccessedIndex)) - { - if (WindowsFormsUtils.SafeCompareStrings(this[lastAccessedIndex].Name, key, /* ignoreCase = */ true)) - { - return lastAccessedIndex; - } - } - - // step 2 - search for the item - for (int i = 0; i < Count; i++) - { - if (WindowsFormsUtils.SafeCompareStrings(this[i].Name, key, /* ignoreCase = */ true)) - { - lastAccessedIndex = i; - return i; - } - } - - // step 3 - we didn't find it. Invalidate the last accessed index and return -1. - lastAccessedIndex = -1; - return -1; - } - - /// - /// Inserts a StatusBarPanel in the collection. - /// - public virtual void Insert(int index, StatusBarPanel value) - { - //check for the value not to be null - if (value == null) - { - throw new ArgumentNullException(nameof(value)); - } - //end check - - owner.layoutDirty = true; - if (value.Parent != owner && value.Parent != null) - { - throw new ArgumentException(SR.ObjectHasParent, "value"); - } - - int length = owner.panels.Count; - - if (index < 0 || index > length) - { - throw new ArgumentOutOfRangeException(nameof(index), index, string.Format(SR.InvalidArgument, nameof(index), index)); - } - - value.ParentInternal = owner; - - switch (value.AutoSize) - { - case StatusBarPanelAutoSize.None: - case StatusBarPanelAutoSize.Spring: - break; - case StatusBarPanelAutoSize.Contents: - value.Width = value.GetContentsWidth(true); - break; - } - - owner.panels.Insert(index, value); - owner.UpdatePanelIndex(); - - owner.ForcePanelUpdate(); - } - - void IList.Insert(int index, object value) - { - if (value is StatusBarPanel) - { - Insert(index, (StatusBarPanel)value); - } - else - { - throw new ArgumentException(SR.StatusBarBadStatusBarPanel, "value"); - } - } - - /// - /// Determines if the index is valid for the collection. - /// - private bool IsValidIndex(int index) - { - return ((index >= 0) && (index < Count)); - } - - /// - /// Removes all the StatusBarPanels in the collection. - /// - public virtual void Clear() - { - owner.RemoveAllPanelsWithoutUpdate(); - owner.PerformLayout(); - } - - /// - /// Removes an individual StatusBarPanel in the collection. - /// - public virtual void Remove(StatusBarPanel value) - { - //check for the value not to be null - if (value == null) - { - throw new ArgumentNullException(nameof(StatusBarPanel)); - } - //end check - - if (value.Parent != owner) - { - return; - } - RemoveAt(value.Index); - } - - void IList.Remove(object value) - { - if (value is StatusBarPanel) - { - Remove((StatusBarPanel)value); - } - } - - /// - /// Removes an individual StatusBarPanel in the collection at the given index. - /// - public virtual void RemoveAt(int index) - { - int length = Count; - if (index < 0 || index >= length) - { - throw new ArgumentOutOfRangeException(nameof(index), index, string.Format(SR.InvalidArgument, nameof(index), index)); - } - - // clear any tooltip - // - StatusBarPanel panel = (StatusBarPanel)owner.panels[index]; - - owner.panels.RemoveAt(index); - panel.ParentInternal = null; - - // this will cause the panels tooltip to be removed since it's no longer a child - // of this StatusBar. - owner.UpdateTooltip(panel); - - // We must reindex the panels after a removal... - owner.UpdatePanelIndex(); - owner.ForcePanelUpdate(); - } - - /// - /// Removes the child control with the specified key. - /// - public virtual void RemoveByKey(string key) - { - int index = IndexOfKey(key); - if (IsValidIndex(index)) - { - RemoveAt(index); - } - } - - void ICollection.CopyTo(Array dest, int index) - { - owner.panels.CopyTo(dest, index); - } - - /// - /// Returns the Enumerator for this collection. - /// - public IEnumerator GetEnumerator() - { - if (owner.panels != null) - { - return owner.panels.GetEnumerator(); - } - else - { - return Array.Empty().GetEnumerator(); - } - } - } - - /// - /// This is a tooltip control that provides tips for a single - /// control. Each "tool" region is defined by a rectangle and - /// the string that should be displayed. This implementation - /// is based on System.Windows.Forms.ToolTip, but this control - /// is lighter weight and provides less functionality... however - /// this control binds to rectangular regions, instead of - /// full controls. - /// - private class ControlToolTip : IHandle - { - public class Tool - { - public Rectangle rect = Rectangle.Empty; - public string text; - internal IntPtr id = new IntPtr(-1); - } - - private readonly Hashtable tools = new Hashtable(); - private readonly ToolTipNativeWindow window = null; - private readonly Control parent = null; - private int nextId = 0; - - /// - /// Creates a new ControlToolTip. - /// - public ControlToolTip(Control parent) - { - window = new ToolTipNativeWindow(this); - this.parent = parent; - } - - /// - /// Returns the createParams to create the window. - /// - protected CreateParams CreateParams - { - get - { - var icc = new INITCOMMONCONTROLSEX - { - dwICC = ICC.TAB_CLASSES - }; - InitCommonControlsEx(ref icc); - - var cp = new CreateParams - { - Parent = IntPtr.Zero, - ClassName = WindowClasses.TOOLTIPS_CLASS - }; - cp.Style |= NativeMethods.TTS_ALWAYSTIP; - cp.ExStyle = 0; - cp.Caption = null; - return cp; - } - } - - public IntPtr Handle - { - get - { - if (window.Handle == IntPtr.Zero) - { - CreateHandle(); - } - return window.Handle; - } - } - - private bool IsHandleCreated - { - get { return window.Handle != IntPtr.Zero; } - } - - private void AssignId(Tool tool) - { - tool.id = (IntPtr)nextId; - nextId++; - } - - /// - /// Sets the tool for the specified key. Keep in mind - /// that as soon as setTool is called, the handle for - /// the ControlToolTip is created, and the handle for - /// the parent control is also created. If the parent - /// handle is recreated in the future, all tools must - /// be re-added. The old tool for the specified key - /// will be removed. Passing null in for the - /// tool parameter will result in the tool - /// region being removed. - /// - public void SetTool(object key, Tool tool) - { - bool remove = false; - bool add = false; - bool update = false; - - Tool toRemove = null; - if (tools.ContainsKey(key)) - { - toRemove = (Tool)tools[key]; - } - - if (toRemove != null) - { - remove = true; - } - if (tool != null) - { - add = true; - } - if (tool != null && toRemove != null - && tool.id == toRemove.id) - { - update = true; - } - - if (update) - { - UpdateTool(tool); - } - else - { - if (remove) - { - RemoveTool(toRemove); - } - if (add) - { - AddTool(tool); - } - } - - if (tool != null) - { - tools[key] = tool; - } - else - { - tools.Remove(key); - } - } - - /// - /// Returns the tool associated with the specified key, - /// or null if there is no area. - /// - public Tool GetTool(object key) - { - return (Tool)tools[key]; - } - - private void AddTool(Tool tool) - { - if (tool != null && tool.text != null && tool.text.Length > 0) - { - StatusBar p = (StatusBar)parent; - - ToolInfoWrapper info = GetTOOLINFO(tool); - if (info.SendMessage(p.ToolTipSet ? (IHandle)p.mainToolTip : this, (User32.WM)TTM.ADDTOOLW) == IntPtr.Zero) - { - throw new InvalidOperationException(SR.StatusBarAddFailed); - } - } - } - - private void RemoveTool(Tool tool) - { - if (tool != null && tool.text != null && tool.text.Length > 0 && (int)tool.id >= 0) - { - ToolInfoWrapper info = GetMinTOOLINFO(tool); - info.SendMessage(this, (User32.WM)TTM.DELTOOLW); - } - } - - private void UpdateTool(Tool tool) - { - if (tool != null && tool.text != null && tool.text.Length > 0 && (int)tool.id >= 0) - { - ToolInfoWrapper info = GetTOOLINFO(tool); - info.SendMessage(this, (User32.WM)TTM.SETTOOLINFOW); - } - } - - /// - /// Creates the handle for the control. - /// - protected void CreateHandle() - { - if (IsHandleCreated) - { - return; - } - - window.CreateHandle(CreateParams); - User32.SetWindowPos( - new HandleRef(this, Handle), - User32.HWND_TOPMOST, - flags: User32.SWP.NOMOVE | User32.SWP.NOSIZE | User32.SWP.NOACTIVATE); - - // Setting the max width has the added benefit of enabling multiline tool tips - User32.SendMessageW(this, (User32.WM)TTM.SETMAXTIPWIDTH, IntPtr.Zero, (IntPtr)SystemInformation.MaxWindowTrackSize.Width); - } - - /// - /// Destroys the handle for this control. - /// - protected void DestroyHandle() - { - if (IsHandleCreated) - { - window.DestroyHandle(); - tools.Clear(); - } - } - - /// - /// Disposes of the component. Call dispose when the component is no longer needed. - /// This method removes the component from its container (if the component has a site) - /// and triggers the dispose event. - /// - public void Dispose() - { - DestroyHandle(); - } - - /// - /// Returns a new instance of the TOOLINFO_T structure with the minimum - /// required data to uniquely identify a region. This is used primarily - /// for delete operations. NOTE: This cannot force the creation of a handle. - /// - private ToolInfoWrapper GetMinTOOLINFO(Tool tool) - { - if ((int)tool.id < 0) - { - AssignId(tool); - } - - return new ToolInfoWrapper( - parent, - id: parent is StatusBar sb ? sb.Handle : tool.id); - } - - /// - /// Returns a detailed TOOLINFO_T structure that represents the specified - /// region. NOTE: This may force the creation of a handle. - /// - private ToolInfoWrapper GetTOOLINFO(Tool tool) - { - ToolInfoWrapper ti = GetMinTOOLINFO(tool); - ti.Info.uFlags |= TTF.TRANSPARENT | TTF.SUBCLASS; - - // RightToLeft reading order - Control richParent = parent; - if (richParent != null && richParent.RightToLeft == RightToLeft.Yes) - { - ti.Info.uFlags |= TTF.RTLREADING; - } - - ti.Text = tool.text; - ti.Info.rect = tool.rect; - return ti; - } - - ~ControlToolTip() - { - DestroyHandle(); - } - - protected void WndProc(ref Message msg) - { - switch ((User32.WM)msg.Msg) - { - case User32.WM.SETFOCUS: - return; - default: - window.DefWndProc(ref msg); - break; - } - } - - private class ToolTipNativeWindow : NativeWindow - { - readonly ControlToolTip control; - - internal ToolTipNativeWindow(ControlToolTip control) - { - this.control = control; - } - - protected override void WndProc(ref Message m) - { - if (control != null) - { - control.WndProc(ref m); - } - } - } - } - } -} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarDrawItemEventArgs.cs b/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarDrawItemEventArgs.cs deleted file mode 100644 index 7baba5a68ba..00000000000 --- a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarDrawItemEventArgs.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#nullable disable - -using System.Drawing; - -namespace System.Windows.Forms -{ - /// - /// Provides data for the - /// event. - /// - public class StatusBarDrawItemEventArgs : DrawItemEventArgs - { - /// - /// Initializes a new instance of the - /// class. - /// - public StatusBarDrawItemEventArgs(Graphics g, Font font, Rectangle r, int itemId, - DrawItemState itemState, StatusBarPanel panel) - : base(g, font, r, itemId, itemState) - { - Panel = panel; - } - - /// - /// Initializes a new instance of the - /// class using the Forecolor and Backcolor. - /// - public StatusBarDrawItemEventArgs(Graphics g, Font font, Rectangle r, int itemId, - DrawItemState itemState, StatusBarPanel panel, - Color foreColor, Color backColor) - : base(g, font, r, itemId, itemState, foreColor, backColor) - { - Panel = panel; - } - - /// - /// Specifies the to draw. - /// - public StatusBarPanel Panel { get; } - } -} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarDrawItemEventHandler.cs b/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarDrawItemEventHandler.cs deleted file mode 100644 index ad6cb4894ca..00000000000 --- a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarDrawItemEventHandler.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#nullable disable - -namespace System.Windows.Forms -{ - /// - /// Represents a method that will handle the - /// event of a . - /// - public delegate void StatusBarDrawItemEventHandler(object sender, StatusBarDrawItemEventArgs sbdevent); -} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanel.cs b/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanel.cs deleted file mode 100644 index 471c04f6c80..00000000000 --- a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanel.cs +++ /dev/null @@ -1,708 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#nullable disable - -using System.ComponentModel; -using System.Drawing; -using System.Runtime.InteropServices; -using static Interop; -using static Interop.ComCtl32; - -namespace System.Windows.Forms -{ - /// - /// Stores the - /// control panel's information. - /// - [ - ToolboxItem(false), - DesignTimeVisible(false), - DefaultProperty(nameof(Text)) - ] - public class StatusBarPanel : Component, ISupportInitialize - { - private const int DEFAULTWIDTH = 100; - private const int DEFAULTMINWIDTH = 10; - private const int PANELTEXTINSET = 3; - private const int PANELGAP = 2; - - private string text = string.Empty; - private string name = string.Empty; - private string toolTipText = string.Empty; - private Icon icon = null; - - private HorizontalAlignment alignment = HorizontalAlignment.Left; - private StatusBarPanelBorderStyle borderStyle = System.Windows.Forms.StatusBarPanelBorderStyle.Sunken; - private StatusBarPanelStyle style = StatusBarPanelStyle.Text; - - // these are package scope so the parent can get at them. - // - private StatusBar parent = null; - private int width = DEFAULTWIDTH; - private int right = 0; - private int minWidth = DEFAULTMINWIDTH; - private int index = 0; - private StatusBarPanelAutoSize autoSize = StatusBarPanelAutoSize.None; - - private bool initializing = false; - - private object userData; - - /// - /// Initializes a new default instance of the class. - /// - public StatusBarPanel() - { - } - - /// - /// Gets or sets the - /// property. - /// - [ - SRCategory(nameof(SR.CatAppearance)), - DefaultValue(HorizontalAlignment.Left), - Localizable(true), - SRDescription(nameof(SR.StatusBarPanelAlignmentDescr)) - ] - public HorizontalAlignment Alignment - { - get - { - return alignment; - } - - set - { - //valid values are 0x0 to 0x2 - if (!ClientUtils.IsEnumValid(value, (int)value, (int)HorizontalAlignment.Left, (int)HorizontalAlignment.Center)) - { - throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(HorizontalAlignment)); - } - if (alignment != value) - { - alignment = value; - Realize(); - } - } - } - - /// - /// Gets or sets the - /// property. - /// - [ - SRCategory(nameof(SR.CatAppearance)), - DefaultValue(StatusBarPanelAutoSize.None), - RefreshProperties(RefreshProperties.All), - SRDescription(nameof(SR.StatusBarPanelAutoSizeDescr)) - ] - public StatusBarPanelAutoSize AutoSize - { - get - { - return autoSize; - } - - set - { - //valid values are 0x1 to 0x3 - if (!ClientUtils.IsEnumValid(value, (int)value, (int)StatusBarPanelAutoSize.None, (int)StatusBarPanelAutoSize.Contents)) - { - throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(StatusBarPanelAutoSize)); - } - if (autoSize != value) - { - autoSize = value; - UpdateSize(); - } - } - } - - /// - /// Gets or sets the property. - /// - [SRCategory(nameof(SR.CatAppearance))] - [DefaultValue(System.Windows.Forms.StatusBarPanelBorderStyle.Sunken)] - [DispId((int)Ole32.DispatchID.BORDERSTYLE)] - [SRDescription(nameof(SR.StatusBarPanelBorderStyleDescr))] - public StatusBarPanelBorderStyle BorderStyle - { - get => borderStyle; - set - { - if (!ClientUtils.IsEnumValid(value, (int)value, (int)StatusBarPanelBorderStyle.None, (int)StatusBarPanelBorderStyle.Sunken)) - { - throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(StatusBarPanelBorderStyle)); - } - - if (borderStyle != value) - { - borderStyle = value; - Realize(); - if (Created) - { - parent.Invalidate(); - } - } - } - } - - internal bool Created - { - get - { - return parent != null && parent.ArePanelsRealized(); - } - } - - /// - /// Gets or sets the - /// property. - /// - [ - SRCategory(nameof(SR.CatAppearance)), - DefaultValue(null), - Localizable(true), - SRDescription(nameof(SR.StatusBarPanelIconDescr)) - ] - public Icon Icon - { - get - { - // unfortunately we have no way of getting the icon from the control. - return icon; - } - - set - { - if (value != null && (((Icon)value).Height > SystemInformation.SmallIconSize.Height || ((Icon)value).Width > SystemInformation.SmallIconSize.Width)) - { - icon = new Icon(value, SystemInformation.SmallIconSize); - } - else - { - icon = value; - } - - if (Created) - { - IntPtr handle = (icon == null) ? IntPtr.Zero : icon.Handle; - User32.SendMessageW(parent, (User32.WM)SB.SETICON, (IntPtr)GetIndex(), handle); - } - UpdateSize(); - if (Created) - { - parent.Invalidate(); - } - } - } - - /// - /// Expose index internally - /// - internal int Index - { - get - { - return index; - } - set - { - index = value; - } - } - /// - /// Gets or sets the minimum width the can be within the - /// control. - /// - [ - SRCategory(nameof(SR.CatBehavior)), - DefaultValue(DEFAULTMINWIDTH), - Localizable(true), - RefreshProperties(RefreshProperties.All), - SRDescription(nameof(SR.StatusBarPanelMinWidthDescr)) - ] - public int MinWidth - { - get - { - return minWidth; - } - set - { - if (value < 0) - { - throw new ArgumentOutOfRangeException(nameof(value), value, string.Format(SR.InvalidLowBoundArgumentEx, nameof(MinWidth), value, 0)); - } - - if (value != minWidth) - { - minWidth = value; - - UpdateSize(); - if (minWidth > Width) - { - Width = value; - } - } - } - } - - /// - /// Gets or sets the name of the panel. - /// - [ - SRCategory(nameof(SR.CatAppearance)), - Localizable(true), - SRDescription(nameof(SR.StatusBarPanelNameDescr)) - ] - public string Name - { - get - { - return WindowsFormsUtils.GetComponentName(this, name); - } - set - { - name = value; - if (Site != null) - { - Site.Name = name; - } - } - } - - /// - /// Represents the - /// control which hosts the - /// panel. - /// - [Browsable(false)] - public StatusBar Parent - { - get - { - return parent; - } - } - - /// - /// Expose a direct setter for parent internally - /// - internal StatusBar ParentInternal - { - set - { - parent = value; - } - } - - /// - /// Expose right internally - /// - internal int Right - { - get - { - return right; - } - set - { - right = value; - } - } - - /// - /// Gets or sets the style of the panel. - /// - [ - SRCategory(nameof(SR.CatAppearance)), - DefaultValue(StatusBarPanelStyle.Text), - SRDescription(nameof(SR.StatusBarPanelStyleDescr)) - ] - public StatusBarPanelStyle Style - { - get { return style; } - set - { - //valid values are 0x1 to 0x2 - if (!ClientUtils.IsEnumValid(value, (int)value, (int)StatusBarPanelStyle.Text, (int)StatusBarPanelStyle.OwnerDraw)) - { - throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(StatusBarPanelStyle)); - } - if (style != value) - { - style = value; - Realize(); - if (Created) - { - parent.Invalidate(); - } - } - } - } - - [ - SRCategory(nameof(SR.CatData)), - Localizable(false), - Bindable(true), - SRDescription(nameof(SR.ControlTagDescr)), - DefaultValue(null), - TypeConverter(typeof(StringConverter)), - ] - public object Tag - { - get - { - return userData; - } - set - { - userData = value; - } - } - - /// - /// Gets or sets the text of the panel. - /// - [ - SRCategory(nameof(SR.CatAppearance)), - Localizable(true), - DefaultValue(""), - SRDescription(nameof(SR.StatusBarPanelTextDescr)) - ] - public string Text - { - get - { - if (text == null) - { - return ""; - } - else - { - return text; - } - } - set - { - if (value == null) - { - value = string.Empty; - } - - if (!Text.Equals(value)) - { - if (value.Length == 0) - { - text = null; - } - else - { - text = value; - } - Realize(); - UpdateSize(); - } - } - } - - /// - /// Gets - /// or sets the panel's tool tip text. - /// - [ - SRCategory(nameof(SR.CatAppearance)), - Localizable(true), - DefaultValue(""), - SRDescription(nameof(SR.StatusBarPanelToolTipTextDescr)) - ] - public string ToolTipText - { - get - { - if (toolTipText == null) - { - return ""; - } - else - { - return toolTipText; - } - } - set - { - if (value == null) - { - value = string.Empty; - } - - if (!ToolTipText.Equals(value)) - { - if (value.Length == 0) - { - toolTipText = null; - } - else - { - toolTipText = value; - } - - if (Created) - { - parent.UpdateTooltip(this); - } - } - } - } - - /// - /// Gets or sets the width of the within the - /// control. - /// - [ - Localizable(true), - SRCategory(nameof(SR.CatAppearance)), - DefaultValue(DEFAULTWIDTH), - SRDescription(nameof(SR.StatusBarPanelWidthDescr)) - ] - public int Width - { - get - { - return width; - } - set - { - if (!initializing && value < minWidth) - { - throw new ArgumentOutOfRangeException(nameof(Width), SR.WidthGreaterThanMinWidth); - } - - width = value; - UpdateSize(); - } - } - - /// - /// Handles tasks required when the control is being initialized. - /// - public void BeginInit() - { - initializing = true; - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - if (parent != null) - { - int index = GetIndex(); - if (index != -1) - { - parent.Panels.RemoveAt(index); - } - } - } - base.Dispose(disposing); - } - - /// - /// Called when initialization of the control is complete. - /// - public void EndInit() - { - initializing = false; - - if (Width < MinWidth) - { - Width = MinWidth; - } - } - - /// - /// Gets the width of the contents of the panel - /// - internal int GetContentsWidth(bool newPanel) - { - string text; - if (newPanel) - { - if (this.text == null) - { - text = string.Empty; - } - else - { - text = this.text; - } - } - else - { - text = Text; - } - - Graphics g = parent.CreateGraphicsInternal(); - Size sz = Size.Ceiling(g.MeasureString(text, parent.Font)); - if (icon != null) - { - sz.Width += icon.Size.Width + 5; - } - g.Dispose(); - - int width = sz.Width + SystemInformation.BorderSize.Width * 2 + PANELTEXTINSET * 2 + PANELGAP; - return Math.Max(width, minWidth); - } - - /// - /// Returns the index of the panel by making the parent control search - /// for it within its list. - /// - private int GetIndex() - { - return index; - } - - /// - /// Sets all the properties for this panel. - /// - internal void Realize() - { - if (Created) - { - string sendText; - SBT border = 0; - - string text = this.text ?? string.Empty; - - HorizontalAlignment align = alignment; - // Translate the alignment for Rtl apps - // - if (parent.RightToLeft == RightToLeft.Yes) - { - switch (align) - { - case HorizontalAlignment.Left: - align = HorizontalAlignment.Right; - break; - case HorizontalAlignment.Right: - align = HorizontalAlignment.Left; - break; - } - } - - switch (align) - { - case HorizontalAlignment.Center: - sendText = "\t" + text; - break; - case HorizontalAlignment.Right: - sendText = "\t\t" + text; - break; - default: - sendText = text; - break; - } - switch (borderStyle) - { - case StatusBarPanelBorderStyle.None: - border |= SBT.NOBORDERS; - break; - case StatusBarPanelBorderStyle.Sunken: - break; - case StatusBarPanelBorderStyle.Raised: - border |= SBT.POPOUT; - break; - } - switch (style) - { - case StatusBarPanelStyle.Text: - break; - case StatusBarPanelStyle.OwnerDraw: - border |= SBT.OWNERDRAW; - break; - } - - int wparam = GetIndex() | (int)border; - if (parent.RightToLeft == RightToLeft.Yes) - { - wparam |= (int)SBT.RTLREADING; - } - - int result = (int)User32.SendMessageW(parent, (User32.WM)SB.SETTEXT, (IntPtr)wparam, sendText); - - if (result == 0) - { - throw new InvalidOperationException(SR.UnableToSetPanelText); - } - - if (icon != null && style != StatusBarPanelStyle.OwnerDraw) - { - User32.SendMessageW(parent, (User32.WM)SB.SETICON, (IntPtr)GetIndex(), icon.Handle); - } - else - { - User32.SendMessageW(parent, (User32.WM)SB.SETICON, (IntPtr)GetIndex(), IntPtr.Zero); - } - - if (style == StatusBarPanelStyle.OwnerDraw) - { - RECT rect = new RECT(); - result = (int)User32.SendMessageW(parent, (User32.WM)SB.GETRECT, (IntPtr)GetIndex(), ref rect); - - if (result != 0) - { - parent.Invalidate(Rectangle.FromLTRB(rect.left, rect.top, rect.right, rect.bottom)); - } - } - } - } - - private void UpdateSize() - { - if (autoSize == StatusBarPanelAutoSize.Contents) - { - ApplyContentSizing(); - } - else - { - if (Created) - { - parent.DirtyLayout(); - parent.PerformLayout(); - } - } - } - - private void ApplyContentSizing() - { - if (autoSize == StatusBarPanelAutoSize.Contents && - parent != null) - { - int newWidth = GetContentsWidth(false); - if (newWidth != Width) - { - Width = newWidth; - if (Created) - { - parent.DirtyLayout(); - parent.PerformLayout(); - } - } - } - } - - /// - /// Retrieves a string that contains information about the - /// panel. - /// - public override string ToString() - { - return "StatusBarPanel: {" + Text + "}"; - } - } -} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelAutoSize.cs b/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelAutoSize.cs deleted file mode 100644 index 329b982eb20..00000000000 --- a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelAutoSize.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Windows.Forms -{ - /// - /// Specifies how a panel on a status bar changes when the status bar resizes. - /// - public enum StatusBarPanelAutoSize - { - /// - /// The panel does not change its size when the status bar resizes. - /// - None = 1, - - /// - /// The panel shares the available status bar space (the space not taken - /// up by panels with the and - /// settings) with other panels that have the setting. - /// - Spring = 2, - - /// - /// The width of the panel is determined by its contents. - /// - Contents = 3, - } -} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelBorderStyle.cs b/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelBorderStyle.cs deleted file mode 100644 index d339f8f2d99..00000000000 --- a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelBorderStyle.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Windows.Forms -{ - /// - /// Specifies the border style of a panel on the . - /// - public enum StatusBarPanelBorderStyle - { - /// - /// No border. - /// - None = 1, - - /// - /// A raised border. - /// - Raised = 2, - - /// - /// A sunken border. - /// - Sunken = 3, - } -} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelClickEventArgs.cs b/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelClickEventArgs.cs deleted file mode 100644 index 882de3a936b..00000000000 --- a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelClickEventArgs.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#nullable disable - -namespace System.Windows.Forms -{ - /// - /// Provides data for the - /// event. - /// - public class StatusBarPanelClickEventArgs : MouseEventArgs - { - /// - /// Initializes a new instance of the - /// class. - /// - public StatusBarPanelClickEventArgs(StatusBarPanel statusBarPanel, MouseButtons button, int clicks, int x, int y) : base(button, clicks, x, y, 0) - { - StatusBarPanel = statusBarPanel; - } - - /// - /// Specifies the that represents the clicked panel. - /// - public StatusBarPanel StatusBarPanel { get; } - } -} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelClickEventHandler.cs b/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelClickEventHandler.cs deleted file mode 100644 index a72c81d289b..00000000000 --- a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelClickEventHandler.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#nullable disable - -namespace System.Windows.Forms -{ - /// - /// Represents a method that will handle the - /// event of a . - /// - public delegate void StatusBarPanelClickEventHandler(object sender, StatusBarPanelClickEventArgs e); -} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelStyle.cs b/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelStyle.cs deleted file mode 100644 index 577bd23650f..00000000000 --- a/src/System.Windows.Forms/src/System/Windows/Forms/StatusBarPanelStyle.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Windows.Forms -{ - /// - /// Specifies whether a panel on a status bar is owner drawn or system drawn. - /// - public enum StatusBarPanelStyle - { - /// - /// The panel is drawn by the system. - /// - Text = 1, - - /// - /// The panel is drawn by the owner. - /// - OwnerDraw = 2, - } -} diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip.cs index e9d3b674e56..85d954b9255 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip.cs @@ -672,11 +672,6 @@ private void CheckNativeToolTip(Control associatedControl) listView.SetToolTip(this, GetToolTip(associatedControl)); } - if (associatedControl is StatusBar statusBar) - { - statusBar.SetToolTip(this); - } - // Label now has its own Tooltip for AutoEllipsis. // So this control too falls in special casing. // We need to disable the LABEL AutoEllipsis tooltip and show diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/StatusBarDrawItemEventArgsTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/StatusBarDrawItemEventArgsTests.cs deleted file mode 100644 index 27a0acf4d12..00000000000 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/StatusBarDrawItemEventArgsTests.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Drawing; -using Xunit; - -namespace System.Windows.Forms.Tests -{ - public class StatusBarDrawItemEventArgsTests : IClassFixture - { - public static IEnumerable Ctor_Graphics_Font_Rectangle_Int_DrawItemState_StatusBarPanel_TestData() - { - yield return new object[] { null, Rectangle.Empty, -2, (DrawItemState)(DrawItemState.None - 1), null, SystemColors.HighlightText, SystemColors.Highlight }; - yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), -1, DrawItemState.None, new StatusBarPanel(), SystemColors.WindowText, SystemColors.Window }; - yield return new object[] { SystemFonts.DefaultFont, new Rectangle(-1, 2, -3, -4), 0, DrawItemState.Selected, new StatusBarPanel(), SystemColors.HighlightText, SystemColors.Highlight }; - yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Focus, new StatusBarPanel(), SystemColors.WindowText, SystemColors.Window }; - yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Focus | DrawItemState.NoFocusRect, new StatusBarPanel(), SystemColors.WindowText, SystemColors.Window }; - } - - [Theory] - [MemberData(nameof(Ctor_Graphics_Font_Rectangle_Int_DrawItemState_StatusBarPanel_TestData))] - public void StatusBarDrawItemEventArgs_Ctor_Graphics_Font_Rectangle_Int_DrawItemState_StatusBarPanel(Font font, Rectangle rect, int index, DrawItemState state, StatusBarPanel panel, Color expectedForeColor, Color expectedBackColor) - { - using (var image = new Bitmap(10, 10)) - using (Graphics graphics = Graphics.FromImage(image)) - { - var e = new StatusBarDrawItemEventArgs(graphics, font, rect, index, state, panel); - Assert.Same(graphics, e.Graphics); - Assert.Same(font, e.Font); - Assert.Equal(rect, e.Bounds); - Assert.Equal(index, e.Index); - Assert.Equal(state, e.State); - Assert.Same(panel, e.Panel); - Assert.Equal(expectedForeColor, e.ForeColor); - Assert.Equal(expectedBackColor, e.BackColor); - } - } - - public static IEnumerable Ctor_Graphics_Font_Rectangle_Int_DrawItemState_StatusBarPanel_Color_Color_TestData() - { - yield return new object[] { null, Rectangle.Empty, -2, (DrawItemState)(DrawItemState.None - 1), null, Color.Empty, Color.Empty, SystemColors.HighlightText, SystemColors.Highlight }; - yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), -1, DrawItemState.None, new StatusBarPanel(), Color.Red, Color.Blue, Color.Red, Color.Blue }; - yield return new object[] { SystemFonts.DefaultFont, new Rectangle(-1, 2, -3, -4), 0, DrawItemState.Selected, new StatusBarPanel(), Color.Red, Color.Blue, SystemColors.HighlightText, SystemColors.Highlight }; - yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Focus, new StatusBarPanel(), Color.Red, Color.Blue, Color.Red, Color.Blue }; - yield return new object[] { SystemFonts.DefaultFont, new Rectangle(1, 2, 3, 4), 1, DrawItemState.Focus | DrawItemState.NoFocusRect, new StatusBarPanel(), Color.Red, Color.Blue, Color.Red, Color.Blue }; - } - - [Theory] - [MemberData(nameof(Ctor_Graphics_Font_Rectangle_Int_DrawItemState_StatusBarPanel_Color_Color_TestData))] - public void StatusBarDrawItemEventArgs_Ctor_Graphics_Font_Rectangle_Int_DrawItemState_StatusBarPanel_Color_Color(Font font, Rectangle rect, int index, DrawItemState state, StatusBarPanel panel, Color foreColor, Color backColor, Color expectedForeColor, Color expectedBackColor) - { - using (var image = new Bitmap(10, 10)) - using (Graphics graphics = Graphics.FromImage(image)) - { - var e = new StatusBarDrawItemEventArgs(graphics, font, rect, index, state, panel, foreColor, backColor); - Assert.Same(graphics, e.Graphics); - Assert.Same(font, e.Font); - Assert.Equal(rect, e.Bounds); - Assert.Equal(index, e.Index); - Assert.Equal(state, e.State); - Assert.Same(panel, e.Panel); - Assert.Equal(expectedForeColor, e.ForeColor); - Assert.Equal(expectedBackColor, e.BackColor); - } - } - } -} diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/StatusBarPanelClickEventArgsTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/StatusBarPanelClickEventArgsTests.cs deleted file mode 100644 index 257967de3d9..00000000000 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/StatusBarPanelClickEventArgsTests.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Drawing; -using Xunit; - -namespace System.Windows.Forms.Tests -{ - public class StatusBarPanelClickEventArgsTests : IClassFixture - { - public static IEnumerable Ctor_StatusBarPanel_MouseButtons_Int_Int_Int_Int_TestData() - { - yield return new object[] { null, MouseButtons.Left, 1, 2, 3 }; - yield return new object[] { new StatusBarPanel(), (MouseButtons)1, 0, 0, 0 }; - yield return new object[] { new StatusBarPanel(), (MouseButtons)3, -1, -1, -1 }; - } - - [Theory] - [MemberData(nameof(Ctor_StatusBarPanel_MouseButtons_Int_Int_Int_Int_TestData))] - public void Ctor_StatusBarPanel_MouseButtons_Int_Int_Int_Int(StatusBarPanel statusBarPanel, MouseButtons button, int clicks, int x, int y) - { - var e = new StatusBarPanelClickEventArgs(statusBarPanel, button, clicks, x, y); - Assert.Equal(statusBarPanel, e.StatusBarPanel); - Assert.Equal(button, e.Button); - Assert.Equal(clicks, e.Clicks); - Assert.Equal(x, e.X); - Assert.Equal(y, e.Y); - Assert.Equal(0, e.Delta); - Assert.Equal(new Point(x, y), e.Location); - } - } -} diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/StatusBarPanelTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/StatusBarPanelTests.cs deleted file mode 100644 index 33b63aa2f6b..00000000000 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/StatusBarPanelTests.cs +++ /dev/null @@ -1,382 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms.Layout; -using Moq; -using WinForms.Common.Tests; -using Xunit; -using static Interop; - -namespace System.Windows.Forms.Tests -{ - using Point = System.Drawing.Point; - using Size = System.Drawing.Size; - - public class StatusBarPanelTests : IClassFixture - { - [WinFormsFact] - public void StatusBarPanel_Ctor_Default() - { - using var panel = new SubStatusBarPanel(); - Assert.Equal(HorizontalAlignment.Left, panel.Alignment); - Assert.Equal(StatusBarPanelAutoSize.None, panel.AutoSize); - Assert.Equal(StatusBarPanelBorderStyle.Sunken, panel.BorderStyle); - Assert.True(panel.CanRaiseEvents); - Assert.Null(panel.Container); - Assert.False(panel.DesignMode); - Assert.NotNull(panel.Events); - Assert.Same(panel.Events, panel.Events); - Assert.Null(panel.Icon); - Assert.Equal(10, panel.MinWidth); - Assert.Empty(panel.Name); - Assert.Null(panel.Parent); - Assert.Null(panel.Site); - Assert.Equal(StatusBarPanelStyle.Text, panel.Style); - Assert.Null(panel.Tag); - Assert.Empty(panel.Text); - Assert.Empty(panel.ToolTipText); - Assert.Equal(100, panel.Width); - } - - public static IEnumerable Icon_Set_TestData() - { - foreach (StatusBarPanelAutoSize autoSize in Enum.GetValues(typeof(StatusBarPanelAutoSize))) - { - yield return new object[] { autoSize, new Icon("bitmaps/10x16_one_entry_32bit.ico"), new Size(10, 16) }; - yield return new object[] { autoSize, new Icon("bitmaps/256x256_one_entry_32bit.ico"), new Size(256, 256) }; - yield return new object[] { autoSize, null, null }; - } - } - - [WinFormsTheory] - [MemberData(nameof(Icon_Set_TestData))] - public void StatusBarPanel_Icon_Set_GetReturnsExpected(StatusBarPanelAutoSize autoSize, Icon value, Size? expectedSize) - { - using var panel = new StatusBarPanel - { - AutoSize = autoSize, - Icon = value - }; - Assert.Equal(expectedSize, panel.Icon?.Size); - - // Set same. - panel.Icon = value; - Assert.Equal(expectedSize, panel.Icon?.Size); - } - - [WinFormsTheory] - [MemberData(nameof(Icon_Set_TestData))] - public void StatusBarPanel_Icon_SetWithNonNullOldValue_GetReturnsExpected(StatusBarPanelAutoSize autoSize, Icon value, Size? expectedSize) - { - using var oldValue = new Icon("bitmaps/10x16_one_entry_32bit.ico"); - using var panel = new StatusBarPanel - { - AutoSize = autoSize, - Icon = oldValue - }; - - panel.Icon = value; - Assert.Equal(expectedSize, panel.Icon?.Size); - - // Set same. - panel.Icon = value; - Assert.Equal(expectedSize, panel.Icon?.Size); - } - - public static IEnumerable Icon_SetWithParent_TestData() - { - foreach (bool showPanels in new bool[] { true, false }) - { - foreach (StatusBarPanelAutoSize autoSize in Enum.GetValues(typeof(StatusBarPanelAutoSize))) - { - bool create = autoSize == StatusBarPanelAutoSize.Contents; - yield return new object[] { showPanels, autoSize, new Icon("bitmaps/10x16_one_entry_32bit.ico"), new Size(10, 16), showPanels && create ? 1 : 0, create }; - yield return new object[] { showPanels, autoSize, new Icon("bitmaps/256x256_one_entry_32bit.ico"), new Size(256, 256), showPanels && create ? 1 : 0, create }; - yield return new object[] { showPanels, autoSize, null, null, 0, create }; - } - } - } - - [WinFormsTheory] - [MemberData(nameof(Icon_SetWithParent_TestData))] - public void StatusBarPanel_Icon_SetWithParent_GetReturnsExpected(bool showPanels, StatusBarPanelAutoSize autoSize, Icon value, Size? expectedSize, int expectedParentLayoutCallCount, bool expectedIsHandleCreated) - { - using var parent = new StatusBar - { - ShowPanels = showPanels - }; - using var panel = new StatusBarPanel - { - AutoSize = autoSize - }; - parent.Panels.Add(panel); - - int parentLayoutCallCount = 0; - void parentHandler(object sender, LayoutEventArgs e) - { - parentLayoutCallCount++; - }; - parent.Layout += parentHandler; - try - { - panel.Icon = value; - Assert.Equal(expectedSize, panel.Icon?.Size); - Assert.Equal(expectedParentLayoutCallCount, parentLayoutCallCount); - Assert.Equal(expectedIsHandleCreated, parent.IsHandleCreated); - - // Set same. - panel.Icon = value; - Assert.Equal(expectedSize, panel.Icon?.Size); - Assert.Equal(expectedParentLayoutCallCount, parentLayoutCallCount); - Assert.Equal(expectedIsHandleCreated, parent.IsHandleCreated); - } - finally - { - parent.Layout -= parentHandler; - } - } - - public static IEnumerable Icon_SetWithNonNullOldValueWithParent_TestData() - { - foreach (bool showPanels in new bool[] { true, false }) - { - foreach (StatusBarPanelAutoSize autoSize in Enum.GetValues(typeof(StatusBarPanelAutoSize))) - { - bool create = autoSize == StatusBarPanelAutoSize.Contents; - yield return new object[] { showPanels, autoSize, new Icon("bitmaps/10x16_one_entry_32bit.ico"), new Size(10, 16), 0, create }; - yield return new object[] { showPanels, autoSize, new Icon("bitmaps/256x256_one_entry_32bit.ico"), new Size(256, 256), showPanels && create ? 1 : 0, create }; - yield return new object[] { showPanels, autoSize, null, null, showPanels && create ? 1 : 0, create }; - } - } - } - - [WinFormsTheory] - [MemberData(nameof(Icon_SetWithNonNullOldValueWithParent_TestData))] - public void StatusBarPanel_Icon_SetWithNonNullOldValueWithParent_GetReturnsExpected(bool showPanels, StatusBarPanelAutoSize autoSize, Icon value, Size? expectedSize, int expectedParentLayoutCallCount, bool expectedIsHandleCreated) - { - using var oldValue = new Icon("bitmaps/10x16_one_entry_32bit.ico"); - using var parent = new StatusBar - { - ShowPanels = showPanels - }; - using var panel = new StatusBarPanel - { - AutoSize = autoSize, - Icon = oldValue - }; - parent.Panels.Add(panel); - - int parentLayoutCallCount = 0; - void parentHandler(object sender, LayoutEventArgs e) - { - parentLayoutCallCount++; - }; - parent.Layout += parentHandler; - try - { - panel.Icon = value; - Assert.Equal(expectedSize, panel.Icon?.Size); - Assert.Equal(expectedParentLayoutCallCount, parentLayoutCallCount); - Assert.Equal(expectedIsHandleCreated, parent.IsHandleCreated); - - // Set same. - panel.Icon = value; - Assert.Equal(expectedSize, panel.Icon?.Size); - Assert.Equal(expectedParentLayoutCallCount, parentLayoutCallCount); - Assert.Equal(expectedIsHandleCreated, parent.IsHandleCreated); - } - finally - { - parent.Layout -= parentHandler; - } - } - - public static IEnumerable Icon_SetWithParentWithHandle_TestData() - { - foreach (StatusBarPanelAutoSize autoSize in Enum.GetValues(typeof(StatusBarPanelAutoSize))) - { - bool create = autoSize == StatusBarPanelAutoSize.Contents; - yield return new object[] { true, autoSize, new Icon("bitmaps/10x16_one_entry_32bit.ico"), new Size(10, 16), 1, 1, create ? 1 : 2 }; - yield return new object[] { true, autoSize, new Icon("bitmaps/256x256_one_entry_32bit.ico"), new Size(256, 256), 1, 1, create ? 1 : 2 }; - yield return new object[] { true, autoSize, null, null, 1, create ? 0 : 1, create ? 0 : 2 }; - yield return new object[] { false, autoSize, new Icon("bitmaps/10x16_one_entry_32bit.ico"), new Size(10, 16), 0, 0, 0 }; - yield return new object[] { false, autoSize, new Icon("bitmaps/256x256_one_entry_32bit.ico"), new Size(256, 256), 0, 0, 0 }; - yield return new object[] { false, autoSize, null, null, 0, 0, 0 }; - } - } - - [WinFormsTheory] - [MemberData(nameof(Icon_SetWithParentWithHandle_TestData))] - public void StatusBarPanel_Icon_SetWithParentWithHandle_GetReturnsExpected(bool showPanels, StatusBarPanelAutoSize autoSize, Icon value, Size? expectedSize, int expectedInvalidatedCallCount, int expectedParentLayoutCallCount1, int expectedParentLayoutCallCount2) - { - using var parent = new StatusBar - { - ShowPanels = showPanels - }; - using var panel = new StatusBarPanel - { - AutoSize = autoSize - }; - parent.Panels.Add(panel); - Assert.NotEqual(IntPtr.Zero, parent.Handle); - int invalidatedCallCount = 0; - parent.Invalidated += (sender, e) => invalidatedCallCount++; - int styleChangedCallCount = 0; - parent.StyleChanged += (sender, e) => styleChangedCallCount++; - int createdCallCount = 0; - parent.HandleCreated += (sender, e) => createdCallCount++; - - int parentLayoutCallCount = 0; - void parentHandler(object sender, LayoutEventArgs e) - { - Assert.Same(parent, sender); - Assert.Null(e.AffectedControl); - Assert.Null(e.AffectedProperty); - parentLayoutCallCount++; - }; - parent.Layout += parentHandler; - - try - { - panel.Icon = value; - Assert.Equal(expectedSize, panel.Icon?.Size); - Assert.Equal(expectedParentLayoutCallCount1, parentLayoutCallCount); - Assert.True(parent.IsHandleCreated); - Assert.Equal(expectedInvalidatedCallCount, invalidatedCallCount); - Assert.Equal(0, styleChangedCallCount); - Assert.Equal(0, createdCallCount); - - // Set same. - panel.Icon = value; - Assert.Equal(expectedSize, panel.Icon?.Size); - Assert.Equal(expectedParentLayoutCallCount2, parentLayoutCallCount); - Assert.True(parent.IsHandleCreated); - Assert.Equal(expectedInvalidatedCallCount * 2, invalidatedCallCount); - Assert.Equal(0, styleChangedCallCount); - Assert.Equal(0, createdCallCount); - } - finally - { - parent.Layout -= parentHandler; - } - } - - public static IEnumerable Icon_SetWithNonNullOldValueWithParentWithHandle_TestData() - { - foreach (StatusBarPanelAutoSize autoSize in Enum.GetValues(typeof(StatusBarPanelAutoSize))) - { - bool create = autoSize == StatusBarPanelAutoSize.Contents; - yield return new object[] { true, autoSize, new Icon("bitmaps/10x16_one_entry_32bit.ico"), new Size(10, 16), 1, create ? 0 : 1, create ? 0 : 2 }; - yield return new object[] { true, autoSize, new Icon("bitmaps/256x256_one_entry_32bit.ico"), new Size(256, 256), 1, 1, create ? 1 : 2 }; - yield return new object[] { true, autoSize, null, null, 1, 1, create ? 1 : 2 }; - yield return new object[] { false, autoSize, new Icon("bitmaps/10x16_one_entry_32bit.ico"), new Size(10, 16), 0, 0, 0 }; - yield return new object[] { false, autoSize, new Icon("bitmaps/256x256_one_entry_32bit.ico"), new Size(256, 256), 0, 0, 0 }; - yield return new object[] { false, autoSize, null, null, 0, 0, 0 }; - } - } - - [WinFormsTheory] - [MemberData(nameof(Icon_SetWithNonNullOldValueWithParentWithHandle_TestData))] - public void StatusBarPanel_Icon_SetWithNonNullOldValueWithParentWithHandle_GetReturnsExpected(bool showPanels, StatusBarPanelAutoSize autoSize, Icon value, Size? expectedSize, int expectedInvalidatedCallCount, int expectedParentLayoutCallCount1, int expectedParentLayoutCallCount2) - { - using var oldValue = new Icon("bitmaps/10x16_one_entry_32bit.ico"); - using var parent = new StatusBar - { - ShowPanels = showPanels - }; - using var panel = new StatusBarPanel - { - AutoSize = autoSize, - Icon = oldValue - }; - parent.Panels.Add(panel); - Assert.NotEqual(IntPtr.Zero, parent.Handle); - int invalidatedCallCount = 0; - parent.Invalidated += (sender, e) => invalidatedCallCount++; - int styleChangedCallCount = 0; - parent.StyleChanged += (sender, e) => styleChangedCallCount++; - int createdCallCount = 0; - parent.HandleCreated += (sender, e) => createdCallCount++; - - int parentLayoutCallCount = 0; - void parentHandler(object sender, LayoutEventArgs e) - { - Assert.Same(parent, sender); - Assert.Null(e.AffectedControl); - Assert.Null(e.AffectedProperty); - parentLayoutCallCount++; - }; - parent.Layout += parentHandler; - - try - { - panel.Icon = value; - Assert.Equal(expectedSize, panel.Icon?.Size); - Assert.Equal(expectedParentLayoutCallCount1, parentLayoutCallCount); - Assert.True(parent.IsHandleCreated); - Assert.Equal(expectedInvalidatedCallCount, invalidatedCallCount); - Assert.Equal(0, styleChangedCallCount); - Assert.Equal(0, createdCallCount); - - // Set same. - panel.Icon = value; - Assert.Equal(expectedSize, panel.Icon?.Size); - Assert.Equal(expectedParentLayoutCallCount2, parentLayoutCallCount); - Assert.True(parent.IsHandleCreated); - Assert.Equal(expectedInvalidatedCallCount * 2, invalidatedCallCount); - Assert.Equal(0, styleChangedCallCount); - Assert.Equal(0, createdCallCount); - } - finally - { - parent.Layout -= parentHandler; - } - } - - [WinFormsFact] - public void StatusBarPanel_Icon_GetIcon_Success() - { - using var value1 = new Icon("bitmaps/10x16_one_entry_32bit.ico"); - using var value2 = new Icon("bitmaps/10x16_one_entry_32bit.ico"); - using var parent = new StatusBar - { - ShowPanels = true - }; - using var panel1 = new StatusBarPanel(); - using var panel2 = new StatusBarPanel(); - parent.Panels.Add(panel1); - parent.Panels.Add(panel2); - - // Set first. - Assert.NotEqual(IntPtr.Zero, parent.Handle); - panel1.Icon = value1; - Assert.NotEqual(IntPtr.Zero, User32.SendMessageW(parent.Handle, (User32.WM)ComCtl32.SB.GETICON, IntPtr.Zero)); - Assert.Equal(IntPtr.Zero, User32.SendMessageW(parent.Handle, (User32.WM)ComCtl32.SB.GETICON, (IntPtr)1)); - - // Set second. - Assert.NotEqual(IntPtr.Zero, parent.Handle); - panel2.Icon = value2; - Assert.NotEqual(IntPtr.Zero, User32.SendMessageW(parent.Handle, (User32.WM)ComCtl32.SB.GETICON, IntPtr.Zero)); - Assert.NotEqual(IntPtr.Zero, User32.SendMessageW(parent.Handle, (User32.WM)ComCtl32.SB.GETICON, (IntPtr)1)); - - // Set null. - Assert.NotEqual(IntPtr.Zero, parent.Handle); - panel2.Icon = null; - Assert.NotEqual(IntPtr.Zero, User32.SendMessageW(parent.Handle, (User32.WM)ComCtl32.SB.GETICON, IntPtr.Zero)); - Assert.Equal(IntPtr.Zero, User32.SendMessageW(parent.Handle, (User32.WM)ComCtl32.SB.GETICON, (IntPtr)1)); - } - - private class SubStatusBarPanel : StatusBarPanel - { - public new bool CanRaiseEvents => base.CanRaiseEvents; - - public new bool DesignMode => base.DesignMode; - - public new EventHandlerList Events => base.Events; - } - } -}