From 0caff203ea9b5bd0e71ba05f04b99772c79d6f3b Mon Sep 17 00:00:00 2001 From: Hugh Bellamy Date: Sat, 6 Apr 2019 17:39:09 +0100 Subject: [PATCH] Cleanup Form.IsRestrictedWindow --- .../src/Resources/SR.resx | 26 - .../System/Windows/Forms/wfsecurity.ico | Bin 10134 -> 0 bytes .../src/Resources/xlf/SR.cs.xlf | 44 - .../src/Resources/xlf/SR.de.xlf | 44 - .../src/Resources/xlf/SR.es.xlf | 44 - .../src/Resources/xlf/SR.fr.xlf | 44 - .../src/Resources/xlf/SR.it.xlf | 44 - .../src/Resources/xlf/SR.ja.xlf | 44 - .../src/Resources/xlf/SR.ko.xlf | 44 - .../src/Resources/xlf/SR.pl.xlf | 44 - .../src/Resources/xlf/SR.pt-BR.xlf | 44 - .../src/Resources/xlf/SR.ru.xlf | 44 - .../src/Resources/xlf/SR.tr.xlf | 44 - .../src/Resources/xlf/SR.zh-Hans.xlf | 44 - .../src/Resources/xlf/SR.zh-Hant.xlf | 44 - .../src/System.Windows.Forms.csproj | 3 - .../src/System/Windows/Forms/Form.cs | 1733 +++++------------ .../System/Windows/Forms/FxCopSuppression.cs | 306 --- .../src/System/Windows/Forms/ToolStrip.cs | 138 +- .../System/Windows/Forms/ToolStripDropDown.cs | 535 +++-- .../{ => System/Windows/Forms}/FormTests.cs | 159 +- 21 files changed, 871 insertions(+), 2601 deletions(-) delete mode 100644 src/System.Windows.Forms/src/Resources/System/Windows/Forms/wfsecurity.ico rename src/System.Windows.Forms/tests/UnitTests/{ => System/Windows/Forms}/FormTests.cs (51%) diff --git a/src/System.Windows.Forms/src/Resources/SR.resx b/src/System.Windows.Forms/src/Resources/SR.resx index 2675c0bb22c..ba88410be4b 100644 --- a/src/System.Windows.Forms/src/Resources/SR.resx +++ b/src/System.Windows.Forms/src/Resources/SR.resx @@ -5516,32 +5516,6 @@ Stack trace where the illegal operation occurred was: Gets or sets a Boolean value controlling whether the scrollbar is showing. - - Mixed Zone - - - Multiple Sites - - - Unknown Site - - - Unknown Zone - - - Microsoft .NET Security Warning - - - Never enter personal information or passwords into a window unless you can verify and trust the source of the request. - - - Source: {0} - - - {0} - -{1} - Occurs when the value of the SelectedIndex property changes. diff --git a/src/System.Windows.Forms/src/Resources/System/Windows/Forms/wfsecurity.ico b/src/System.Windows.Forms/src/Resources/System/Windows/Forms/wfsecurity.ico deleted file mode 100644 index bbffea3dde37b53a03df896846fe47a47d838cce..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10134 zcmeI2d0bTG{>L98bw+c++%oSK&0A(#ue8f;M_*yfmGb@!)6j-YQ_NJc&j@UWNUH2TO=nZQ|~PT z@7C4}p>3vH-)7{<;mr=X$o8+M4*nz6rVXsLG#4iqJG*Y|P!brzP9ZK%P9yB-p;7jC zk}^GLEqaSg7cJ!9*W1}S(cTj7BKDaw9+7k##KVnMJPt z$y%59fqGZSLzLxJuon-=%>ZZT;Sa1{y?R9^>L2hKIM6u-Damr10q5a7?wm<^nO!gE zj11@D%g*##k%5#4xP8t!BUx@8cRRh=pL)lHgy;LSzqyBMi;7a@T{P!=QXgpG?<*ig2mY)jd8q;{cgNZ>-s3vKNvyJ%a^ z2b@%Xw|UFKkppAd@SD4qamq;+)y8O{I1UmZ!flWkOB4bkyeJcefQV4aL?Iv|i84_L zh{&T%6apeZnJ5HAh_UKN;WvorOPMGHL^x6=3IP#rl!-z>gcoI^5D*bcnJ5HABvB>` z0TFqWi9$dGC=-Q%&>^$%5()tkeJK-#fCxv*L?Ix;jWSUPi14CJ6apebDHDZ&h$PBH zAs`};GEoQ!jhGK*0wS0Rvr|9dx9CfmCC3IP$0l!-z>gd1g|5D?)-nJ5HAgirj5nhyuLO?_)Wug!e zkwlp&1VrRfCJKSv2lojwG6=UAMy8TLl0pBhY@!hLGKNwn3IP#Gl!-z>L>^_L5XgOS zp9nFC=QxPxIEZICi04U}CCPU|=?o?lU@~QCuIcV@Vbc3hW$@AIv2fQ@52x#SG_q}qt_^wk3LqTGcaest^H5~{b)3<295NfSKVkjInbQVq-*a$y}@A8 zX%(qbJDC*+omSPW_9i;m>EolS)J|rNgPX-YbVF$`9q4tc>qh&3G=?|1byD>vQ>?Ce z{1+Sb1_zm+JW;()b#3vlcXP{D;~TVEEyoDVPdz!UMu}ClibkjXNFJ6N`9*tIgWj2K zz(BUYDU-Dp2PUn98XtO{S$Ug}?*MRDjLml z%Lru4;melSNAD3HZ0X^waam~V^1j}%i=lZdXh8EKR~WFIycb?7vH z(P?SX2P4A6JyicvN%-et@$Z)*I~EfUrqz!_25Wld*Y*U9x?=ikFCUvzE_Y148&_vbq0&vgo)-fmo1cyXOU{#>VUZQ;hX1^IKG z!U@ZjO-@{vrqgLm@Zk|f~qxSIe2)^015iRZicY6x7LEW0}#VUY*DF zkx_j7g-JcUPg!A+&v$?^>Y!)_Vjk_?wT`uOtPzSE!Ou|O5<8iaFRZ)bk0Sj$G zIyrD_61K6rmcIw>IraW;TcqdYXSaAxT^cxZta06>k$J1$d%ozKiH`ZcpZx1Y@B+6D zL7z=<{BF+s58m%A;?{oNHDvC%#oWknd z({A}sAN_6AvKjsER}TC9yn071of4C<#ScaKIk<8QsJ>xF)pau}Z#1B+?iMap)iIYE zoIHI7yF&dCICnzE*5$LF`EPUhWs^_)?aQZcKD;v&H*Va3sosp5t5;Ec_9Tw(41#fc z01iiQ!0~cZAywRX%JKlzKdaU#?cmyJK)5nCR(dBcRGo4xS!yFC9{ zV^G={UtXK5b#=TBmpBF&kQBES;fp54v=*ziW7ha-Uyj4c5Kq*c&uTUP4aUz5UXDX< zuOa@k_jvxNn)+S8ejR0HWhlH@0^@;11kZJiZ!K19$E@*>ZTt|KfeUe^@NARc<~#EI zvx0n({*em>#`+_i zk6nQBq^&r)(+~CaobYaIvd&~ySD44GYqc%3CcY`Cyi$V;7cPLcUl_gY69*Z)N6*FR z*>eGUb)SPry3Hh?p!dU5(YxzpJZk5LK6W3VPnQX5p81BwxRsrR)6pwXk$0?xe<{e= z7Y@ZCX|59ve(8=YB^T5_a-Oc(m)JruZ_4oUQXwxNjpG>aVN*tzTTGpeP{{X;X(F z>9f~SUU0^$Qnz`hk0a7^>iMnS)8!*to&UQ2Wj)4!a2D^loW{seC-KT_C-C=|n8&cA zcw%rm>>odZ-rc6RyiS}0vvvleB7<+C>g!s>s5f0j<%wimIe%Q8o2|;iQ^&A#<(!ML z%RU(;W6LJbzf0dBxX;SPhf{L!-h?xF`(5Vo&uqLj;sl<1Aq#__J%(OA=Bn}A&kI0% z4}WN9Z9vDFYcR#jo6nfP{gfU0>jFguUH~mzGeJQ z{bR7`iz3XPUx2Bf=Hi2o&cVg?3`YImDZKV(HePf*jvl?1s_{E42;z&bVu5wU^+% zvKXIx7Gc)Be0)6PJSI#!hcV-S!&{?Ip4V*lsI{f5W#s6LAem$ zoreg_fe1K*Hk0liUo*&vh;3B}3a^C!<}$4DEy2pKis8BJBIYeB#0-x-bm??-YZAe0qUKQuHIJZt=D<8Q=P^hTXL)ih+5=RwFE`3V|UN*tn?-U#%-ahsS?Z?Ypds!{DE* z@Yud8Ji4a>563Z&on>ejTZ#u`O75CR+mH2kjsM^?1$gk8JhXX+<22+9+73B|wu4Wg z-BX#+3`&RQ$y8{cJfPa!eYFQKr&MEDay6bzs6@XXEAhzg3fO&Ljt(*pg?Vr+Y_@Vd zqBs^?cuja++PQyu*Z8sq@0G4=;xRhC1|tt&!Al3L@oZuh1}0R&o_X}#)tJYQQr2iG zY&jlkZ7>hbCu{B+|Mq+0ZnDhr;SIlF@~^cRpIL)pAp$KyX$;V-O> z9?YY&p&Z&BWojM|a6Gg#H{752zR8$>_9|was>O#VYVqE&8jLbt!3gHzu)i8ZeyPHM z_)7F)ZFG~hA#0Sip`GJ@U*dQ3KZsQYby#}-D&{ed=_hNUJ6?--kJjL=BUj*fs2YD~ zZ9JvcXeD|#)@X-$f%hl=rbGDlQXSS_sKbhat60K3=KNNRY0P6{Rt?5v)ZmS@D|m&q zF)XPXgP2FZeHG~NdGLLS-#su55#=TXm73sJY{ECpV|jiZ7Uf*UZ00c~yB4mjjiwr9 zZ9JP;jfWP8-?#WOhwcG~(e2wqkk_M|pRCJ7bX}K#u50$e?(4nivU(RfulydJmTyO= zWijaZMbus6-|M}1Kl&xS%9smCT zS|f4a9{duv9yj^>SGJQ8>yY(bfVy8&QI3FxA6;7a!K<%ITWfslzTE!IS6IboPN@Cm z*Y|Heg`hz_n&cxXiSV7~yu)f^&BeMsv|%Q0)bW*9V>>i&9KIhj%qrp{e{Y8_ot`f3 zTO-APK5p`NnYE=Z9EYE0jIxUStx$^y?^#Es?ZbW6avijiYcWss>@iREXWaZb>iFJ4 zHo5k%Df|t!#W_v(`FZECdHzJ2C!>pfFeXjQ!LS!H(ftu0)jnls7|KqkHuXOhI3I~K zUQ}f>{p}50g>{o&`$*b%9Izeh{7W%u>UnhSvre^tcu_ExtYsRJHHCJQgF4n6Pl~0USNB3+0DmQJNA9Y5PN% zKQ>JprT!y@wATzuLwl~(Y@EC@D6*cFY8wN>J^%aoh1zjy=cZ-`dO4?#uVn$ zacSf|+4qh-iTLsc73n98eq=s&T<1vt&0|^jty`&=_EsJVKaQS3>F5!Vif$Vd@36o9 p-0wxU#)9pBG^qblC4@TZíská svislý posuvník pro tento ovládací prvek ScrollableControl. - - Mixed Zone - Smíšená zóna - - - - Multiple Sites - Několik serverů - - - - Unknown Site - Neznámý server - - - - Unknown Zone - Neznámá zóna - - - - Microsoft .NET Security Warning - Upozornění zabezpečení Microsoft .NET - - - - Never enter personal information or passwords into a window unless you can verify and trust the source of the request. - Nikdy do okna nezadávejte osobní informace nebo hesla, pokud nelze ověřit zdroj požadavku a považovat ho za důvěryhodný. - - - - Source: {0} - Zdroj: {0} - - - - {0} - -{1} - {0} - -{1} - - SelTabCount out of range. Hodnota SelTabCount je mimo rozsah. 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 4f0c60de06c..aaaa0c4d134 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.de.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.de.xlf @@ -9201,50 +9201,6 @@ Stapelüberwachung, in der der unzulässige Vorgang auftrat: Ruft die vertikale Schiebeleiste für diese ScrollableControl ab. - - Mixed Zone - Gemischte Zone - - - - Multiple Sites - Mehrere Sites - - - - Unknown Site - Unbekannte Site. - - - - Unknown Zone - Unbekannte Zone. - - - - Microsoft .NET Security Warning - Microsoft .NET-Sicherheitswarnung - - - - Never enter personal information or passwords into a window unless you can verify and trust the source of the request. - Geben Sie nie persönliche Informationen oder Kennwörter in ein Fenster ein, außer Sie können die Quelle der Anforderung überprüfen und dieser vertrauen. - - - - Source: {0} - Quelle: {0} - - - - {0} - -{1} - {0} - -{1} - - SelTabCount out of range. SelTabCount liegt außerhalb des definierten Bereichs. 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 e229b441bc7..0cdbd4e4e81 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.es.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.es.xlf @@ -9201,50 +9201,6 @@ El seguimiento de la pila donde tuvo lugar la operación no válida fue: Obtiene la barra de desplazamiento vertical para este ScrollableControl. - - Mixed Zone - Zona mixta - - - - Multiple Sites - Varios sitios - - - - Unknown Site - Sitio desconocido - - - - Unknown Zone - Zona desconocida - - - - Microsoft .NET Security Warning - Advertencia de seguridad Microsoft .NET - - - - Never enter personal information or passwords into a window unless you can verify and trust the source of the request. - No proporcione información ni contraseñas personales en una ventana a menos que pueda comprobar y confiar en el origen de la solicitud. - - - - Source: {0} - Origen: {0} - - - - {0} - -{1} - {0} - -{1} - - SelTabCount out of range. SelTabCount fuera del intervalo. 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 57f6332ecd9..455db12cfb8 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.fr.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.fr.xlf @@ -9201,50 +9201,6 @@ Cette opération non conforme s'est produite sur la trace de la pile : Obtient la barre de défilement verticale pour ce ScrollableControl. - - Mixed Zone - Zone mixte - - - - Multiple Sites - Plusieurs sites - - - - Unknown Site - Site inconnu - - - - Unknown Zone - Zone inconnue - - - - Microsoft .NET Security Warning - Avertissement de sécurité Microsoft .NET - - - - Never enter personal information or passwords into a window unless you can verify and trust the source of the request. - N'entrez jamais d'informations personnelles ou de mot de passe dans une fenêtre sauf si vous pouvez vérifier et faire confiance à la source de la demande. - - - - Source: {0} - Source : {0} - - - - {0} - -{1} - {0} - -{1} - - SelTabCount out of range. SelTabCount hors limites. 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 7a3eecadc9f..63af9123439 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.it.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.it.xlf @@ -9201,50 +9201,6 @@ Traccia dello stack da cui si è verificata l'operazione non valida: Ottiene la barra di scorrimento verticale per ScrollableControl corrente. - - Mixed Zone - Zona mista - - - - Multiple Sites - Più siti - - - - Unknown Site - Sito sconosciuto - - - - Unknown Zone - Zona sconosciuta - - - - Microsoft .NET Security Warning - Microsoft .NET - Avviso di sicurezza - - - - Never enter personal information or passwords into a window unless you can verify and trust the source of the request. - Non inserire informazioni personali né password in una finestra a meno che non si possa verificare e considerare attendibile l'origine della richiesta. - - - - Source: {0} - Origine: {0} - - - - {0} - -{1} - {0} - -{1} - - SelTabCount out of range. SelTabCount non compreso nell'intervallo. 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 bb5ef565e5d..dd95ed041d5 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.ja.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.ja.xlf @@ -9201,50 +9201,6 @@ Stack trace where the illegal operation occurred was: この ScrollableControl に垂直スクロール バーを取得します。 - - Mixed Zone - 混合ゾーン - - - - Multiple Sites - 複数のサイト - - - - Unknown Site - 不明なサイト - - - - Unknown Zone - 不明なゾーン - - - - Microsoft .NET Security Warning - Microsoft .NET セキュリティ警告 - - - - Never enter personal information or passwords into a window unless you can verify and trust the source of the request. - 要求元を検証および信頼できない場合、個人情報またはパスワードをウィンドウに入力しないでください。 - - - - Source: {0} - ソース: {0} - - - - {0} - -{1} - {0} - -{1} - - SelTabCount out of range. SelTabCount が範囲外です。 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 563ca4d4de6..7e551577175 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.ko.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.ko.xlf @@ -9201,50 +9201,6 @@ Stack trace where the illegal operation occurred was: 이 ScrollableControl의 세로 스크롤 막대를 가져옵니다. - - Mixed Zone - 혼합 영역입니다. - - - - Multiple Sites - 사이트가 여러 개입니다. - - - - Unknown Site - 알 수 없는 사이트입니다. - - - - Unknown Zone - 알 수 없는 영역입니다. - - - - Microsoft .NET Security Warning - Microsoft .NET 보안 경고 - - - - Never enter personal information or passwords into a window unless you can verify and trust the source of the request. - 요청의 소스를 확인하거나 신뢰할 수 있는 경우가 아니라면 창에 개인 정보 또는 암호를 입력하지 않는 것이 좋습니다. - - - - Source: {0} - 소스: {0} - - - - {0} - -{1} - {0} - -{1} - - SelTabCount out of range. SelTabCount가 범위를 벗어났습니다. 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 f4c3e468bb9..ed45073a940 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.pl.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.pl.xlf @@ -9201,50 +9201,6 @@ Stos śledzenia, w którym wystąpiła zabroniona operacja: Pobiera pionowy pasek przewijania dla tego elementu ScrollableControl. - - Mixed Zone - Strefa mieszana - - - - Multiple Sites - Wiele witryn - - - - Unknown Site - Nieznana witryna - - - - Unknown Zone - Nieznana strefa - - - - Microsoft .NET Security Warning - Ostrzeżenie zabezpieczeń Microsoft .NET - - - - Never enter personal information or passwords into a window unless you can verify and trust the source of the request. - Nigdy nie podawaj informacji osobistych ani haseł w oknach, jeśli nie możesz sprawdzić źródła żądania i zaufać mu. - - - - Source: {0} - Źródło: {0} - - - - {0} - -{1} - {0} - -{1} - - SelTabCount out of range. Wartość elementu SelTabCount poza zakresem. 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 ed059a5c981..a5f325f194a 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 @@ -9201,50 +9201,6 @@ Rastreamento de pilha em que a operação ilegal ocorreu: Obtém a barra de rolagem vertical para ScrollableControl. - - Mixed Zone - Zona Mista - - - - Multiple Sites - Vários Sites - - - - Unknown Site - Site Desconhecido - - - - Unknown Zone - Zona Desconhecida - - - - Microsoft .NET Security Warning - Aviso de Segurança do Microsoft .NET - - - - Never enter personal information or passwords into a window unless you can verify and trust the source of the request. - Nunca insira informações pessoais ou senhas em uma janela, a menos que possa verificar e confiar na fonte da solicitação. - - - - Source: {0} - Origem: {0} - - - - {0} - -{1} - {0} - -{1} - - SelTabCount out of range. SelTabCount fora do intervalo. 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 9c48c130d79..0fc484890c7 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.ru.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.ru.xlf @@ -9202,50 +9202,6 @@ Stack trace where the illegal operation occurred was: Получает вертикальную полосу прокрутки для данного ScrollableControl. - - Mixed Zone - Смешанная зона - - - - Multiple Sites - Несколько сайтов - - - - Unknown Site - Неизвестный сайт - - - - Unknown Zone - Неизвестная зона - - - - Microsoft .NET Security Warning - Информация о безопасности Microsoft .NET - - - - Never enter personal information or passwords into a window unless you can verify and trust the source of the request. - Никогда не вводите личные данные или пароли в окна, если вы не проверили источник запроса и не можете ему доверять. - - - - Source: {0} - Источник: {0} - - - - {0} - -{1} - {0} - -{1} - - SelTabCount out of range. SelTabCount вне допустимого диапазона. 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 715927f790e..04fc0e09905 100644 --- a/src/System.Windows.Forms/src/Resources/xlf/SR.tr.xlf +++ b/src/System.Windows.Forms/src/Resources/xlf/SR.tr.xlf @@ -9201,50 +9201,6 @@ Geçersiz işlemin gerçekleştiği yığın izi: Bu ScrollableControl için dikey kaydırma çubuğunu alır. - - Mixed Zone - Karışık Bölge - - - - Multiple Sites - Birden Çok Site - - - - Unknown Site - Bilinmeyen Site - - - - Unknown Zone - Bilinmeyen Bölge - - - - Microsoft .NET Security Warning - Microsoft .NET Güvenlik Uyarısı - - - - Never enter personal information or passwords into a window unless you can verify and trust the source of the request. - İstek kaynağını doğrulayamıyor ve güvenmiyorsanız bir pencereye kişisel bilgiler veya parolalar girmeyin. - - - - Source: {0} - Kaynak: {0} - - - - {0} - -{1} - {0} - -{1} - - SelTabCount out of range. SelTabCount aralık dışında. 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 12463af6401..77aba2465ec 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 @@ -9201,50 +9201,6 @@ Stack trace where the illegal operation occurred was: 获取此 ScrollableControl 的垂直滚动条。 - - Mixed Zone - 混合区域 - - - - Multiple Sites - 多个站点 - - - - Unknown Site - 未知站点 - - - - Unknown Zone - 未知区域 - - - - Microsoft .NET Security Warning - Microsoft .NET 安全警告 - - - - Never enter personal information or passwords into a window unless you can verify and trust the source of the request. - 除非您能够验证并信任请求的来源,否则,切勿在窗口中输入个人信息或密码。 - - - - Source: {0} - 源: {0} - - - - {0} - -{1} - {0} - -{1} - - SelTabCount out of range. SelTabCount 超出范围。 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 e9ef0335039..4d358571049 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 @@ -9201,50 +9201,6 @@ Stack trace where the illegal operation occurred was: 取得此 ScrollableControl 的垂直捲軸。 - - Mixed Zone - 混合區域 - - - - Multiple Sites - 多站台 - - - - Unknown Site - 不明站台 - - - - Unknown Zone - 不明區域 - - - - Microsoft .NET Security Warning - Microsoft .NET 安全性警告 - - - - Never enter personal information or passwords into a window unless you can verify and trust the source of the request. - 除非您可以驗證並信任要求的來源,否則絕對不要在視窗中輸入個人資訊或密碼。 - - - - Source: {0} - 來源: {0} - - - - {0} - -{1} - {0} - -{1} - - SelTabCount out of range. SelTabCount 超出範圍。 diff --git a/src/System.Windows.Forms/src/System.Windows.Forms.csproj b/src/System.Windows.Forms/src/System.Windows.Forms.csproj index a84db31c254..1f12ea7c3c0 100644 --- a/src/System.Windows.Forms/src/System.Windows.Forms.csproj +++ b/src/System.Windows.Forms/src/System.Windows.Forms.csproj @@ -421,9 +421,6 @@ System.Windows.Forms.wfc.ico - - System.Windows.Forms.wfsecurity.ico - System.Windows.Forms.Timer.bmp diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Form.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Form.cs index 49e4f511e06..a3b76e805b9 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Form.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Form.cs @@ -21,8 +21,6 @@ namespace System.Windows.Forms { using System.Runtime.Serialization.Formatters; using System.Runtime.Remoting; using System.Runtime.InteropServices; - using System.Security; - using System.Security.Policy; using System.Threading; using System.Windows.Forms.Design; using System.Windows.Forms.Layout; @@ -91,20 +89,12 @@ public class Form : ContainerControl { private static readonly BitVector32.Section FormStateMdiChildMax = BitVector32.CreateSection(1, FormStateSWCalled); private static readonly BitVector32.Section FormStateRenderSizeGrip = BitVector32.CreateSection(1, FormStateMdiChildMax); private static readonly BitVector32.Section FormStateSizeGripStyle = BitVector32.CreateSection(2, FormStateRenderSizeGrip); - private static readonly BitVector32.Section FormStateIsRestrictedWindow = BitVector32.CreateSection(1, FormStateSizeGripStyle); - private static readonly BitVector32.Section FormStateIsRestrictedWindowChecked = BitVector32.CreateSection(1, FormStateIsRestrictedWindow); - private static readonly BitVector32.Section FormStateIsWindowActivated = BitVector32.CreateSection(1, FormStateIsRestrictedWindowChecked); + private static readonly BitVector32.Section FormStateIsWindowActivated = BitVector32.CreateSection(1, FormStateSizeGripStyle); private static readonly BitVector32.Section FormStateIsTextEmpty = BitVector32.CreateSection(1, FormStateIsWindowActivated); private static readonly BitVector32.Section FormStateIsActive = BitVector32.CreateSection(1, FormStateIsTextEmpty); private static readonly BitVector32.Section FormStateIconSet = BitVector32.CreateSection(1, FormStateIsActive); -#if SECURITY_DIALOG - private static readonly BitVector32.Section FormStateAddedSecurityMenuItem = BitVector32.CreateSection(1, FormStateIconSet); -#endif - - // // The following flags should be used with formStateEx[...] not formState[..] - // private static readonly BitVector32.Section FormStateExCalledClosing = BitVector32.CreateSection(1); private static readonly BitVector32.Section FormStateExUpdateMenuHandlesSuspendCount = BitVector32.CreateSection(8, FormStateExCalledClosing); private static readonly BitVector32.Section FormStateExUpdateMenuHandlesDeferred = BitVector32.CreateSection(1, FormStateExUpdateMenuHandlesSuspendCount); @@ -126,7 +116,6 @@ public class Form : ContainerControl { private const int SizeGripSize = 16; private static Icon defaultIcon = null; - private static Icon defaultRestrictedIcon = null; #if MAGIC_PADDING private static Padding FormPadding = new Padding(9); // UI guideline #endif @@ -164,24 +153,12 @@ public class Form : ContainerControl { private static readonly int PropMainMenuStrip = PropertyStore.CreateKey(); private static readonly int PropMdiWindowListStrip = PropertyStore.CreateKey(); private static readonly int PropMdiControlStrip = PropertyStore.CreateKey(); - private static readonly int PropSecurityTip = PropertyStore.CreateKey(); private static readonly int PropOpacity = PropertyStore.CreateKey(); private static readonly int PropTransparencyKey = PropertyStore.CreateKey(); -#if SECURITY_DIALOG - private static readonly int PropSecuritySystemMenuItem = PropertyStore.CreateKey(); -#endif - /////////////////////////////////////////////////////////////////////// // Form per instance members - // // Note: Do not add anything to this list unless absolutely neccessary. - // - // Begin Members { - - // List of properties that are generally set, so we keep them directly on - // Form. - // private BitVector32 formState = new BitVector32(0x21338); // magic value... all the defaults... see the ctor for details... private BitVector32 formStateEx = new BitVector32(); @@ -196,40 +173,23 @@ public class Form : ContainerControl { private DialogResult dialogResult; private MdiClient ctlClient; private NativeWindow ownerWindow; - private string userWindowText; // Used to cache user's text in semi-trust since the window text is added security info. - private string securityZone; - private string securitySite; private bool rightToLeftLayout = false; - - //Whidbey RestoreBounds ... private Rectangle restoreBounds = new Rectangle(-1, -1, -1, -1); private CloseReason closeReason = CloseReason.None; private VisualStyleRenderer sizeGripRenderer; - // } End Members - /////////////////////////////////////////////////////////////////////// - - - /// /// - /// - /// Initializes a new instance of the class. - /// + /// Initializes a new instance of the class. /// - public Form() - : base() { - - // we must setup the formState *before* calling Control's ctor... so we do that - // at the member variable... that magic number is generated by switching - // the line below to "true" and running a form. - // - // keep the "init" and "assert" sections always in sync! - // + public Form() : base() + { + // The magic number formState is generated by switching the line below to "true" + // and running a form. + // Keep the "init" and "assert" sections always in sync! #if false - // init section... - // + // Init section. formState[FormStateAllowTransparency] = 0; formState[FormStateBorderStyle] = (int)FormBorderStyle.Sizable; formState[FormStateTaskBar] = 1; @@ -249,25 +209,14 @@ public Form() formState[FormStateMdiChildMax] = 0; formState[FormStateRenderSizeGrip] = 0; formState[FormStateSizeGripStyle] = 0; - formState[FormStateIsRestrictedWindow] = 0; - formState[FormStateIsRestrictedWindowChecked] = 0; formState[FormStateIsWindowActivated] = 0; formState[FormStateIsTextEmpty] = 0; formState[FormStateIsActive] = 0; formState[FormStateIconSet] = 0; - -#if SECURITY_DIALOG - formState[FormStateAddedSecurityMenuItem] = 0; - -#endif - - - - Debug.WriteLine("initial formState: 0x" + formState.Data.ToString("X")); #endif - // assert section... - // + + // Assert section. Debug.Assert(formState[FormStateAllowTransparency] == 0, "Failed to set formState[FormStateAllowTransparency]"); Debug.Assert(formState[FormStateBorderStyle] == (int)FormBorderStyle.Sizable, "Failed to set formState[FormStateBorderStyle]"); Debug.Assert(formState[FormStateTaskBar] == 1, "Failed to set formState[FormStateTaskBar]"); @@ -287,26 +236,11 @@ public Form() Debug.Assert(formState[FormStateMdiChildMax] == 0, "Failed to set formState[FormStateMdiChildMax]"); Debug.Assert(formState[FormStateRenderSizeGrip] == 0, "Failed to set formState[FormStateRenderSizeGrip]"); Debug.Assert(formState[FormStateSizeGripStyle] == 0, "Failed to set formState[FormStateSizeGripStyle]"); - // can't check these... Control::.ctor may force the check - // of security... you can only assert these are 0 when running - // under full trust... - // - //Debug.Assert(formState[FormStateIsRestrictedWindow] == 0, "Failed to set formState[FormStateIsRestrictedWindow]"); - //Debug.Assert(formState[FormStateIsRestrictedWindowChecked] == 0, "Failed to set formState[FormStateIsRestrictedWindowChecked]"); Debug.Assert(formState[FormStateIsWindowActivated] == 0, "Failed to set formState[FormStateIsWindowActivated]"); Debug.Assert(formState[FormStateIsTextEmpty] == 0, "Failed to set formState[FormStateIsTextEmpty]"); Debug.Assert(formState[FormStateIsActive] == 0, "Failed to set formState[FormStateIsActive]"); Debug.Assert(formState[FormStateIconSet] == 0, "Failed to set formState[FormStateIconSet]"); - -#if SECURITY_DIALOG - Debug.Assert(formState[FormStateAddedSecurityMenuItem] == 0, "Failed to set formState[FormStateAddedSecurityMenuItem]"); -#endif - - // SECURITY NOTE: The IsRestrictedWindow check is done once and cached. We force it to happen here - // since we want to ensure the check is done on the code that constructs the form. - bool temp = IsRestrictedWindow; - formStateEx[FormStateExShowIcon] = 1; SetState(STATE_VISIBLE, false); @@ -357,58 +291,56 @@ public IButtonControl AcceptButton { } /// - /// Retrieves true if this form is currently active. + /// Retrieves true if this form is currently active. /// - internal bool Active { - get { + internal bool Active + { + get + { Form parentForm = ParentFormInternal; - if (parentForm == null) { + if (parentForm == null) + { return formState[FormStateIsActive] != 0; } - return(parentForm.ActiveControl == this && parentForm.Active); - } - set { + return parentForm.ActiveControl == this && parentForm.Active; + } + set + { Debug.WriteLineIf(Control.FocusTracing.TraceVerbose, "Form::set_Active - " + this.Name); - if ((formState[FormStateIsActive] != 0) != value) { - if (value) { - // There is a weird user32 - - - - if (!CanRecreateHandle()){ - //Debug.Fail("Setting Active window when not yet visible"); + if ((formState[FormStateIsActive] != 0) != value) + { + if (value) + { + if (!CanRecreateHandle()) + { return; } } formState[FormStateIsActive] = value ? 1 : 0; - if (value) { + if (value) + { formState[FormStateIsWindowActivated] = 1; - if (IsRestrictedWindow) { - WindowText = userWindowText; - } + // Check if validation has been cancelled to avoid raising Validation event multiple times. - if (!ValidationCancelled) { - if( ActiveControl == null ) { - // Security reviewed : This internal method is called from various places, all - // of which are OK. Since SelectNextControl (a public function) - // Demands ModifyFocus, we must call the internal version. - // - SelectNextControlInternal(null, true, true, true, false); + if (!ValidationCancelled) + { + if (ActiveControl == null) + { // If no control is selected focus will go to form + SelectNextControlInternal(null, true, true, true, false); } InnerMostActiveContainerControl.FocusActiveControlInternal(); } + OnActivated(EventArgs.Empty); - } - else { + } + else + { formState[FormStateIsWindowActivated] = 0; - if (IsRestrictedWindow) { - Text = userWindowText; - } OnDeactivate(EventArgs.Empty); } } @@ -802,63 +734,26 @@ private bool CalledOnLoad { } } - - /// /// - /// - /// Gets or sets the border style of the form. - /// + /// Gets or sets the border style of the form. /// - [ - SRCategory(nameof(SR.CatAppearance)), - DefaultValue(FormBorderStyle.Sizable), - DispId(NativeMethods.ActiveX.DISPID_BORDERSTYLE), - SRDescription(nameof(SR.FormBorderStyleDescr)) - ] - public FormBorderStyle FormBorderStyle { - get { - return(FormBorderStyle)formState[FormStateBorderStyle]; - } - - set { - //validate FormBorderStyle enum - // - //valid values are 0x0 to 0x6 + [SRCategory(nameof(SR.CatAppearance))] + [DefaultValue(FormBorderStyle.Sizable)] + [DispId(NativeMethods.ActiveX.DISPID_BORDERSTYLE)] + [SRDescription(nameof(SR.FormBorderStyleDescr))] + public FormBorderStyle FormBorderStyle + { + get => (FormBorderStyle)formState[FormStateBorderStyle]; + set + { if (!ClientUtils.IsEnumValid(value, (int)value, (int)FormBorderStyle.None, (int)FormBorderStyle.SizableToolWindow)) { throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(FormBorderStyle)); } - // In rectricted mode we don't allow windows w/o min/max/close functionality. - if (IsRestrictedWindow) { - switch (value) { - case FormBorderStyle.None: - value = FormBorderStyle.FixedSingle; - break; - case FormBorderStyle.FixedSingle: - case FormBorderStyle.Fixed3D: - case FormBorderStyle.FixedDialog: - case FormBorderStyle.Sizable: - // nothing needed here, we can just let these stay - // - break; - case FormBorderStyle.FixedToolWindow: - value = FormBorderStyle.FixedSingle; - break; - case FormBorderStyle.SizableToolWindow: - value = FormBorderStyle.Sizable; - break; - default: - value = FormBorderStyle.Sizable; - break; - } - } - formState[FormStateBorderStyle] = (int)value; - - //( - - if (formState[FormStateSetClientSize] == 1 && !IsHandleCreated) { + if (formState[FormStateSetClientSize] == 1 && !IsHandleCreated) + { ClientSize = ClientSize; } @@ -870,7 +765,7 @@ public FormBorderStyle FormBorderStyle { // these existing values from being lost. Then, if the WindowState is something other than // FormWindowState.Normal after the call to UpdateFormStyles(), restore these cached values to // the restoredWindowBounds field. - Rectangle preClientUpdateRestoredWindowBounds = restoredWindowBounds; + Rectangle preClientUpdateRestoredWindowBounds = restoredWindowBounds; BoundsSpecified preClientUpdateRestoredWindowBoundsSpecified = restoredWindowBoundsSpecified; int preWindowBoundsWidthIsClientSize = formStateEx[FormStateExWindowBoundsWidthIsClientSize]; int preWindowBoundsHeightIsClientSize = formStateEx[FormStateExWindowBoundsHeightIsClientSize]; @@ -880,12 +775,14 @@ public FormBorderStyle FormBorderStyle { // In Windows XP Theme, the FixedDialog tend to have a small Icon. // So to make this behave uniformly with other styles, we need to make // the call to UpdateIcon after the the form styles have been updated. - if (formState[FormStateIconSet] == 0 && !IsRestrictedWindow) { + if (formState[FormStateIconSet] == 0) + { UpdateWindowIcon(false); } // Now restore the values cached above. - if (WindowState != FormWindowState.Normal) { + if (WindowState != FormWindowState.Normal) + { restoredWindowBounds = preClientUpdateRestoredWindowBounds; restoredWindowBoundsSpecified = preClientUpdateRestoredWindowBoundsSpecified; formStateEx[FormStateExWindowBoundsWidthIsClientSize] = preWindowBoundsWidthIsClientSize; @@ -937,33 +834,19 @@ public IButtonControl CancelButton { } } - /// /// - /// Gets or sets a value indicating whether a control box is displayed in the - /// caption bar of the form. + /// Gets or sets a value indicating whether a control box is displayed in the + /// caption bar of the form. /// - [ - SRCategory(nameof(SR.CatWindowStyle)), - DefaultValue(true), - SRDescription(nameof(SR.FormControlBoxDescr)) - ] - public bool ControlBox { - get { - return formState[FormStateControlBox] != 0; - } - - set { - // Window style in restricted mode must always have a control box. - if (IsRestrictedWindow) { - return; - } - - if (value) { - formState[FormStateControlBox] = 1; - } - else { - formState[FormStateControlBox] = 0; - } + [SRCategory(nameof(SR.CatWindowStyle))] + [DefaultValue(true)] + [SRDescription(nameof(SR.FormControlBoxDescr))] + public bool ControlBox + { + get => formState[FormStateControlBox] != 0; + set + { + formState[FormStateControlBox] = value ? 1 : 0; UpdateFormStyles(); } } @@ -1052,10 +935,6 @@ protected override CreateParams CreateParams { } } - if (IsRestrictedWindow) { - cp.Caption = RestrictedWindowText(cp.Caption); - } - if (RightToLeft == RightToLeft.Yes && RightToLeftLayout == true) { //We want to turn on mirroring for Form explicitly. cp.ExStyle |= NativeMethods.WS_EX_LAYOUTRTL | NativeMethods.WS_EX_NOINHERITLAYOUT; @@ -1098,33 +977,6 @@ protected override ImeMode DefaultImeMode { } } - /// - /// The default icon used by the Form. This is the standard "windows forms" icon. - /// - private static Icon DefaultRestrictedIcon { - get { - // Note: We do this as a static property to allow delay - // loading of the resource. There are some issues with doing - // an OleInitialize from a static constructor... - // - - // Avoid locking if the value is filled in... - // - if (defaultRestrictedIcon == null) { - lock (internalSyncObject) - { - // Once we grab the lock, we re-check the value to avoid a - // race condition. - // - if (defaultRestrictedIcon == null) { - defaultRestrictedIcon = new Icon(typeof(Form), "wfsecurity.ico"); - } - } - } - return defaultRestrictedIcon; - } - } - /// /// /// Deriving classes can override this to configure a default size for their control. @@ -1269,49 +1121,41 @@ public event CancelEventHandler HelpButtonClicked { } } - /// /// - /// - /// Gets or sets the icon for the form. - /// + /// Gets or sets the icon for the form. /// - [ - AmbientValue(null), - Localizable(true), - SRCategory(nameof(SR.CatWindowStyle)), - SRDescription(nameof(SR.FormIconDescr)) - ] - public Icon Icon { - get { - if (formState[FormStateIconSet] == 0) { - // In restricted mode, the security icon cannot be changed. - if (IsRestrictedWindow) { - return DefaultRestrictedIcon; - } - else { - return DefaultIcon; - } + [AmbientValue(null)] + [Localizable(true)] + [SRCategory(nameof(SR.CatWindowStyle))] + [SRDescription(nameof(SR.FormIconDescr))] + public Icon Icon + { + get + { + if (formState[FormStateIconSet] == 0) + { + return DefaultIcon; } return icon; } - - set { - if (icon != value && !IsRestrictedWindow) { - - // If the user is poking the default back in, - // treat this as a null (reset). - // - if (value == defaultIcon) { + set + { + if (icon != value) + { + // If the user is setting the default back in, treat this + // as a reset. + if (value == defaultIcon) + { value = null; } - // And if null is passed, reset the icon. - // - formState[FormStateIconSet] = (value == null ? 0 : 1); - this.icon = value; + // If null is passed, reset the icon. + formState[FormStateIconSet] = value == null ? 0 : 1; + icon = value; - if (smallIcon != null) { + if (smallIcon != null) + { smallIcon.Dispose(); smallIcon = null; } @@ -1415,32 +1259,13 @@ public bool IsMdiContainer { } } - /// - /// /// - /// Determines if this form should display a warning banner - /// when the form is displayed in an unsecure mode. + /// Determines if this form should display a warning banner when the form is + /// displayed in an unsecure mode. /// - [Browsable(false), EditorBrowsable(EditorBrowsableState.Advanced)] - public bool IsRestrictedWindow { - get { - /// - if (formState[FormStateIsRestrictedWindowChecked] == 0) { - formState[FormStateIsRestrictedWindow] = 0; -#if DEBUG - if (AlwaysRestrictWindows.Enabled) { - formState[FormStateIsRestrictedWindow] = 1; - formState[FormStateIsRestrictedWindowChecked] = 1; - return true; - } -#endif - - formState[FormStateIsRestrictedWindowChecked] = 1; - } - - return formState[FormStateIsRestrictedWindow] != 0; - } - } + [Browsable(false)] + [EditorBrowsable(EditorBrowsableState.Advanced)] + public bool IsRestrictedWindow => false; /// /// @@ -1673,62 +1498,63 @@ public MainMenu Menu { } } - /// /// - /// - /// Gets the minimum size the form can be resized to. - /// + /// Gets the minimum size the form can be resized to. /// - [ - SRCategory(nameof(SR.CatLayout)), - Localizable(true), - SRDescription(nameof(SR.FormMinimumSizeDescr)), - RefreshProperties(RefreshProperties.Repaint), - ] - public override Size MinimumSize { - get { - if (Properties.ContainsInteger(PropMinTrackSizeWidth)) { + [SRCategory(nameof(SR.CatLayout))] + [Localizable(true)] + [SRDescription(nameof(SR.FormMinimumSizeDescr))] + [RefreshProperties(RefreshProperties.Repaint)] + public override Size MinimumSize + { + get + { + if (Properties.ContainsInteger(PropMinTrackSizeWidth)) + { return new Size(Properties.GetInteger(PropMinTrackSizeWidth), Properties.GetInteger(PropMinTrackSizeHeight)); } + return DefaultMinimumSize; } - set { - if (!value.Equals( MinimumSize )) { - - if (value.Width < 0 || value.Height < 0 ) { + set + { + if (!value.Equals(MinimumSize)) + { + if (value.Width < 0 || value.Height < 0) + { throw new ArgumentOutOfRangeException(nameof(MinimumSize)); } - // ensure that the size we've applied fits into the screen - // when IsRestrictedWindow. Rectangle bounds = this.Bounds; - bounds.Size = value; + bounds.Size = value; value = WindowsFormsUtils.ConstrainToScreenWorkingAreaBounds(bounds).Size; Properties.SetInteger(PropMinTrackSizeWidth, value.Width); Properties.SetInteger(PropMinTrackSizeHeight, value.Height); // Bump maximum size if necessary - // - if (!MaximumSize.IsEmpty && !value.IsEmpty) { - - if (Properties.GetInteger(PropMaxTrackSizeWidth) < value.Width) { + if (!MaximumSize.IsEmpty && !value.IsEmpty) + { + if (Properties.GetInteger(PropMaxTrackSizeWidth) < value.Width) + { Properties.SetInteger(PropMaxTrackSizeWidth, value.Width); } - if (Properties.GetInteger(PropMaxTrackSizeHeight) < value.Height) { + if (Properties.GetInteger(PropMaxTrackSizeHeight) < value.Height) + { Properties.SetInteger(PropMaxTrackSizeHeight, value.Height); } } // Keep form size within new limits - // Size size = Size; - if (size.Width < value.Width || size.Height < value.Height) { + if (size.Width < value.Width || size.Height < value.Height) + { Size = new Size(Math.Max(size.Width, value.Width), Math.Max(size.Height, value.Height)); } - if (IsHandleCreated) { + if (IsHandleCreated) + { // "Move" the form to the same size and position to prevent windows from moving it // when the user tries to grab a resizing border. SafeNativeMethods.SetWindowPos(new HandleRef(this, Handle), NativeMethods.NullHandleRef, @@ -1839,41 +1665,47 @@ public Form MdiParent { } } - private Form MdiParentInternal { - get { - return (Form)Properties.GetObject(PropFormMdiParent); - } - set { + private Form MdiParentInternal + { + get => (Form)Properties.GetObject(PropFormMdiParent); + set + { Form formMdiParent = (Form)Properties.GetObject(PropFormMdiParent); - if (value == formMdiParent && (value != null || ParentInternal == null)) { + if (value == formMdiParent && (value != null || ParentInternal == null)) + { return; } - if (value != null && this.CreateThreadId != value.CreateThreadId) { - throw new ArgumentException(SR.AddDifferentThreads, "value"); + if (value != null && CreateThreadId != value.CreateThreadId) + { + throw new ArgumentException(SR.AddDifferentThreads, nameof(value)); } bool oldVisibleBit = GetState(STATE_VISIBLE); - // Visible = false; - try { - if (value == null) { + try + { + if (value == null) + { ParentInternal = null; - // Not calling SetTopLevelInternal so that IntSecurity.TopLevelWindow.Demand() isn't skipped. SetTopLevel(true); } - else { - if (IsMdiContainer) { - throw new ArgumentException(SR.FormMDIParentAndChild, "value"); + else + { + if (IsMdiContainer) + { + throw new ArgumentException(SR.FormMDIParentAndChild, nameof(value)); } - if (!value.IsMdiContainer) { - throw new ArgumentException(SR.MDIParentNotContainer, "value"); + if (!value.IsMdiContainer) + { + throw new ArgumentException(SR.MDIParentNotContainer, nameof(value)); } // Setting TopLevel forces a handle recreate before Parent is set, - // which causes problems because we try to assign an MDI child to the parking window, - // which can't take MDI children. So we explicitly destroy and create the handle here. + // which causes problems because we try to assign an MDI child to the + // parking window, which can't take MDI children. We explicitly destroy + // and create the handle here. Dock = DockStyle.None; Properties.SetObject(PropFormMdiParent, value); @@ -1886,15 +1718,18 @@ private Form MdiParentInternal { // when MdiChild's visibility is set to true (see // But if the handle has already been created, we need to destroy it - // so the form gets MDI-parented properly. See - if (ParentInternal.IsHandleCreated && IsMdiChild && IsHandleCreated) { + // so the form gets MDI-parented properly. + if (ParentInternal.IsHandleCreated && IsMdiChild && IsHandleCreated) + { DestroyHandle(); } } + InvalidateMergedMenu(); UpdateMenuHandles(); } - finally { + finally + { UpdateStyles(); Visible = oldVisibleBit; } @@ -1997,38 +1832,34 @@ public bool Modal { } } - /// /// - /// Determines the opacity of the form. This can only be set on top level - /// controls. Opacity requires Windows 2000 or later, and is ignored on earlier - /// operating systems. + /// Determines the opacity of the form. This can only be set on top level controls. + /// Opacity requires Windows 2000 or later, and is ignored on earlier operating systems. /// - [ - SRCategory(nameof(SR.CatWindowStyle)), - TypeConverterAttribute(typeof(OpacityConverter)), - SRDescription(nameof(SR.FormOpacityDescr)), - DefaultValue(1.0) - ] - public double Opacity { - get { + [SRCategory(nameof(SR.CatWindowStyle))] + [TypeConverterAttribute(typeof(OpacityConverter))] + [SRDescription(nameof(SR.FormOpacityDescr))] + [DefaultValue(1.0)] + public double Opacity + { + get + { object opacity = Properties.GetObject(PropOpacity); - if (opacity != null) { + if (opacity != null) + { return Convert.ToDouble(opacity, CultureInfo.InvariantCulture); } - else { - return 1.0f; - } + + return 1.0f; } - set { - // In restricted mode a form cannot be made less visible than 50% opacity. - if (IsRestrictedWindow) { - value = Math.Max(value, .50f); - } - - if (value > 1.0) { + set + { + if (value > 1.0) + { value = 1.0f; } - else if (value < 0.0) { + else if (value < 0.0) + { value = 0.0f; } @@ -2039,19 +1870,24 @@ public double Opacity { if (OpacityAsByte < 255 && OSFeature.Feature.IsPresent(OSFeature.LayeredWindows)) { AllowTransparency = true; - if (formState[FormStateLayered] != 1) { + if (formState[FormStateLayered] != 1) + { formState[FormStateLayered] = 1; - if (!oldLayered) { + if (!oldLayered) + { UpdateStyles(); } } } - else { + else + { formState[FormStateLayered] = (this.TransparencyKey != Color.Empty) ? 1 : 0; - if (oldLayered != (formState[FormStateLayered] != 0)) { + if (oldLayered != (formState[FormStateLayered] != 0)) + { int exStyle = unchecked((int)(long)UnsafeNativeMethods.GetWindowLong(new HandleRef(this, Handle), NativeMethods.GWL_EXSTYLE)); CreateParams cp = CreateParams; - if (exStyle != cp.ExStyle) { + if (exStyle != cp.ExStyle) + { UnsafeNativeMethods.SetWindowLong(new HandleRef(this, Handle), NativeMethods.GWL_EXSTYLE, new HandleRef(null, (IntPtr)cp.ExStyle)); } } @@ -2203,34 +2039,22 @@ internal override Control ParentInternal { } } - /// /// - /// If ShowInTaskbar is true then the form will be displayed - /// in the Windows Taskbar. + /// If ShowInTaskbar is true then the form will be displayed in the Windows Taskbar. /// - [ - DefaultValue(true), - SRCategory(nameof(SR.CatWindowStyle)), - SRDescription(nameof(SR.FormShowInTaskbarDescr)) - ] - public bool ShowInTaskbar { - get { - return formState[FormStateTaskBar] != 0; - } - set { - // Restricted windows must always show in task bar. - if (IsRestrictedWindow) { - return; - } - - if (ShowInTaskbar != value) { - if (value) { - formState[FormStateTaskBar] = 1; - } - else { - formState[FormStateTaskBar] = 0; - } - if (IsHandleCreated) { + [DefaultValue(true)] + [SRCategory(nameof(SR.CatWindowStyle))] + [SRDescription(nameof(SR.FormShowInTaskbarDescr))] + public bool ShowInTaskbar + { + get => formState[FormStateTaskBar] != 0; + set + { + if (ShowInTaskbar != value) + { + formState[FormStateTaskBar] = value ? 1 : 0; + if (IsHandleCreated) + { RecreateHandle(); } } @@ -2238,33 +2062,25 @@ public bool ShowInTaskbar { } /// - /// Gets or sets a value indicating whether an icon is displayed in the - /// caption bar of the form. - /// If ControlBox == false, then the icon won't be shown no matter what - /// the value of ShowIcon is + /// Gets or sets a value indicating whether an icon is displayed in the + /// caption bar of the form. + /// If ControlBox == false, then the icon won't be shown no matter what + /// the value of ShowIcon is /// - [ - DefaultValue(true), - SRCategory(nameof(SR.CatWindowStyle)), - SRDescription(nameof(SR.FormShowIconDescr)) - ] - public bool ShowIcon { - get { - return formStateEx[FormStateExShowIcon] != 0; - } - - set { - if (value) { - formStateEx[FormStateExShowIcon] = 1; - } - else { - // The icon must always be shown for restricted forms. - if (IsRestrictedWindow) { - return; - } - formStateEx[FormStateExShowIcon] = 0; + [DefaultValue(true)] + [SRCategory(nameof(SR.CatWindowStyle))] + [SRDescription(nameof(SR.FormShowIconDescr))] + public bool ShowIcon + { + get => formStateEx[FormStateExShowIcon] != 0; + set + { + formStateEx[FormStateExShowIcon] = value ? 1 : 0; + if (value) + { UpdateStyles(); } + UpdateWindowIcon(true); } } @@ -2497,38 +2313,26 @@ public bool TopLevel { } } - /// /// - /// Gets or sets a value indicating whether the form should be displayed as the top-most - /// form of your application. + /// Gets or sets a value indicating whether the form should be displayed as the + /// top-most form of the application. /// - [ - DefaultValue(false), - SRCategory(nameof(SR.CatWindowStyle)), - SRDescription(nameof(SR.FormTopMostDescr)) - ] - public bool TopMost { - get { - return formState[FormStateTopMost] != 0; - } - set { - // Restricted windows cannot be top most to avoid DOS attack by obscuring other windows. - if (IsRestrictedWindow) { - return; - } - - if (IsHandleCreated && TopLevel) { + [DefaultValue(false)] + [SRCategory(nameof(SR.CatWindowStyle))] + [SRDescription(nameof(SR.FormTopMostDescr))] + public bool TopMost + { + get => formState[FormStateTopMost] != 0; + set + { + if (IsHandleCreated && TopLevel) + { HandleRef key = value ? NativeMethods.HWND_TOPMOST : NativeMethods.HWND_NOTOPMOST; SafeNativeMethods.SetWindowPos(new HandleRef(this, Handle), key, 0, 0, 0, 0, NativeMethods.SWP_NOMOVE | NativeMethods.SWP_NOSIZE); } - if (value) { - formState[FormStateTopMost] = 1; - } - else { - formState[FormStateTopMost] = 0; - } + formState[FormStateTopMost] = value ? 1 : 0; } } @@ -2612,9 +2416,6 @@ protected override void SetVisibleCore(bool value) { } } } - else { - ResetSecurityTip(true /* modalOnly */); - } if (!IsMdiChild) { base.SetVisibleCore(value); @@ -2683,41 +2484,25 @@ protected override void SetVisibleCore(bool value) { } } - /// /// - /// Gets or sets the form's window state. - /// + /// Gets or sets the form's window state. /// - [ - SRCategory(nameof(SR.CatLayout)), - DefaultValue(FormWindowState.Normal), - SRDescription(nameof(SR.FormWindowStateDescr)) - ] - public FormWindowState WindowState { - get { - return(FormWindowState)formState[FormStateWindowState]; - } - set { - - //verify that 'value' is a valid enum type... - //valid values are 0x0 to 0x2 + [SRCategory(nameof(SR.CatLayout))] + [DefaultValue(FormWindowState.Normal)] + [SRDescription(nameof(SR.FormWindowStateDescr))] + public FormWindowState WindowState + { + get => (FormWindowState)formState[FormStateWindowState]; + set + { if (!ClientUtils.IsEnumValid(value, (int)value, (int)FormWindowState.Normal, (int)FormWindowState.Maximized)) { throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(FormWindowState)); } - if (TopLevel && IsRestrictedWindow) { - // We don't allow to minimize or maximze a top level window programatically if it is restricted. - // When maximized, the desktop is obscured by the window (DOS attack) and when minimize spoofing - // identity is the thread, the minimized window could steal the user's keystrokes and obtain a - // password for instance. - if (value != FormWindowState.Normal) { - return; - } - } - - switch (value) { - case FormWindowState.Normal: + switch (value) + { + case FormWindowState.Normal: SetState(STATE_SIZELOCKEDBYOS, false); break; case FormWindowState.Maximized: @@ -2726,9 +2511,11 @@ public FormWindowState WindowState { break; } - if (IsHandleCreated && Visible) { + if (IsHandleCreated && Visible) + { IntPtr hWnd = Handle; - switch (value) { + switch (value) + { case FormWindowState.Normal: SafeNativeMethods.ShowWindow(new HandleRef(this, hWnd), NativeMethods.SW_NORMAL); break; @@ -2748,48 +2535,26 @@ public FormWindowState WindowState { } } - /// /// - /// - /// Gets or sets the text to display in the caption bar of the form. - /// + /// Gets or sets the text to display in the caption bar of the form. /// - internal override string WindowText { - get { - // In restricted mode, the windows caption (Text) is modified to show the url of the window. - // The userWindowText is used to cache the user's text. - if (IsRestrictedWindow && formState[FormStateIsWindowActivated] == 1) { - if (userWindowText == null) { - return ""; - } - return userWindowText; - } - - return base.WindowText; - - } - - set { - string oldText = this.WindowText; - - userWindowText = value; - - if (IsRestrictedWindow && formState[FormStateIsWindowActivated] == 1) { - if (value == null) { - value = ""; - } - base.WindowText = RestrictedWindowText(value); - } - else { - base.WindowText = value; - } - - // For non-default FormBorderStyles, we do not set the WS_CAPTION style if the Text property is null or "". - // When we reload the form from code view, the text property is not set till the very end, and so we do not - // end up updating the CreateParams with WS_CAPTION. Fixed this by making sure we call UpdateStyles() when - // we transition from a non-null value to a null value or vice versa in Form.WindowText. - // - if (oldText == null || (oldText.Length == 0)|| value == null || (value.Length == 0)) { + internal override string WindowText + { + get => base.WindowText; + set + { + string oldText = WindowText; + base.WindowText = value; + + // For non-default FormBorderStyles, we do not set the WS_CAPTION style if + // the Text property is null or "". + // When we reload the form from code view, the text property is not set till + // the very end, and so we do not end up updating the CreateParams with + // WS_CAPTION. Fixed this by making sure we call UpdateStyles() when + // we transition from a non-null value to a null value or vice versa in + // Form.WindowText. + if (string.IsNullOrEmpty(oldText) || string.IsNullOrEmpty(value)) + { UpdateFormStyles(); } } @@ -3031,43 +2796,37 @@ public void Activate() { } } - /// - /// - /// - /// This function handles the activation of a MDI child form. If a subclass - /// overrides this function, it must call base.ActivateMdiChild. - /// From MSDN: This member supports the .NET Framework infrastructure and is not intended - /// to be used directly from your code. - /// - protected void ActivateMdiChild(Form form) { - ActivateMdiChildInternal(form); - } - - // SECURITY WARNING: This method bypasses a security demand. Use with caution! - private void ActivateMdiChildInternal(Form form) { - if (FormerlyActiveMdiChild != null && !FormerlyActiveMdiChild.IsClosing) { + protected void ActivateMdiChild(Form form) + { + if (FormerlyActiveMdiChild != null && !FormerlyActiveMdiChild.IsClosing) + { FormerlyActiveMdiChild.UpdateWindowIcon(true); FormerlyActiveMdiChild = null; } Form activeMdiChild = ActiveMdiChildInternal; - if (activeMdiChild == form) { + if (activeMdiChild == form) + { return; } - //Don't believe we ever hit this with non-null, but leaving it intact in case removing it would cause a problem. - if (null != activeMdiChild) { + // Don't believe we ever hit this with non-null, but leaving it intact in + // case removing it would cause a problem. + if (activeMdiChild != null) + { activeMdiChild.Active = false; } activeMdiChild = form; ActiveMdiChildInternal = form; - if (null != activeMdiChild) { + if (activeMdiChild != null) + { activeMdiChild.IsMdiChildFocusable = true; activeMdiChild.Active = true; } - else if (this.Active) { + else if (Active) + { ActivateControlInternal(this); } @@ -3218,56 +2977,8 @@ private void AdjustSystemMenu(IntPtr hmenu) { UnsafeNativeMethods.EnableMenuItem(new HandleRef(this, hmenu), NativeMethods.SC_SIZE, NativeMethods.MF_BYCOMMAND | NativeMethods.MF_ENABLED); } - -#if SECURITY_DIALOG - AdjustSystemMenuForSecurity(hmenu); -#endif } -#if SECURITY_DIALOG - private void AdjustSystemMenuForSecurity(IntPtr hmenu) { - if (formState[FormStateAddedSecurityMenuItem] == 0) { - formState[FormStateAddedSecurityMenuItem] = 1; - - SecurityMenuItem securitySystemMenuItem = new SecurityMenuItem(this); - Properties.SetObject(PropSecuritySystemMenuItem, securitySystemMenuItem); - - NativeMethods.MENUITEMINFO_T info = new NativeMethods.MENUITEMINFO_T(); - info.fMask = NativeMethods.MIIM_ID | NativeMethods.MIIM_STATE | - NativeMethods.MIIM_SUBMENU | NativeMethods.MIIM_TYPE | NativeMethods.MIIM_DATA; - info.fType = 0; - info.fState = 0; - info.wID = securitySystemMenuItem.ID; - info.hbmpChecked = IntPtr.Zero; - info.hbmpUnchecked = IntPtr.Zero; - info.dwItemData = IntPtr.Zero; - - // Note: This code is not shipping in the final product. We do not want to measure the - // : performance hit of loading the localized resource for this at startup, so I - // : am hard-wiring the strings below. If you need to localize these, move them to - // : a SECONDARY resource file so we don't have to contend with our big error message - // : file on startup. - // - if (IsRestrictedWindow) { - info.dwTypeData = ".NET Restricted Window..."; - } - else { - info.dwTypeData = ".NET Window..."; - } - info.cch = 0; - UnsafeNativeMethods.InsertMenuItem(new HandleRef(this, hmenu), 0, true, info); - - - NativeMethods.MENUITEMINFO_T sep = new NativeMethods.MENUITEMINFO_T(); - sep.fMask = NativeMethods.MIIM_ID | NativeMethods.MIIM_STATE | - NativeMethods.MIIM_SUBMENU | NativeMethods.MIIM_TYPE | NativeMethods.MIIM_DATA; - sep.fType = NativeMethods.MFT_MENUBREAK; - UnsafeNativeMethods.InsertMenuItem(new HandleRef(this, hmenu), 1, true, sep); - - } - } -#endif - /// /// This forces the SystemMenu to look like we want. /// @@ -3666,7 +3377,7 @@ private void DeactivateMdiChild() { if (!activeMdiChild.IsClosing) { FormerlyActiveMdiChild = activeMdiChild; } - // Enter/Leave events on child controls are raised from the ActivateMdiChildInternal method, usually when another + // Enter/Leave events on child controls are raised from the ActivateMdiChild method, usually when another // Mdi child is getting activated after deactivating this one; but if this is the only visible MDI child // we need to fake the activation call so MdiChildActivate and Leave events are raised properly. (We say // in the MSDN doc that the MdiChildActivate event is raised when an mdi child is activated or closed - @@ -3680,7 +3391,7 @@ private void DeactivateMdiChild() { } if( fakeActivation ){ - mdiParent.ActivateMdiChildInternal(null); + mdiParent.ActivateMdiChild(null); } ActiveMdiChildInternal = null; @@ -3771,8 +3482,6 @@ protected override void Dispose(bool disposing) { smallIcon = null; } - ResetSecurityTip(false /* modalOnly */); - base.Dispose(disposing); ctlClient = null; @@ -3812,65 +3521,67 @@ protected override void Dispose(bool disposing) { } /// - /// Adjusts the window style of the CreateParams to reflect the bordericons. + /// Adjusts the window style of the CreateParams to reflect the bordericons. /// - /// - private void FillInCreateParamsBorderIcons(CreateParams cp) { - if (FormBorderStyle != FormBorderStyle.None) { - if (Text != null && Text.Length != 0) { + private void FillInCreateParamsBorderIcons(CreateParams cp) + { + if (FormBorderStyle != FormBorderStyle.None) + { + if (!string.IsNullOrEmpty(Text)) + { cp.Style |= NativeMethods.WS_CAPTION; } - // In restricted mode, the form must have a system menu, caption and max/min/close boxes. - - if (ControlBox || IsRestrictedWindow) { + if (ControlBox) + { cp.Style |= NativeMethods.WS_SYSMENU | NativeMethods.WS_CAPTION; } - else { + else + { cp.Style &= (~NativeMethods.WS_SYSMENU); } - if (MaximizeBox || IsRestrictedWindow) { + if (MaximizeBox) + { cp.Style |= NativeMethods.WS_MAXIMIZEBOX; } - else { + else + { cp.Style &= ~NativeMethods.WS_MAXIMIZEBOX; } - if (MinimizeBox || IsRestrictedWindow) { + if (MinimizeBox) + { cp.Style |= NativeMethods.WS_MINIMIZEBOX; } - else { + else + { cp.Style &= ~NativeMethods.WS_MINIMIZEBOX; } - if (HelpButton && !MaximizeBox && !MinimizeBox && ControlBox) { + if (HelpButton && !MaximizeBox && !MinimizeBox && ControlBox) + { // Windows should ignore WS_EX_CONTEXTHELP unless all those conditions hold. // But someone must have failed the check, because Windows 2000 // will show a help button if either the maximize or // minimize button is disabled. cp.ExStyle |= NativeMethods.WS_EX_CONTEXTHELP; } - else { + else + { cp.ExStyle &= ~NativeMethods.WS_EX_CONTEXTHELP; } } } /// - /// Adjusts the window style of the CreateParams to reflect the borderstyle. + /// Adjusts the window style of the CreateParams to reflect the borderstyle. /// - private void FillInCreateParamsBorderStyles(CreateParams cp) { - switch ((FormBorderStyle)formState[FormStateBorderStyle]) { + private void FillInCreateParamsBorderStyles(CreateParams cp) + { + switch ((FormBorderStyle)formState[FormStateBorderStyle]) + { case FormBorderStyle.None: - // - - - - - if (IsRestrictedWindow) { - goto case FormBorderStyle.FixedSingle; - } break; case FormBorderStyle.FixedSingle: cp.Style |= NativeMethods.WS_BORDER; @@ -3898,26 +3609,23 @@ private void FillInCreateParamsBorderStyles(CreateParams cp) { } /// - /// Adjusts the CreateParams to reflect the window bounds and start position. + /// Adjusts the CreateParams to reflect the window bounds and start position. /// - private void FillInCreateParamsStartPosition(CreateParams cp) { - - if (formState[FormStateSetClientSize] != 0) { + private void FillInCreateParamsStartPosition(CreateParams cp) + { + if (formState[FormStateSetClientSize] != 0) + { // When computing the client window size, don't tell them that // we are going to be maximized! - // int maskedStyle = cp.Style & ~(NativeMethods.WS_MAXIMIZE | NativeMethods.WS_MINIMIZE); Size correct = ComputeWindowSize(ClientSize, maskedStyle, cp.ExStyle); - - if (IsRestrictedWindow) { - correct = ApplyBoundsConstraints(cp.X, cp.Y, correct.Width, correct.Height).Size; - } cp.Width = correct.Width; cp.Height = correct.Height; } - switch ((FormStartPosition)formState[FormStateStartPos]) { + switch ((FormStartPosition)formState[FormStateStartPos]) + { case FormStartPosition.WindowsDefaultBounds: cp.Width = NativeMethods.CW_USEDEFAULT; cp.Height = NativeMethods.CW_USEDEFAULT; @@ -3929,7 +3637,8 @@ private void FillInCreateParamsStartPosition(CreateParams cp) { // several times when a window is shown, we'll need to force the location // each time for MdiChild windows that are docked so that the window will // be created in the correct location and scroll bars will not be displayed. - if (IsMdiChild && DockStyle.None != Dock){ + if (IsMdiChild && DockStyle.None != Dock) + { break; } @@ -3937,49 +3646,48 @@ private void FillInCreateParamsStartPosition(CreateParams cp) { cp.Y = NativeMethods.CW_USEDEFAULT; break; case FormStartPosition.CenterScreen: - if (IsMdiChild) { + if (IsMdiChild) + { Control mdiclient = MdiParentInternal.MdiClient; Rectangle clientRect = mdiclient.ClientRectangle; - cp.X = Math.Max(clientRect.X,clientRect.X + (clientRect.Width - cp.Width)/2); - cp.Y = Math.Max(clientRect.Y,clientRect.Y + (clientRect.Height - cp.Height)/2); + cp.X = Math.Max(clientRect.X, clientRect.X + (clientRect.Width - cp.Width) / 2); + cp.Y = Math.Max(clientRect.Y, clientRect.Y + (clientRect.Height - cp.Height) / 2); } - else { + else + { Screen desktop = null; IWin32Window dialogOwner = (IWin32Window)Properties.GetObject(PropDialogOwner); - if ((OwnerInternal != null) || (dialogOwner != null)) { + if ((OwnerInternal != null) || (dialogOwner != null)) + { IntPtr ownerHandle = (dialogOwner != null) ? Control.GetSafeHandle(dialogOwner) : OwnerInternal.Handle; desktop = Screen.FromHandleInternal(ownerHandle); } - else { + else + { desktop = Screen.FromPoint(Control.MousePosition); } + Rectangle screenRect = desktop.WorkingArea; - //if, we're maximized, then don't set the x & y coordinates (they're @ (0,0) ) - if (WindowState != FormWindowState.Maximized) { - cp.X = Math.Max(screenRect.X,screenRect.X + (screenRect.Width - cp.Width)/2); - cp.Y = Math.Max(screenRect.Y,screenRect.Y + (screenRect.Height - cp.Height)/2); + // if, we're maximized, then don't set the x & y coordinates (they're @ (0,0) ) + if (WindowState != FormWindowState.Maximized) + { + cp.X = Math.Max(screenRect.X, screenRect.X + (screenRect.Width - cp.Width) / 2); + cp.Y = Math.Max(screenRect.Y, screenRect.Y + (screenRect.Height - cp.Height) / 2); } } + break; } } /// - /// Adjusts the Createparams to reflect the window state. + /// Adjusts the Createparams to reflect the window state. /// - private void FillInCreateParamsWindowState(CreateParams cp) { - // SECUNDONE: We don't need to check for restricted window here since the only way to set the WindowState - // programatically is by changing the property and we have a check for it in the property setter. - // We don't want to check it here again because it would not allow to set the CreateParams.Style - // to the current WindowState so the window will be set to its current Normal size - // (which in some cases is quite bogus) when Control.UpdateStylesCore is called. - // - // if( IsRestrictedWindow ){ - // return; - // } - - switch ((FormWindowState)formState[FormStateWindowState]) { + private void FillInCreateParamsWindowState(CreateParams cp) + { + switch ((FormWindowState)formState[FormStateWindowState]) + { case FormWindowState.Maximized: cp.Style |= NativeMethods.WS_MAXIMIZE; break; @@ -3990,15 +3698,15 @@ private void FillInCreateParamsWindowState(CreateParams cp) { } /// - /// Sets focus to the Form. - /// Attempts to set focus to this Form. + /// Attempts to set focus to this Form. /// - // SECURITY WARNING: This method bypasses a security demand. Use with caution! - internal override bool FocusInternal() { + internal override bool FocusInternal() + { Debug.Assert( IsHandleCreated, "Attempt to set focus to a form that has not yet created its handle." ); - //if this form is a MdiChild, then we need to set the focus in a different way... - // - if (IsMdiChild) { + + // If this form is a MdiChild, then we need to set the focus differently. + if (IsMdiChild) + { MdiParentInternal.MdiClient.SendMessage(NativeMethods.WM_MDIACTIVATE, Handle, 0); return Focused; } @@ -4046,213 +3754,49 @@ internal override Size GetPreferredSizeCore(Size proposedSize) { bool dialogFixRequired = false; - if (Padding == Padding.Empty) { - Padding paddingToAdd = Padding.Empty; - foreach (Control c in this.Controls) { - if (c.Dock == DockStyle.None) { - AnchorStyles anchor = c.Anchor; - if (anchor == AnchorStyles.None) { - break; - } - - // TOP - // if we are anchored to the top only add padding if the top edge is too far down - if ((paddingToAdd.Bottom == 0) && DefaultLayout.IsAnchored(anchor, AnchorStyles.Top)) { - if (c.Bottom > preferredSize.Height - FormPadding.Bottom) { - paddingToAdd.Bottom = FormPadding.Bottom; - - dialogFixRequired = true; - } - } - // BOTTOM - // if we are anchored to the bottom - // dont add any padding - it's way too confusing to be dragging a button up - // and have the form grow to the bottom. - - // LEFT - // if we are anchored to the left only add padding if the right edge is too far right - if ((paddingToAdd.Left == 0) && DefaultLayout.IsAnchored(anchor, AnchorStyles.Left)) { - if (c.Right > preferredSize.Width - FormPadding.Right) { - paddingToAdd.Right = FormPadding.Right; - dialogFixRequired = true; - } - } - // RIGHT - // if we are anchored to the bottom - // dont add any padding - it's way too confusing to be dragging a button left - // and have the form grow to the right - - } - } - Debug.Assert(!dialogFixRequired, "this dialog needs update: " + this.Name); - return preferredSize + paddingToAdd.Size; - } -#endif - return preferredSize; - } - - /// - /// This private method attempts to resolve security zone and site - /// information given a list of urls (sites). This list is supplied - /// by the runtime and will contain the paths of all loaded assemblies - /// on the stack. From here, we can examine zones and sites and - /// attempt to identify the unique and mixed scenarios for each. This - /// information will be displayed in the titlebar of the Form in a - /// semi-trust environment. - /// - private void ResolveZoneAndSiteNames(ArrayList sites, ref string securityZone, ref string securitySite) { - - //Start by defaulting to 'unknown zone' and 'unknown site' strings. We will return this - //information if anything goes wrong while trying to resolve this information. - // - securityZone = SR.SecurityRestrictedWindowTextUnknownZone; - securitySite = SR.SecurityRestrictedWindowTextUnknownSite; - - try - { - //these conditions must be met - // - if (sites == null || sites.Count == 0) - return; - - //create a new zone array list which has no duplicates and no - //instances of mycomputer - ArrayList zoneList = new ArrayList(); - foreach (object arrayElement in sites) - { - if (arrayElement == null) - return; - - string url = arrayElement.ToString(); - - if (url.Length == 0) - return; - - //into a zoneName - // - Zone currentZone = Zone.CreateFromUrl(url); - - //skip this if the zone is mycomputer - // - if (currentZone.SecurityZone.Equals(SecurityZone.MyComputer)) - continue; - - //add our unique zonename to our list of zones - // - string zoneName = currentZone.SecurityZone.ToString(); - - if (!zoneList.Contains(zoneName)) - { - zoneList.Add(zoneName); - } - } - - //now, we resolve the zone name based on the unique information - //left in the zoneList - // - if (zoneList.Count == 0) - { - //here, all the original zones were 'mycomputer' - //so we can just return that - securityZone = SecurityZone.MyComputer.ToString(); - } - else if (zoneList.Count == 1) - { - //we only found 1 unique zone other than - //mycomputer - securityZone = zoneList[0].ToString(); - } - else - { - //here, we found multiple zones - // - securityZone = SR.SecurityRestrictedWindowTextMixedZone; - } - - //generate a list of loaded assemblies that came from the gac, this - //way we can safely ignore these from the url list - ArrayList loadedAssembliesFromGac = new ArrayList(); - - foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) - { - if (asm.GlobalAssemblyCache) - { - loadedAssembliesFromGac.Add(asm.CodeBase.ToUpper(CultureInfo.InvariantCulture)); - } - } - - //now, build up a sitelist which contains a friendly string - //we've extracted via the uri class and omit any urls that reference - //our local gac - // - ArrayList siteList = new ArrayList(); - foreach (object arrayElement in sites) - { - //we know that each element is valid because of our - //first pass - Uri currentSite = new Uri(arrayElement.ToString()); - - //if we see a site that contains the path to our gac, - //we'll just skip it - - if (loadedAssembliesFromGac.Contains(currentSite.AbsoluteUri.ToUpper(CultureInfo.InvariantCulture))) - { - continue; - } - - //add the unique host name to our list - string hostName = currentSite.Host; - if (hostName.Length > 0 && !siteList.Contains(hostName)) - siteList.Add(hostName); - } - - - //resolve the site name from our list, if siteList.count == 0 - //then we have already set our securitySite to "unknown site" - // - if (siteList.Count == 0) { - //here, we'll set the local machine name to the site string - securitySite = Environment.MachineName; - } - else if (siteList.Count == 1) - { - //We found 1 unique site other than the info in the - //gac - securitySite = siteList[0].ToString(); - } - else - { - //multiple sites, we'll have to return 'mixed sites' - // - securitySite = SR.SecurityRestrictedWindowTextMultipleSites; - } - } - catch - { - //We'll do nothing here. The idea is that zone and security strings are set - //to "unkown" at the top of this method - if an exception is thrown, we'll - //stick with those values - } - } + if (Padding == Padding.Empty) { + Padding paddingToAdd = Padding.Empty; + foreach (Control c in this.Controls) { + if (c.Dock == DockStyle.None) { + AnchorStyles anchor = c.Anchor; + if (anchor == AnchorStyles.None) { + break; + } - /// - /// Sets the restricted window text (titlebar text of a form) when running - /// in a semi-trust environment. The format is: [zone info] - Form Text - [site info] - /// - private string RestrictedWindowText(string original) { - EnsureSecurityInformation(); - return string.Format(CultureInfo.CurrentCulture, Application.SafeTopLevelCaptionFormat, original, securityZone, securitySite); - } + // TOP + // if we are anchored to the top only add padding if the top edge is too far down + if ((paddingToAdd.Bottom == 0) && DefaultLayout.IsAnchored(anchor, AnchorStyles.Top)) { + if (c.Bottom > preferredSize.Height - FormPadding.Bottom) { + paddingToAdd.Bottom = FormPadding.Bottom; - private void EnsureSecurityInformation() { - if (securityZone == null || securitySite == null) { - ArrayList zones; - ArrayList sites; + dialogFixRequired = true; + } + } + // BOTTOM + // if we are anchored to the bottom + // dont add any padding - it's way too confusing to be dragging a button up + // and have the form grow to the bottom. - SecurityManager.GetZoneAndOrigin( out zones, out sites ); + // LEFT + // if we are anchored to the left only add padding if the right edge is too far right + if ((paddingToAdd.Left == 0) && DefaultLayout.IsAnchored(anchor, AnchorStyles.Left)) { + if (c.Right > preferredSize.Width - FormPadding.Right) { + paddingToAdd.Right = FormPadding.Right; + dialogFixRequired = true; + } + } + // RIGHT + // if we are anchored to the bottom + // dont add any padding - it's way too confusing to be dragging a button left + // and have the form grow to the right - ResolveZoneAndSiteNames(sites, ref securityZone, ref securitySite); + } + } + Debug.Assert(!dialogFixRequired, "this dialog needs update: " + this.Name); + return preferredSize + paddingToAdd.Size; } +#endif + return preferredSize; } private void CallShownEvent() @@ -4652,27 +4196,19 @@ protected override void OnHandleCreated(EventArgs e) { UpdateLayered(); } - /// - /// /// - /// Inheriting classes should override this method to find out when the - /// handle is about to be destroyed. - /// Call base.OnHandleDestroyed last. + /// Inheriting classes should override this method to find out when the + /// handle is about to be destroyed. + /// Call base.OnHandleDestroyed last. /// [EditorBrowsable(EditorBrowsableState.Advanced)] - protected override void OnHandleDestroyed(EventArgs e) { + protected override void OnHandleDestroyed(EventArgs e) + { base.OnHandleDestroyed(e); formStateEx[FormStateExUseMdiChildProc] = 0; // just make sure we're no longer in the forms collection list Application.OpenFormsInternalRemove(this); - - // If the handle is being destroyed, and the security tip hasn't been dismissed - // then we remove it from the property bag. When we come back around and get - // an NCACTIVATE we will see that this is missing and recreate the security - // tip in it's default state. - // - ResetSecurityTip(true /* modalOnly */); } /// @@ -4891,19 +4427,14 @@ protected virtual void OnMdiChildActivate(EventArgs e) { if (handler != null) handler(this,e); } - /// /// - /// Raises the - /// event. + /// Raises the event. /// [EditorBrowsable(EditorBrowsableState.Advanced)] - protected virtual void OnMenuStart(EventArgs e) { - SecurityToolTip secTip = (SecurityToolTip)Properties.GetObject(PropSecurityTip); - if (secTip != null) { - secTip.Pop(true /*noLongerFirst*/); - } + protected virtual void OnMenuStart(EventArgs e) + { EventHandler handler = (EventHandler)Events[EVENT_MENUSTART]; - if (handler != null) handler(this,e); + handler?.Invoke(this,e); } /// @@ -5448,17 +4979,6 @@ private void ResetIcon() { UpdateWindowIcon(true); } - void ResetSecurityTip(bool modalOnly) { - SecurityToolTip secTip = (SecurityToolTip)Properties.GetObject(PropSecurityTip); - if (secTip != null) { - if ((modalOnly && secTip.Modal) || !modalOnly) { - secTip.Dispose(); - secTip = null; - Properties.SetObject(PropSecurityTip, null); - } - } - } - /// /// Resets the TransparencyKey to Color.Empty. /// @@ -5529,34 +5049,6 @@ private void RestoreWindowBoundsIfNecessary() { } } - void RestrictedProcessNcActivate() { - Debug.Assert(IsRestrictedWindow, "This should only be called for restricted windows"); - - // Ignore if tearing down... - // - if (IsDisposed || Disposing) { - return; - } - - // Note that this.Handle does not get called when the handle hasn't been created yet - // - SecurityToolTip secTip = (SecurityToolTip)Properties.GetObject(PropSecurityTip); - if (secTip == null) { - if (IsHandleCreated && UnsafeNativeMethods.GetForegroundWindow() == this.Handle) { - secTip = new SecurityToolTip(this); - Properties.SetObject(PropSecurityTip, secTip); - } - } - else if (!IsHandleCreated || UnsafeNativeMethods.GetForegroundWindow() != this.Handle) - { - secTip.Pop(false /*noLongerFirst*/); - } - else - { - secTip.Show(); - } - } - /// /// Decrements updateMenuHandleSuspendCount. If updateMenuHandleSuspendCount /// becomes zero and updateMenuHandlesDeferred is true, updateMenuHandles @@ -5574,36 +5066,33 @@ private void ResumeUpdateMenuHandles() { } } - /// - /// - /// Selects this form, and optionally selects the next/previous control. - /// - protected override void Select(bool directed, bool forward) { - SelectInternal(directed, forward); - } - /// - /// Selects this form, and optionally selects the next/previous control. - /// Does the actual work without the security check. + /// Selects this form, and optionally selects the next/previous control. /// - // SECURITY WARNING: This method bypasses a security demand. Use with caution! - private void SelectInternal(bool directed, bool forward) { - if (directed) { + protected override void Select(bool directed, bool forward) + { + if (directed) + { SelectNextControl(null, forward, true, true, false); } - if (TopLevel) { + if (TopLevel) + { UnsafeNativeMethods.SetActiveWindow(new HandleRef(this, Handle)); } - else if (IsMdiChild) { + else if (IsMdiChild) + { UnsafeNativeMethods.SetActiveWindow(new HandleRef(MdiParentInternal, MdiParentInternal.Handle)); MdiParentInternal.MdiClient.SendMessage(NativeMethods.WM_MDIACTIVATE, Handle, 0); } - else { + else + { Form form = ParentFormInternal; - if (form != null) form.ActiveControl = this; + if (form != null) + { + form.ActiveControl = this; + } } - } /// @@ -5681,157 +5170,94 @@ protected override void ScaleControl(SizeF factor, BoundsSpecified specified) { } } - - /// - /// - /// [EditorBrowsable(EditorBrowsableState.Advanced)] - protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) { - - if (WindowState != FormWindowState.Normal) { + protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) + { + if (WindowState != FormWindowState.Normal) + { // See RestoreWindowBoundsIfNecessary for an explanation of this // Only restore position when x,y is not -1,-1 if (x != -1 || y != -1) { restoredWindowBoundsSpecified |= (specified & (BoundsSpecified.X | BoundsSpecified.Y)); } + restoredWindowBoundsSpecified |= (specified & (BoundsSpecified.Width | BoundsSpecified.Height)); if ((specified & BoundsSpecified.X) != 0) + { restoredWindowBounds.X = x; + } if ((specified & BoundsSpecified.Y) != 0) + { restoredWindowBounds.Y = y; - if ((specified & BoundsSpecified.Width) != 0) { + } + if ((specified & BoundsSpecified.Width) != 0) + { restoredWindowBounds.Width = width; formStateEx[FormStateExWindowBoundsWidthIsClientSize] = 0; } - if ((specified & BoundsSpecified.Height) != 0) { + if ((specified & BoundsSpecified.Height) != 0) + { restoredWindowBounds.Height = height; formStateEx[FormStateExWindowBoundsHeightIsClientSize] = 0; } } - //Update RestoreBounds + // Update RestoreBounds if ((specified & BoundsSpecified.X) != 0) + { restoreBounds.X = x; + } if ((specified & BoundsSpecified.Y) != 0) + { restoreBounds.Y = y; + } if ((specified & BoundsSpecified.Width) != 0 || restoreBounds.Width == -1) + { restoreBounds.Width = width; + } if ((specified & BoundsSpecified.Height) != 0 || restoreBounds.Height == -1) + { restoreBounds.Height = height; + } // Enforce maximum size... - // - if (WindowState == FormWindowState.Normal - && (this.Height != height || this.Width != width)) { - + if (WindowState == FormWindowState.Normal && (this.Height != height || this.Width != width)) + { Size max = SystemInformation.MaxWindowTrackSize; - if (height > max.Height) { + if (height > max.Height) + { height = max.Height; } - if (width > max.Width) { + if (width > max.Width) + { width = max.Width; } } // Only enforce the minimum size if the form has a border and is a top // level form. - // FormBorderStyle borderStyle = FormBorderStyle; if (borderStyle != FormBorderStyle.None && borderStyle != FormBorderStyle.FixedToolWindow && borderStyle != FormBorderStyle.SizableToolWindow - && ParentInternal == null) { - + && ParentInternal == null) + { Size min = SystemInformation.MinWindowTrackSize; - if (height < min.Height) { + if (height < min.Height) + { height = min.Height; } - if (width < min.Width) { + if (width < min.Width) + { width = min.Width; } } - if (IsRestrictedWindow) { - // Check to ensure that the title bar, and all corners of the window, are visible on a monitor - // - - Rectangle adjustedBounds = ApplyBoundsConstraints(x,y,width,height); - if (adjustedBounds != new Rectangle(x,y,width,height)) { - - // - - - - - base.SetBoundsCore(adjustedBounds.X, adjustedBounds.Y, adjustedBounds.Width, adjustedBounds.Height, BoundsSpecified.All); - return; - } - } - base.SetBoundsCore(x, y, width, height, specified); } - internal override Rectangle ApplyBoundsConstraints(int suggestedX, int suggestedY, int proposedWidth, int proposedHeight) { - // apply min/max size constraints - Rectangle adjustedBounds = base.ApplyBoundsConstraints(suggestedX, suggestedY, proposedWidth, proposedHeight); - // run through size restrictions in Internet. - if (IsRestrictedWindow) { - // Check to ensure that the title bar, and all corners of the window, are visible on a monitor - // - - Screen[] screens = Screen.AllScreens; - bool topLeft = false; - bool topRight = false; - bool bottomLeft = false; - bool bottomRight = false; - - for (int i=0; i /// Sets the defaultButton for the form. The defaultButton is "clicked" when /// the user presses Enter. @@ -6614,44 +6040,52 @@ protected override void OnStyleChanged(EventArgs e) { } /// - /// Updates the window icon. + /// Updates the window icon. /// - /// - private void UpdateWindowIcon(bool redrawFrame) { - if (IsHandleCreated) { + private void UpdateWindowIcon(bool redrawFrame) + { + if (IsHandleCreated) + { Icon icon; // Preserve Win32 behavior by keeping the icon we set NULL if // the user hasn't specified an icon and we are a dialog frame. - // - if ((FormBorderStyle == FormBorderStyle.FixedDialog && formState[FormStateIconSet] == 0 && !IsRestrictedWindow) || !ShowIcon) { + if ((FormBorderStyle == FormBorderStyle.FixedDialog && formState[FormStateIconSet] == 0) || !ShowIcon) + { icon = null; } else { icon = Icon; } - if (icon != null) { - if (smallIcon == null) { - try { + if (icon != null) + { + if (smallIcon == null) + { + try + { smallIcon = new Icon(icon, SystemInformation.SmallIconSize); } - catch { + catch + { } } - if (smallIcon != null) { + if (smallIcon != null) + { SendMessage(NativeMethods.WM_SETICON,NativeMethods.ICON_SMALL,smallIcon.Handle); } + SendMessage(NativeMethods.WM_SETICON,NativeMethods.ICON_BIG,icon.Handle); } - else { - + else + { SendMessage(NativeMethods.WM_SETICON,NativeMethods.ICON_SMALL,0); SendMessage(NativeMethods.WM_SETICON,NativeMethods.ICON_BIG,0); } - if (redrawFrame) { + if (redrawFrame) + { SafeNativeMethods.RedrawWindow(new HandleRef(this, Handle), null, NativeMethods.NullHandleRef, NativeMethods.RDW_INVALIDATE | NativeMethods.RDW_FRAME); } } @@ -6968,44 +6402,38 @@ private void WmExitMenuLoop(ref Message m) { OnMenuComplete(EventArgs.Empty); base.WndProc(ref m); } - + /// - /// WM_GETMINMAXINFO handler + /// WM_GETMINMAXINFO handler /// - /// - private void WmGetMinMaxInfo(ref Message m) { - + private void WmGetMinMaxInfo(ref Message m) + { // Form should gracefully stop at the minimum preferred size. // When we're set to AutoSize true, we should take a look at minAutoSize - which is snapped in onlayout. // as the form contracts, we should not let it size past here as we're just going to readjust the size // back to it later. Size minTrack = (AutoSize && formStateEx[FormStateExInModalSizingLoop] == 1) ? LayoutUtils.UnionSizes(minAutoSize, MinimumSize) : MinimumSize; - + Size maxTrack = MaximumSize; Rectangle maximizedBounds = MaximizedBounds; - if (!minTrack.IsEmpty - || !maxTrack.IsEmpty - || !maximizedBounds.IsEmpty - || IsRestrictedWindow) { - + if (!minTrack.IsEmpty || !maxTrack.IsEmpty || !maximizedBounds.IsEmpty) + { WmGetMinMaxInfoHelper(ref m, minTrack, maxTrack, maximizedBounds); } - if (IsMdiChild) { + + if (IsMdiChild) + { base.WndProc(ref m); - return; } } - // PERFTRACK : Microsoft, 2/22/2000 - Refer to MINMAXINFO in a separate method - // : to avoid loading the class in the common case. - // - private void WmGetMinMaxInfoHelper(ref Message m, Size minTrack, Size maxTrack, Rectangle maximizedBounds) { - + private void WmGetMinMaxInfoHelper(ref Message m, Size minTrack, Size maxTrack, Rectangle maximizedBounds) + { NativeMethods.MINMAXINFO mmi = (NativeMethods.MINMAXINFO)m.GetLParam(typeof(NativeMethods.MINMAXINFO)); - if (!minTrack.IsEmpty) { - + if (!minTrack.IsEmpty) + { mmi.ptMinTrackSize.x = minTrack.Width; mmi.ptMinTrackSize.y = minTrack.Height; @@ -7017,39 +6445,38 @@ private void WmGetMinMaxInfoHelper(ref Message m, Size minTrack, Size maxTrack, // So, the workaround to prevent this problem is to set the MaxTrackSize to something // whenever the MinTrackSize is set to a value larger than the respective dimension // of the virtual screen. - - if (maxTrack.IsEmpty) { - + if (maxTrack.IsEmpty) + { // Only set the max track size dimensions if the min track size dimensions // are larger than the VirtualScreen dimensions. Size virtualScreen = SystemInformation.VirtualScreen.Size; - if (minTrack.Height > virtualScreen.Height) { + if (minTrack.Height > virtualScreen.Height) + { mmi.ptMaxTrackSize.y = int.MaxValue; } - if (minTrack.Width > virtualScreen.Width) { + if (minTrack.Width > virtualScreen.Width) + { mmi.ptMaxTrackSize.x = int.MaxValue; } } } - if (!maxTrack.IsEmpty) { + + if (!maxTrack.IsEmpty) + { // Is the specified MaxTrackSize smaller than the smallest allowable Window size? Size minTrackWindowSize = SystemInformation.MinWindowTrackSize; mmi.ptMaxTrackSize.x = Math.Max(maxTrack.Width, minTrackWindowSize.Width); mmi.ptMaxTrackSize.y = Math.Max(maxTrack.Height, minTrackWindowSize.Height); } - if (!maximizedBounds.IsEmpty && !IsRestrictedWindow) { + if (!maximizedBounds.IsEmpty) + { mmi.ptMaxPosition.x = maximizedBounds.X; mmi.ptMaxPosition.y = maximizedBounds.Y; mmi.ptMaxSize.x = maximizedBounds.Width; mmi.ptMaxSize.y = maximizedBounds.Height; } - if (IsRestrictedWindow) { - mmi.ptMinTrackSize.x = Math.Max(mmi.ptMinTrackSize.x, 100); - mmi.ptMinTrackSize.y = Math.Max(mmi.ptMinTrackSize.y, SystemInformation.CaptionButtonSize.Height * 3); - } - Marshal.StructureToPtr(mmi, m.LParam, false); m.Result = IntPtr.Zero; } @@ -7115,7 +6542,7 @@ private void WmMdiActivate(ref Message m) { formMdiParent.DeactivateMdiChild(); } else if (Handle == m.LParam) { - formMdiParent.ActivateMdiChildInternal(this); + formMdiParent.ActivateMdiChild(this); } } } @@ -7323,9 +6750,6 @@ private void WmWindowPosChanged(ref Message m) { protected override void WndProc(ref Message m) { switch (m.Msg) { case NativeMethods.WM_NCACTIVATE: - if (IsRestrictedWindow) { - BeginInvoke(new MethodInvoker(RestrictedProcessNcActivate)); - } base.WndProc(ref m); break; case NativeMethods.WM_NCLBUTTONDOWN: @@ -7545,183 +6969,6 @@ internal void SetOwners(HandleRef hRefOwner) } } } - - private class SecurityToolTip : IDisposable { - Form owner; - string toolTipText; - bool first = true; - ToolTipNativeWindow window; - - internal SecurityToolTip(Form owner) { - this.owner = owner; - SetupText(); - window = new ToolTipNativeWindow(this); - SetupToolTip(); - owner.LocationChanged += new EventHandler(FormLocationChanged); - owner.HandleCreated += new EventHandler(FormHandleCreated); - } - - CreateParams CreateParams { - get { - NativeMethods.INITCOMMONCONTROLSEX icc = new NativeMethods.INITCOMMONCONTROLSEX(); - icc.dwICC = NativeMethods.ICC_TAB_CLASSES; - SafeNativeMethods.InitCommonControlsEx(icc); - - CreateParams cp = new CreateParams(); - cp.Parent = owner.Handle; - cp.ClassName = NativeMethods.TOOLTIPS_CLASS; - cp.Style |= NativeMethods.TTS_ALWAYSTIP | NativeMethods.TTS_BALLOON; - cp.ExStyle = 0; - cp.Caption = null; - return cp; - } - } - - internal bool Modal { - get { - return first; - } - } - - public void Dispose() { - if (owner != null) { - owner.LocationChanged -= new EventHandler(FormLocationChanged); - } - if (window.Handle != IntPtr.Zero) { - window.DestroyHandle(); - window = null; - } - } - - private NativeMethods.TOOLINFO_T GetTOOLINFO() { - NativeMethods.TOOLINFO_T toolInfo; - toolInfo = new NativeMethods.TOOLINFO_T(); - toolInfo.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_T)); - toolInfo.uFlags |= NativeMethods.TTF_SUBCLASS; - toolInfo.lpszText = this.toolTipText; - if (owner.RightToLeft == RightToLeft.Yes) { - toolInfo.uFlags |= NativeMethods.TTF_RTLREADING; - } - if (!first) { - toolInfo.uFlags |= NativeMethods.TTF_TRANSPARENT; - toolInfo.hwnd = owner.Handle; - Size s = SystemInformation.CaptionButtonSize; - Rectangle r = new Rectangle(owner.Left, owner.Top, s.Width, SystemInformation.CaptionHeight); - r = owner.RectangleToClient(r); - r.Width -= r.X; - r.Y += 1; - toolInfo.rect = NativeMethods.RECT.FromXYWH(r.X, r.Y, r.Width, r.Height); - toolInfo.uId = IntPtr.Zero; - } - else { - toolInfo.uFlags |= NativeMethods.TTF_IDISHWND | NativeMethods.TTF_TRACK; - toolInfo.hwnd = IntPtr.Zero; - toolInfo.uId = owner.Handle; - } - return toolInfo; - } - - private void SetupText() { - owner.EnsureSecurityInformation(); - string mainText = SR.SecurityToolTipMainText; - string sourceInfo = string.Format(SR.SecurityToolTipSourceInformation, owner.securitySite); - this.toolTipText = string.Format(SR.SecurityToolTipTextFormat, mainText, sourceInfo); - } - - private void SetupToolTip() { - window.CreateHandle(CreateParams); - - SafeNativeMethods.SetWindowPos(new HandleRef(window, window.Handle), NativeMethods.HWND_TOPMOST, - 0, 0, 0, 0, - NativeMethods.SWP_NOMOVE | NativeMethods.SWP_NOSIZE | - NativeMethods.SWP_NOACTIVATE); - - UnsafeNativeMethods.SendMessage(new HandleRef(window, window.Handle), NativeMethods.TTM_SETMAXTIPWIDTH, 0, owner.Width); - - UnsafeNativeMethods.SendMessage(new HandleRef(window, window.Handle), NativeMethods.TTM_SETTITLE, NativeMethods.TTI_WARNING, SR.SecurityToolTipCaption); - - if (0 == (int)UnsafeNativeMethods.SendMessage(new HandleRef(window, window.Handle), NativeMethods.TTM_ADDTOOL, 0, GetTOOLINFO())) { - Debug.Fail("TTM_ADDTOOL failed for security tip"); - } - - UnsafeNativeMethods.SendMessage(new HandleRef(window, window.Handle), NativeMethods.TTM_ACTIVATE, 1, 0); - Show(); - } - - private void RecreateHandle() { - if (window != null) - { - if (window.Handle != IntPtr.Zero) { - window.DestroyHandle(); - } - SetupToolTip(); - } - } - - private void FormHandleCreated(object sender, EventArgs e) { - RecreateHandle(); - } - - private void FormLocationChanged(object sender, EventArgs e) { - if (window != null && first) { - Size s = SystemInformation.CaptionButtonSize; - - if (owner.WindowState == FormWindowState.Minimized) { - Pop(true /*noLongerFirst*/); - } - else { - UnsafeNativeMethods.SendMessage(new HandleRef(window, window.Handle), NativeMethods.TTM_TRACKPOSITION, 0, NativeMethods.Util.MAKELONG(owner.Left + s.Width / 2, owner.Top + SystemInformation.CaptionHeight)); - } - } - else { - Pop(true /*noLongerFirst*/); - } - } - - internal void Pop(bool noLongerFirst) { - if (noLongerFirst) { - first = false; - } - UnsafeNativeMethods.SendMessage(new HandleRef(window, window.Handle), NativeMethods.TTM_TRACKACTIVATE, 0, GetTOOLINFO()); - UnsafeNativeMethods.SendMessage(new HandleRef(window, window.Handle), NativeMethods.TTM_DELTOOL, 0, GetTOOLINFO()); - UnsafeNativeMethods.SendMessage(new HandleRef(window, window.Handle), NativeMethods.TTM_ADDTOOL, 0, GetTOOLINFO()); - } - - internal void Show() { - if (first) { - Size s = SystemInformation.CaptionButtonSize; - UnsafeNativeMethods.SendMessage(new HandleRef(window, window.Handle), NativeMethods.TTM_TRACKPOSITION, 0, NativeMethods.Util.MAKELONG(owner.Left + s.Width / 2, owner.Top + SystemInformation.CaptionHeight)); - UnsafeNativeMethods.SendMessage(new HandleRef(window, window.Handle), NativeMethods.TTM_TRACKACTIVATE, 1, GetTOOLINFO()); - } - } - - private void WndProc(ref Message msg) { - if (first) { - if (msg.Msg == NativeMethods.WM_LBUTTONDOWN - || msg.Msg == NativeMethods.WM_RBUTTONDOWN - || msg.Msg == NativeMethods.WM_MBUTTONDOWN - || msg.Msg == NativeMethods.WM_XBUTTONDOWN) { - - Pop(true /*noLongerFirst*/); - } - } - window.DefWndProc(ref msg); - } - - private sealed class ToolTipNativeWindow : NativeWindow { - SecurityToolTip control; - - internal ToolTipNativeWindow(SecurityToolTip 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/FxCopSuppression.cs b/src/System.Windows.Forms/src/System/Windows/Forms/FxCopSuppression.cs index 68271f34c68..8d2620de0c5 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/FxCopSuppression.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/FxCopSuppression.cs @@ -121,66 +121,6 @@ [assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope="resource", Target="System.Windows.Forms.resources", MessageId="Lresult")] [assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope="resource", Target="System.Windows.Forms.resources", MessageId="Dn")] -// - -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Application.EnableVisualStyles():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Application.GetAppFileVersionInfo():System.Diagnostics.FileVersionInfo")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Application+ThreadContext.get_ParkingWindow():System.Windows.Forms.Application+ParkingWindow")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Application+ThreadContext.OnThreadException(System.Exception):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.ContainerControl.AfterControlRemoved(System.Windows.Forms.Control):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Control+ControlVersionInfo.GetFileVersionInfo():System.Diagnostics.FileVersionInfo")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Control+ControlAccessibleObject..ctor(System.Windows.Forms.Control)")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Control+ControlAccessibleObject.get_PreviousLabel():System.Windows.Forms.Label")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Label.ProcessMnemonic(System.Char):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.FontDialog.RunDialog(System.IntPtr):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.FontDialog.UpdateFont(System.Windows.Forms.NativeMethods+LOGFONT):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.ImageList+NativeImageList..ctor(System.IntPtr)")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.DataGridView+DataGridViewToolTip.ComputeToolTipPosition():System.Drawing.Point")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.InputLanguage.get_LayoutName():System.String")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.TabControl.WmSelChanging():System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.TabControl.UpdateTabSelection(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.GroupBox.ProcessMnemonic(System.Char):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Form.OnVisibleChanged(System.EventArgs):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Form.get_DefaultIcon():System.Drawing.Icon")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window):System.Windows.Forms.DialogResult")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Form.SetVisibleCore(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Form.get_DefaultRestrictedIcon():System.Drawing.Icon")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Form.set_Active(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Help.Resolve(System.String):System.Uri")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Splitter.SplitBegin(System.Int32,System.Int32):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.ImageList.GetBitmap(System.Int32):System.Drawing.Bitmap")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Cursor.get_HotSpot():System.Drawing.Point")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Cursor.LoadPicture(System.Windows.Forms.UnsafeNativeMethods+IStream):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Cursor.get_CurrentInternal():System.Windows.Forms.Cursor")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.LinkUtilities.GetIEColor(System.String):System.Drawing.Color")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.LinkUtilities.GetIELinkBehavior():System.Windows.Forms.LinkBehavior")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.ListView.SetBackgroundImage():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.ListView.Dispose(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.ListView.DeleteFileName(System.String):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.DataGrid.CreateScrollableRegion(System.Drawing.Rectangle):System.Windows.Forms.NativeMethods+RECT[]")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Application+ThreadContext.InstallWindowsFormsSyncContextIfNeeded():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.SystemInformation.get_MenuFont():System.Drawing.Font")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.SplitContainer.SplitBegin(System.Int32,System.Int32):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Control.OnHandleCreated(System.EventArgs):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Control.UpdateReflectParent(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope = "member", Target = "System.Windows.Forms.Control.SelectNextIfFocused():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope = "member", Target = "System.Windows.Forms.Control.SelectNextControlInternal(System.Windows.Forms.Control,System.Boolean,System.Boolean,System.Boolean,System.Boolean):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.DataGridView.CreateScrollableRegion(System.Drawing.Rectangle):System.Windows.Forms.NativeMethods+RECT[]")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.ComponentModel.WeakDelegateHolder.DynamicInvoke(System.Object[]):System.Object")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.GetFont(System.Drawing.IDeviceContext,System.Windows.Forms.VisualStyles.FontProperty):System.Drawing.Font")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.PtrToStructure(System.IntPtr,System.Type):System.Object")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.DataGrid.RowResizeBegin(System.Windows.Forms.MouseEventArgs,System.Int32):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.DataGrid.ColResizeBegin(System.Windows.Forms.MouseEventArgs,System.Int32):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.DataGridView.CaptureMouse(System.Drawing.Rectangle):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.Control+ActiveXImpl.OnFocus(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.DataObject.SaveObjectToHandleSerializer(System.IO.Stream,System.Object):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.DataGridView+DataGridViewToolTip.Activate(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.FileDialog.RunDialogVista(System.IntPtr):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope="member", Target="System.Windows.Forms.FileDialogCustomPlacesCollection.Apply(System.Windows.Forms.FileDialogNative+IFileDialog):System.Void")] - -// - - [assembly: SuppressMessage("Microsoft.Security", "CA2101:SpecifyMarshalingForPInvokeStringArguments", Scope="member", Target="System.Windows.Forms.Internal.IntSafeNativeMethods.ExtTextOut(System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Int32,System.Windows.Forms.Internal.IntNativeMethods+RECT&,System.String,System.Int32,System.Int32[]):System.Boolean")] [assembly: SuppressMessage("Microsoft.Security", "CA2101:SpecifyMarshalingForPInvokeStringArguments", Scope="member", Target="System.Windows.Forms.Internal.IntSafeNativeMethods.FormatMessage(System.Int32,System.Runtime.InteropServices.HandleRef,System.Int32,System.Int32,System.Text.StringBuilder,System.Int32,System.Runtime.InteropServices.HandleRef):System.Int32")] @@ -531,242 +471,6 @@ [assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope="member", Target="System.Windows.Forms.ComponentModel.Com2Interop.Com2PictureConverter.lastPalette")] //LinkDemands reviewed as part of security push -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Design.WindowsFormsComponentEditor.EditComponent(System.ComponentModel.ITypeDescriptorContext,System.Object,System.Windows.Forms.IWin32Window):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Design.ComponentEditorPage.IsPageMessage(System.Windows.Forms.Message&):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.GetBackgroundRegion(System.Drawing.IDeviceContext,System.Drawing.Rectangle):System.Drawing.Region")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.GetMargins(System.Drawing.IDeviceContext,System.Windows.Forms.VisualStyles.MarginProperty):System.Windows.Forms.Padding")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.HitTestBackground(System.Drawing.IDeviceContext,System.Drawing.Rectangle,System.IntPtr,System.Drawing.Point,System.Windows.Forms.VisualStyles.HitTestOptions):System.Windows.Forms.VisualStyles.HitTestCode")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.GetPartSize(System.Drawing.IDeviceContext,System.Drawing.Rectangle,System.Windows.Forms.VisualStyles.ThemeSizeType):System.Drawing.Size")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.DrawText(System.Drawing.IDeviceContext,System.Drawing.Rectangle,System.String,System.Boolean,System.Windows.Forms.TextFormatFlags):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.DrawBackground(System.Drawing.IDeviceContext,System.Drawing.Rectangle):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.GetTextExtent(System.Drawing.IDeviceContext,System.String,System.Windows.Forms.TextFormatFlags):System.Drawing.Rectangle")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.GetTextExtent(System.Drawing.IDeviceContext,System.Drawing.Rectangle,System.String,System.Windows.Forms.TextFormatFlags):System.Drawing.Rectangle")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.GetBackgroundContentRectangle(System.Drawing.IDeviceContext,System.Drawing.Rectangle):System.Drawing.Rectangle")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.GetBackgroundExtent(System.Drawing.IDeviceContext,System.Drawing.Rectangle):System.Drawing.Rectangle")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.GetFont(System.Drawing.IDeviceContext,System.Windows.Forms.VisualStyles.FontProperty):System.Drawing.Font")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.GetPartSize(System.Drawing.IDeviceContext,System.Windows.Forms.VisualStyles.ThemeSizeType):System.Drawing.Size")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.GetTextMetrics(System.Drawing.IDeviceContext):System.Windows.Forms.VisualStyles.TextMetrics")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.DrawParentBackground(System.Drawing.IDeviceContext,System.Drawing.Rectangle,System.Windows.Forms.Control):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.DrawBackground(System.Drawing.IDeviceContext,System.Drawing.Rectangle,System.Drawing.Rectangle):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.HitTestBackground(System.Drawing.IDeviceContext,System.Drawing.Rectangle,System.Drawing.Point,System.Windows.Forms.VisualStyles.HitTestOptions):System.Windows.Forms.VisualStyles.HitTestCode")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.VisualStyles.VisualStyleRenderer.DrawEdge(System.Drawing.IDeviceContext,System.Drawing.Rectangle,System.Windows.Forms.VisualStyles.Edges,System.Windows.Forms.VisualStyles.EdgeStyle,System.Windows.Forms.VisualStyles.EdgeEffects):System.Drawing.Rectangle")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Internal.DeviceContext.Dispose(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Internal.DeviceContext.get_Hdc():System.IntPtr")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Internal.IntNativeMethods+DRAWTEXTPARAMS..ctor(System.Int32,System.Int32)")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Internal.IntUnsafeNativeMethods.GetObject(System.Runtime.InteropServices.HandleRef,System.Windows.Forms.Internal.IntNativeMethods+LOGFONT):System.Int32")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Internal.WindowsGraphics.FromGraphics(System.Drawing.Graphics,System.Windows.Forms.Internal.ApplyGraphicsProperties):System.Windows.Forms.Internal.WindowsGraphics")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolBarButton.GetTBBUTTONINFO(System.Boolean,System.Int32):System.Windows.Forms.NativeMethods+TBBUTTONINFO")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control+ControlVersionInfo.get_ProductName():System.String")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control+ControlVersionInfo.GetFileVersionInfo():System.Diagnostics.FileVersionInfo")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control+ControlVersionInfo.get_ProductVersion():System.String")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control+ControlVersionInfo.get_CompanyName():System.String")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.WindowsGraphicsWrapper..ctor(System.Drawing.IDeviceContext,System.Windows.Forms.TextFormatFlags)")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.LinkLabel.PaintLink(System.Drawing.Graphics,System.Windows.Forms.LinkLabel+Link,System.Drawing.SolidBrush,System.Drawing.SolidBrush,System.Boolean,System.Drawing.RectangleF):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.LinkLabel.OnPaint(System.Windows.Forms.PaintEventArgs):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+PARAFORMAT..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Label.OnPaint(System.Windows.Forms.PaintEventArgs):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control+ControlNativeWindow..ctor(System.Windows.Forms.Control)")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control+ControlNativeWindow.LockReference(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Application.get_ProductName():System.String")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Application.GetAppFileVersionInfo():System.Diagnostics.FileVersionInfo")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Application.get_ProductVersion():System.String")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Application.get_CompanyName():System.String")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.FontDialog.RunDialog(System.IntPtr):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Timer+TimerNativeWindow.StartTimer(System.Int32):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Timer+TimerNativeWindow.get_IsTimerRunning():System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Timer+TimerNativeWindow..ctor(System.Windows.Forms.Timer)")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Timer+TimerNativeWindow.StopTimer(System.Boolean,System.IntPtr):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Timer+TimerNativeWindow.EnsureHandle():System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NotifyIcon.Dispose(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.PrintPreviewControl.ComputeLayout():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.StatusBar.OnHandleDestroyed(System.EventArgs):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.StatusBar.get_SizeGripWidth():System.Int32")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.StatusBar.UpdateTooltip(System.Windows.Forms.StatusBarPanel):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.StatusBar.set_ShowPanels(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ComboBox.get_Focused():System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ComboBox.EndUpdate():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ComboBox.UpdateText():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ComboBox.ReleaseChildWindow():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ComboBox.SetAutoComplete(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ComboBox.set_SelectedText(System.String):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ComboBox.OnHandleCreated(System.EventArgs):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+HH_AKLINK..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ControlBindingsCollection.RemoveCore(System.Windows.Forms.Binding):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ControlBindingsCollection.AddCore(System.Windows.Forms.Binding):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+LVINSERTMARK..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control+ActiveXImpl..ctor(System.Windows.Forms.Control)")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.FolderBrowserDialog.RunDialog(System.IntPtr):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.DataGridViewCheckBoxCell.PaintPrivate(System.Drawing.Graphics,System.Drawing.Rectangle,System.Drawing.Rectangle,System.Int32,System.Windows.Forms.DataGridViewElementStates,System.Object,System.String,System.Windows.Forms.DataGridViewCellStyle,System.Windows.Forms.DataGridViewAdvancedBorderStyle,System.Windows.Forms.DataGridViewPaintParts,System.Boolean,System.Boolean,System.Boolean):System.Drawing.Rectangle")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.MonthCalendar.HitTest(System.Int32,System.Int32):System.Windows.Forms.MonthCalendar+HitTestInfo")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.MonthCalendar.Dispose(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ComboBox+ACNativeWindow.get_Visible():System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.TabControl.OnHandleDestroyed(System.EventArgs):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.TabControl.OnHandleCreated(System.EventArgs):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ImageList+ImageCollection.set_Item(System.Int32,System.Drawing.Image):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ControlPaint.DrawFlatCheckBox(System.Drawing.Graphics,System.Drawing.Rectangle,System.Drawing.Color,System.Drawing.Brush,System.Windows.Forms.ButtonState):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ControlPaint.CopyPixels(System.IntPtr,System.Drawing.IDeviceContext,System.Drawing.Point,System.Drawing.Point,System.Drawing.Size,System.Drawing.CopyPixelOperation):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Form.SetVisibleCore(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Form.get_TaskbarOwner():System.Runtime.InteropServices.HandleRef")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Form.UpdateWindowState():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window):System.Windows.Forms.DialogResult")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Form.ComputeWindowSize(System.Drawing.Size):System.Drawing.Size")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Form.set_MdiParentInternal(System.Windows.Forms.Form):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Form.CheckCloseDialog(System.Boolean):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.TreeNode.Realize(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.TreeNode.UpdateNode(System.Int32):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+HH_FTS_QUERY..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.WebBrowserNavigatedEventArgs.get_Url():System.Uri")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolStripDropDownMenu.CalculateInternalLayoutMetrics():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+MENUITEMINFO_T..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Form+SecurityToolTip.Dispose():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Form+SecurityToolTip.Pop():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Form+SecurityToolTip.GetTOOLINFO():System.Windows.Forms.NativeMethods+TOOLINFO_T")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Help.ShowPopup(System.Windows.Forms.Control,System.String,System.Drawing.Point):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+MENUITEMINFO_T_RW..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.MenuItem.CreateMenuItem():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.MenuItem.UpdateMenuItem(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.MenuItem.UpdateItemRtl(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.MenuItem.AllocMsaaMenuInfo():System.IntPtr")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.MenuItem.FreeMsaaMenuInfo():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolStrip.OnPaint(System.Windows.Forms.PaintEventArgs):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolStrip.get_DropDownOwnerWindow():System.Windows.Forms.NativeWindow")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+TOOLINFO_T..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ContainerControl.UpdateFocusedControl():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+MCHITTESTINFO..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ColorDialog.RunDialog(System.IntPtr):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.CreateHandle():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control..ctor(System.Boolean)")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.FromHandleInternal(System.IntPtr):System.Windows.Forms.Control")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.get_HandleInternal():System.IntPtr")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.InvokeMarshaledCallbacks():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.ScaleControl(System.Drawing.SizeF,System.Windows.Forms.BoundsSpecified):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.SizeFromClientSize(System.Int32,System.Int32):System.Drawing.Size")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.InvokeMarshaledCallback(System.Windows.Forms.Control+ThreadMethodEntry):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.Dispose(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(System.Object):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.UpdateBounds(System.Int32,System.Int32,System.Int32,System.Int32):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.PerformControlValidation(System.Boolean):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.PaintTransparentBackground(System.Windows.Forms.PaintEventArgs,System.Drawing.Rectangle,System.Drawing.Region):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.get_IsMirrored():System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.ProcessUICues(System.Windows.Forms.Message&):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.CreateGraphicsInternal():System.Drawing.Graphics")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.UpdateStylesCore():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.RecreateHandleCore():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.get_IsHandleCreated():System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.OnPrint(System.Windows.Forms.PaintEventArgs):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Control.GetScaledBounds(System.Drawing.Rectangle,System.Drawing.SizeF,System.Windows.Forms.BoundsSpecified):System.Drawing.Rectangle")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+CHARFORMAT2A..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.WebBrowserNavigatingEventArgs.get_Url():System.Uri")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.WebBrowserNavigatingEventArgs.get_TargetFrameName():System.String")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.BindingContext.CheckPropertyBindingCycles(System.Windows.Forms.BindingContext,System.Windows.Forms.Binding):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ComboBox+ComboBoxChildNativeWindow..ctor(System.Windows.Forms.ComboBox)")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.DataObject..ctor(System.Object)")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.ReleaseComObject(System.Object):System.Int32")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.PtrToStructure(System.IntPtr,System.Type):System.Object")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.GetRectsFromRegion(System.IntPtr):System.Windows.Forms.NativeMethods+RECT[]")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.IsComObject(System.Object):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods.SizeOf(System.Type):System.Int32")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolBar.RealizeButtons():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolBar.OnHandleCreated(System.EventArgs):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolBar.InternalSetButton(System.Int32,System.Windows.Forms.ToolBarButton,System.Boolean,System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolBar.ForceButtonWidths():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.DataGridToolTip.Destroy():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.DataGridToolTip.RemoveToolTip(System.IntPtr):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.DataGridToolTip.AddToolTip(System.String,System.IntPtr,System.Drawing.Rectangle):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.DataGridToolTip.CreateToolTipHandle():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Application+ParkingWindow.CheckDestroy():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Application+ParkingWindow.Destroy():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NotifyIcon+NotifyIconNativeWindow..ctor(System.Windows.Forms.NotifyIcon)")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.FileDialog.RunDialog(System.IntPtr):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ImageList.GetBitmap(System.Int32):System.Drawing.Bitmap")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ImageList.set_ImageStream(System.Windows.Forms.ImageListStreamer):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ImageList.AddToHandle(System.Windows.Forms.ImageList+Original,System.Drawing.Bitmap):System.Int32")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ImageList.Draw(System.Drawing.Graphics,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolTip+ToolTipNativeWindow..ctor(System.Windows.Forms.ToolTip)")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.SystemInformation.get_HighContrast():System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.SystemInformation.get_UserInteractive():System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.SystemInformation.get_ScreenOrientation():System.Windows.Forms.ScreenOrientation")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.TextRenderer.DrawText(System.Drawing.IDeviceContext,System.String,System.Drawing.Font,System.Drawing.Point,System.Drawing.Color,System.Drawing.Color):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.TextRenderer.DrawText(System.Drawing.IDeviceContext,System.String,System.Drawing.Font,System.Drawing.Point,System.Drawing.Color):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.TextRenderer.MeasureText(System.Drawing.IDeviceContext,System.String,System.Drawing.Font,System.Drawing.Size):System.Drawing.Size")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.TextRenderer.DrawText(System.Drawing.IDeviceContext,System.String,System.Drawing.Font,System.Drawing.Rectangle,System.Drawing.Color,System.Drawing.Color):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.TextRenderer.DrawText(System.Drawing.IDeviceContext,System.String,System.Drawing.Font,System.Drawing.Rectangle,System.Drawing.Color):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.TextRenderer.MeasureText(System.Drawing.IDeviceContext,System.String,System.Drawing.Font):System.Drawing.Size")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Cursor.DrawImageCore(System.Drawing.Graphics,System.Drawing.Rectangle,System.Drawing.Rectangle,System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Cursor.GetIconSize(System.IntPtr):System.Drawing.Size")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Cursor.LoadPicture(System.Windows.Forms.UnsafeNativeMethods+IStream):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ListView.InsertItemsNative(System.Int32,System.Windows.Forms.ListViewItem[]):System.Int32")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ListView.SetColumnInfo(System.Int32,System.Windows.Forms.ColumnHeader):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ListView.DestroyLVGROUP(System.Windows.Forms.NativeMethods+LVGROUP):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ListView.GetLVGROUP(System.Windows.Forms.ListViewGroup):System.Windows.Forms.NativeMethods+LVGROUP")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ListView.GenerateRandomName():System.String")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ListView.PositionHeader():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ErrorProvider+IconRegion.get_Region():System.Drawing.Region")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Timer.set_Enabled(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+MSOCRINFOSTRUCT..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ScrollBar.UpdateScrollInfo():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ScrollBar..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.MdiClient.SetWindowRgn():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.MdiClient.SetBoundsCore(System.Int32,System.Int32,System.Int32,System.Int32,System.Windows.Forms.BoundsSpecified):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+CHOOSEFONT..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolStripMenuItem.GetNativeMenuItemTextAndShortcut():System.String")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolStripMenuItem.GetNativeMenuItemEnabled():System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+SCROLLINFO..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+MONITORINFOEX..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.WindowsFormsUtils+DCMapping.get_Graphics():System.Drawing.Graphics")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.DataGrid.OnKeyDown(System.Windows.Forms.KeyEventArgs):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.DataFormats.GetFormat(System.String):System.Windows.Forms.DataFormats+Format")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.AxHost+AxContainer.ListAxControls(System.Collections.ArrayList,System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.AxHost+AxContainer.FormCreated():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Application+ThreadContext.get_ComponentManager():System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Application+ThreadContext.ProcessFilters(System.Windows.Forms.NativeMethods+MSG&,System.Boolean&):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Application+ThreadContext.InstallWindowsFormsSyncContextIfNeeded():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Application+ThreadContext.RevokeComponent():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Application+ThreadContext.PreTranslateMessage(System.Windows.Forms.NativeMethods+MSG&):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(System.Int32,System.Windows.Forms.ApplicationContext):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.UnsafeNativeMethods+ThemingScope.CreateActivationContext(System.String,System.Int32):System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+TOOLINFO_TOOLTIP..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ScrollProperties.UpdateScrollInfo():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.HtmlElementCollection.GetElementsByName(System.String):System.Windows.Forms.HtmlElementCollection")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.HtmlElementCollection.get_Item(System.String):System.Windows.Forms.HtmlElement")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.WebBrowserSiteBase.StopEvents():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ErrorProvider+ErrorWindow.EnsureDestroyed():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ErrorProvider+ErrorWindow.Update(System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ErrorProvider+ErrorWindow.Remove(System.Windows.Forms.ErrorProvider+ControlItem):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ErrorProvider+ErrorWindow.EnsureCreated():System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ErrorProvider+ErrorWindow.Add(System.Windows.Forms.ErrorProvider+ControlItem):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ErrorProvider+ErrorWindow..ctor(System.Windows.Forms.ErrorProvider,System.Windows.Forms.Control)")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolTip.GetMinTOOLINFO(System.Windows.Forms.Control):System.Windows.Forms.NativeMethods+TOOLINFO_TOOLTIP")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolTip.SetToolInfo(System.Windows.Forms.Control,System.String):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolTip.GetHandleCreated():System.Boolean")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolTip.SetTool(System.Windows.Forms.IWin32Window,System.String,System.Windows.Forms.ToolTip+TipInfo+Type,System.Drawing.Point):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolTip.GetWinTOOLINFO(System.IntPtr):System.Windows.Forms.NativeMethods+TOOLINFO_TOOLTIP")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolTip.DestroyHandle():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolTip.CreateHandle():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolTip.GetTOOLINFO(System.Windows.Forms.Control,System.String):System.Windows.Forms.NativeMethods+TOOLINFO_TOOLTIP")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolTip.get_Handle():System.IntPtr")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+LVGROUP..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ErrorProvider.ErrorManager_CurrentChanged(System.Object,System.EventArgs):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+TRACKMOUSEEVENT..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ToolStripDropDown.ReparentToDropDownOwnerWindow():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+LVTILEVIEWINFO..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+CHARFORMATA..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.BindToObject.CheckBinding():System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+CHARFORMATW..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+CHOOSECOLOR..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.WindowsFormsUtils.CreateMeasurementGraphics():System.Drawing.Graphics")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.PaintEventArgs.get_Graphics():System.Drawing.Graphics")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+NONCLIENTMETRICS..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.DataGridView.OnKeyDown(System.Windows.Forms.KeyEventArgs):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.DataGridView.DrawColHeaderShadow(System.Drawing.Graphics,System.Int32):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+HH_POPUP..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.NativeMethods+OPENFILENAME_I..ctor()")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ButtonInternal.CheckBoxBaseAdapter.GetCheckBoxImage(System.Drawing.Color,System.Drawing.Rectangle,System.Drawing.Color&,System.Drawing.Bitmap&):System.Drawing.Bitmap")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ButtonInternal.ButtonBaseAdapter+ColorOptions.Calculate():System.Windows.Forms.ButtonInternal.ButtonBaseAdapter+ColorData")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ButtonInternal.ButtonBaseAdapter.Draw3DLiteBorder(System.Drawing.Graphics,System.Drawing.Rectangle,System.Windows.Forms.ButtonInternal.ButtonBaseAdapter+ColorData,System.Boolean):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ButtonInternal.ButtonBaseAdapter.DrawFlatFocus(System.Drawing.Graphics,System.Drawing.Rectangle,System.Drawing.Color):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.ButtonInternal.ButtonBaseAdapter.PaintButtonBackground(System.Drawing.Graphics,System.Drawing.Rectangle,System.Windows.Forms.Internal.WindowsBrush):System.Void")] -[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.Windows.Forms.FileDialog.RunDialogOld(System.IntPtr):System.Boolean")] [assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Windows.Forms.ToolStripDropDownMenu..ctor(System.Windows.Forms.ToolStripItem)")] [assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.ToolStripDropDownMenu.ShortcutToText(System.Windows.Forms.Keys,System.String):System.String")] @@ -1186,19 +890,10 @@ [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.FontDialog.#ShouldSerializeFont()")] [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.FontDialog.#ToString()")] [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.FontDialog.#UpdateFont(System.Windows.Forms.NativeMethods+LOGFONT)")] -[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form+SecurityToolTip.#Dispose()")] -[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form+SecurityToolTip.#FormLocationChanged(System.Object,System.EventArgs)")] -[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form+SecurityToolTip.#Pop(System.Boolean)")] -[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form+SecurityToolTip.#RecreateHandle()")] -[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form+SecurityToolTip.#SetupToolTip()")] -[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form+SecurityToolTip.#Show()")] [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form.#CreateHandle()")] [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form.#GetAutoScaleSize(System.Drawing.Font)")] [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form.#get_ActiveForm()")] [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form.#get_TaskbarOwner()")] -[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form.#ResolveZoneAndSiteNames(System.Collections.ArrayList,System.String&,System.String&)")] -[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form.#RestrictedProcessNcActivate()")] -[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form.#SelectInternal(System.Boolean,System.Boolean)")] [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form.#Show(System.Windows.Forms.IWin32Window)")] [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form.#ShowDialog(System.Windows.Forms.IWin32Window)")] [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form.#UpdateMenuHandles(System.Windows.Forms.MainMenu,System.Boolean)")] @@ -1637,7 +1332,6 @@ [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.DataGridViewImageCell.#get_ErrorIcon()")] [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.ErrorProvider.#get_DefaultIcon()")] [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form.#get_DefaultIcon()")] -[module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Form.#get_DefaultRestrictedIcon()")] [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Internal.DeviceContext.#SelectFont(System.Windows.Forms.Internal.WindowsFont)")] [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Internal.DeviceContext.#SelectObject(System.IntPtr,System.Windows.Forms.Internal.GdiObjectType)")] [module: SuppressMessage("Microsoft.SideBySide", "CA710:ExposedResourcesMustBeConsumed", Scope = "member", Target = "System.Windows.Forms.Internal.WindowsPen.#get_HPen()")] diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStrip.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStrip.cs index 4303713ccab..461d9362ded 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStrip.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStrip.cs @@ -4231,94 +4231,103 @@ internal void SetLargestItemSize(Size size) { } - /// /// /// Afer we've performed a layout we need to reset the DisplayedItems and the OverflowItems collection. /// OverflowItems are not supported in layouts other than ToolStripSplitStack /// - protected virtual void SetDisplayedItems() { - this.DisplayedItems.Clear(); - this.OverflowItems.Clear(); + protected virtual void SetDisplayedItems() + { + DisplayedItems.Clear(); + OverflowItems.Clear(); HasVisibleItems = false; - - Size biggestItemSize = Size.Empty; // used in determining OnPaint caching. + Size biggestItemSize = Size.Empty; // used in determining OnPaint caching. - if (this.LayoutEngine is ToolStripSplitStackLayout) { - if (ToolStripGripStyle.Visible == GripStyle) { - this.DisplayedItems.Add(Grip); + if (LayoutEngine is ToolStripSplitStackLayout) + { + if (ToolStripGripStyle.Visible == GripStyle) + { + DisplayedItems.Add(Grip); SetupGrip(); - } + } - // for splitstack layout we re-arrange the items in the displayed items + // For splitstack layout we re-arrange the items in the displayed items // collection so that we can easily tab through them in natural order - Rectangle displayRect = this.DisplayRectangle; + Rectangle displayRect = DisplayRectangle; int lastRightAlignedItem = -1; - for (int pass=0; pass < 2; pass++) { + for (int pass = 0; pass < 2; pass++) + { int j = 0; - - if (pass == 1 /*add right aligned items*/) { - j = lastRightAlignedItem; + + if (pass == 1 /*add right aligned items*/) + { + j = lastRightAlignedItem; } // add items to the DisplayedItem collection. // in pass 0, we go forward adding the head (left) aligned items // in pass 1, we go backward starting from the last (right) aligned item we found - - for (; j >= 0 && j < Items.Count; j = (pass == 0) ? j+1 : j-1){ - + for (; j >= 0 && j < Items.Count; j = (pass == 0) ? j + 1 : j - 1) + { + ToolStripItem item = Items[j]; ToolStripItemPlacement placement = item.Placement; - if (((IArrangedElement)item).ParticipatesInLayout) { - if (placement == ToolStripItemPlacement.Main) { - bool addItem = false; - if (pass == 0) { // Align.Left items - addItem = (item.Alignment == ToolStripItemAlignment.Left); - if (!addItem) { + if (((IArrangedElement)item).ParticipatesInLayout) + { + if (placement == ToolStripItemPlacement.Main) + { + bool addItem = false; + if (pass == 0) + { // Align.Left items + addItem = (item.Alignment == ToolStripItemAlignment.Left); + if (!addItem) + { // stash away this index so we dont have to iterate through the whole list again. lastRightAlignedItem = j; - } - } - else if (pass == 1) { // Align.Right items - addItem = (item.Alignment == ToolStripItemAlignment.Right); - } - if (addItem) { - HasVisibleItems = true; - biggestItemSize = LayoutUtils.UnionSizes(biggestItemSize, item.Bounds.Size); - this.DisplayedItems.Add(item); - } - } - else if (placement == ToolStripItemPlacement.Overflow && !(item is ToolStripSeparator)) { - if (item is ToolStripControlHost && this.OverflowButton.DropDown.IsRestrictedWindow) { - // Control hosts cannot be added to the overflow in the Internet - // just set the placement to None. - item.SetPlacement(ToolStripItemPlacement.None); + } } - else { - this.OverflowItems.Add(item); + else if (pass == 1) + { + // Align.Right items + addItem = (item.Alignment == ToolStripItemAlignment.Right); } + if (addItem) + { + HasVisibleItems = true; + biggestItemSize = LayoutUtils.UnionSizes(biggestItemSize, item.Bounds.Size); + this.DisplayedItems.Add(item); + } + } + else if (placement == ToolStripItemPlacement.Overflow && !(item is ToolStripSeparator)) + { + this.OverflowItems.Add(item); } } - else { + else + { item.SetPlacement(ToolStripItemPlacement.None); } } - + } ToolStripOverflow overflow = GetOverflow(); - if (overflow != null) { + if (overflow != null) + { overflow.LayoutRequired = true; } - if (OverflowItems.Count ==0) { + if (OverflowItems.Count == 0) + { this.OverflowButton.Visible = false; } - else if (CanOverflow){ + else if (CanOverflow) + { this.DisplayedItems.Add(OverflowButton); } - + } - else { + else + { // NOT a SplitStack layout. We dont change the order of the displayed items collection // for custom keyboard handling override GetNextItem. Debug.WriteLineIf(LayoutDebugSwitch.TraceVerbose, "Setting Displayed Items: Current bounds: " + this.Bounds.ToString()); @@ -4326,30 +4335,34 @@ protected virtual void SetDisplayedItems() { // for all other layout managers, we ignore overflow placement bool allContained = true; - for (int j = 0; j < Items.Count; j++) { + for (int j = 0; j < Items.Count; j++) + { ToolStripItem item = Items[j]; if (((IArrangedElement)item).ParticipatesInLayout) - { + { item.ParentInternal = this; bool boundsCheck = !IsDropDown; bool intersects = item.Bounds.IntersectsWith(clientBounds); bool verticallyContained = clientBounds.Contains(clientBounds.X, item.Bounds.Top) && - clientBounds.Contains(clientBounds.X, item.Bounds.Bottom); - if (!verticallyContained) { - allContained = false; + clientBounds.Contains(clientBounds.X, item.Bounds.Bottom); + if (!verticallyContained) + { + allContained = false; } - if (!boundsCheck || intersects) { - HasVisibleItems = true; - biggestItemSize = LayoutUtils.UnionSizes(biggestItemSize, item.Bounds.Size); - this.DisplayedItems.Add(item); - item.SetPlacement(ToolStripItemPlacement.Main); + if (!boundsCheck || intersects) + { + HasVisibleItems = true; + biggestItemSize = LayoutUtils.UnionSizes(biggestItemSize, item.Bounds.Size); + this.DisplayedItems.Add(item); + item.SetPlacement(ToolStripItemPlacement.Main); } } - else { - item.SetPlacement(ToolStripItemPlacement.None); + else + { + item.SetPlacement(ToolStripItemPlacement.None); } Debug.WriteLineIf(LayoutDebugSwitch.TraceVerbose, item.ToString() + Items[j].Bounds); @@ -4362,7 +4375,6 @@ protected virtual void SetDisplayedItems() { SetLargestItemSize(biggestItemSize); } - /// /// Sets the current value of the specified bit in the control's state. diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripDropDown.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripDropDown.cs index 57dba0700bd..8da13d14376 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripDropDown.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripDropDown.cs @@ -67,57 +67,26 @@ public class ToolStripDropDown : ToolStrip { private static readonly int stateLayered = BitVector32.CreateMask(); private static readonly int stateAllowTransparency = BitVector32.CreateMask(stateLayered); - private static readonly int stateIsRestrictedWindow = BitVector32.CreateMask(stateAllowTransparency); - private static readonly int stateIsRestrictedWindowChecked = BitVector32.CreateMask(stateIsRestrictedWindow); - private static readonly int stateNotWorkingAreaConstrained = BitVector32.CreateMask(stateIsRestrictedWindowChecked); + private static readonly int stateNotWorkingAreaConstrained = BitVector32.CreateMask(stateAllowTransparency); private static readonly int stateInSetVisibleCore = BitVector32.CreateMask(stateNotWorkingAreaConstrained); - - - - /// - - - - - - - - - - - - - - - - - /// - /// - /// Summary of ToolStripDropDown. - /// - public ToolStripDropDown() { - if (DpiHelper.IsScalingRequirementMet) { + public ToolStripDropDown() + { + if (DpiHelper.IsScalingRequirementMet) + { scaledDefaultPadding = DpiHelper.LogicalToDeviceUnits(defaultPadding); } - // SECURITY NOTE: The IsRestrictedWindow check is done once and cached. We force it to happen here - // since we want to ensure the check is done on the code that constructs the ToolStripDropDown. - bool temp = IsRestrictedWindow; - - this.SuspendLayout(); + SuspendLayout(); Initialize(); - this.ResumeLayout(false); + ResumeLayout(false); } - - /// - /// - /// Summary of ToolStripDropDown. - /// - /// - internal ToolStripDropDown(ToolStripItem ownerItem): this() { + + internal ToolStripDropDown(ToolStripItem ownerItem): this() + { this.ownerItem = ownerItem; } + internal ToolStripDropDown(ToolStripItem ownerItem, bool isAutoGenerated) : this(ownerItem) { this.isAutoGenerated = isAutoGenerated; } @@ -575,32 +544,6 @@ internal bool IsAssignedToDropDownItem { } } - /// - /// - /// - /// Determines if this form should display a warning banner - /// when the form is displayed in an unsecure mode. - /// - [Browsable(false), EditorBrowsable(EditorBrowsableState.Advanced)] - internal bool IsRestrictedWindow { - get { - /// - if (!state[stateIsRestrictedWindowChecked]) { - state[stateIsRestrictedWindowChecked] = true; - state[stateIsRestrictedWindow] = false; -#if DEBUG - if (AlwaysRestrictWindows.Enabled) { - state[stateIsRestrictedWindow] = true; - return true; - } -#endif - } - - return state[stateIsRestrictedWindow]; - } - } - - internal override Size ImageScalingSizeInternal { get { if (IsAutoGenerated && OwnerToolStrip != null) { @@ -708,45 +651,41 @@ protected internal override Size MaxItemSize { } } - /// /// - /// Determines the opacity of the form. This can only be set on top level - /// controls. Opacity requires Windows 2000 or later, and is ignored on earlier - /// operating systems. + /// Determines the opacity of the form. This can only be set on top level controls. + /// Opacity requires Windows 2000 or later, and is ignored on earlier operating systems. /// - [ - SRCategory(nameof(SR.CatWindowStyle)), - TypeConverterAttribute(typeof(OpacityConverter)), - SRDescription(nameof(SR.FormOpacityDescr)), - DefaultValue(1.0), - Browsable(false), EditorBrowsable(EditorBrowsableState.Advanced) - ] - public double Opacity { - get { + [SRCategory(nameof(SR.CatWindowStyle))] + [TypeConverterAttribute(typeof(OpacityConverter))] + [SRDescription(nameof(SR.FormOpacityDescr))] + [DefaultValue(1.0)] + [Browsable(false), EditorBrowsable(EditorBrowsableState.Advanced)] + public double Opacity + { + get + { object opacity = Properties.GetObject(PropOpacity); - if (opacity != null) { + if (opacity != null) + { return Convert.ToDouble(opacity, CultureInfo.InvariantCulture); } - else { - return 1.0f; - } + + return 1.0f; } - set { - if (IsRestrictedWindow) { - value = Math.Max(value, .50f); - } - - if (value > 1.0) { + set + { + if (value > 1.0) + { value = 1.0f; } - else if (value < 0.0) { + else if (value < 0.0) + { value = 0.0f; } - + Properties.SetObject(PropOpacity, value); - + bool oldLayered = (state[stateLayered]); - if (OpacityAsByte < 255 && OSFeature.Feature.IsPresent(OSFeature.LayeredWindows)) { AllowTransparency = true; @@ -754,13 +693,14 @@ public double Opacity { } else { - state[stateLayered] = false; + state[stateLayered] = false; } if (oldLayered != (state[stateLayered])) { UpdateStyles(); } + UpdateLayered(); } } @@ -1049,18 +989,13 @@ public bool TopLevel { } // internally we use not so we dont have to initialize it. - internal bool WorkingAreaConstrained { - get { - if (state[stateNotWorkingAreaConstrained]) { - // - - return IsRestrictedWindow; - } - return true; - } - set { + internal bool WorkingAreaConstrained + { + get => true; + set + { bool notConstrained = !value; - state[stateNotWorkingAreaConstrained] = notConstrained; + state[stateNotWorkingAreaConstrained] = !value; } } @@ -1099,13 +1034,17 @@ private void CancelAutoExpand() { } } - internal override bool CanProcessMnemonic() { + internal override bool CanProcessMnemonic() + { // Dont let mnemonics act as keyboard input in IE in the internet. - if (IsRestrictedWindow && !Application.MessageLoop) { + if (Application.MessageLoop) + { return false; } + return base.CanProcessMnemonic(); } + /// protected override AccessibleObject CreateAccessibilityInstance() { return new ToolStripDropDownAccessibleObject(this); @@ -1161,17 +1100,7 @@ public void Close(ToolStripDropDownCloseReason reason) { SetCloseReason(reason); this.Visible = false; } - - internal override Rectangle ApplyBoundsConstraints(int suggestedX, int suggestedY, int proposedWidth, int proposedHeight) { - Rectangle adjustedBounds = base.ApplyBoundsConstraints(suggestedX, suggestedY, proposedWidth, proposedHeight); - - // - if (IsRestrictedWindow && TopMost) { - adjustedBounds = WindowsFormsUtils.ConstrainToScreenWorkingAreaBounds(adjustedBounds); - } - return adjustedBounds; - } /// /// Summary of GetBaseDropDownBounds. /// @@ -1579,49 +1508,45 @@ protected override bool ProcessDialogKey(Keys keyData) { return base.ProcessDialogKey(keyData); } + [EditorBrowsable(EditorBrowsableState.Advanced)] + protected override bool ProcessDialogChar(char charCode) + { + Debug.WriteLineIf(ControlKeyboardRouting.TraceVerbose, "ToolStripDropDown.ProcessDialogChar [" + charCode.ToString() + "]"); - - [EditorBrowsable(EditorBrowsableState.Advanced)] - protected override bool ProcessDialogChar(char charCode) { - #if DEBUG - Debug.WriteLineIf(ControlKeyboardRouting.TraceVerbose, "ToolStripDropDown.ProcessDialogChar [" + charCode.ToString() + "]"); - #endif - // since we're toplevel and arent a container control, we've got to do our own mnemonic handling. - // - if ((OwnerItem == null || OwnerItem.Pressed) && charCode != ' ') { - if (ProcessMnemonic(charCode)){ + // Since we're toplevel and arent a container control, we've got to do our own mnemonic handling. + if ((OwnerItem == null || OwnerItem.Pressed) && charCode != ' ') + { + if (ProcessMnemonic(charCode)) + { return true; - } - } - return base.ProcessDialogChar(charCode); - } - - protected internal override bool ProcessMnemonic(char charCode) { - if (!CanProcessMnemonic()) { - return false; // here for security see CanProcessMnemonic. - } - return base.ProcessMnemonic(charCode); - } - internal override void ProcessDuplicateMnemonic(ToolStripItem item, char charCode) { - if (!CanProcessMnemonic()) { - return; // here for security see CanProcessMnemonic. - } - if (item != null) { - // + } + } + return base.ProcessDialogChar(charCode); + } + protected internal override bool ProcessMnemonic(char charCode) + { + if (!CanProcessMnemonic()) + { + return false; + } + return base.ProcessMnemonic(charCode); + } + internal override void ProcessDuplicateMnemonic(ToolStripItem item, char charCode) + { + if (!CanProcessMnemonic()) + { + return; + } - - if (IsRestrictedWindow) { - item.ProcessMnemonic(charCode); // execute the first click - } - else { - base.ProcessDuplicateMnemonic(item,charCode); - } - } - } + if (item != null) + { + base.ProcessDuplicateMnemonic(item, charCode); + } + } internal override void RecreateHandleCore() { // If we're visible, then we'll have set our parent hwnd to the active control. @@ -1752,46 +1677,53 @@ private void SetTopLevelStyle(bool value) { } } - /// - /// - /// Summary of SetVisibleCore. - /// - /// - protected override void SetVisibleCore(bool visible) { - if (state[stateInSetVisibleCore]) { + protected override void SetVisibleCore(bool visible) + { + if (state[stateInSetVisibleCore]) + { return; } + state[stateInSetVisibleCore] = true; - try { - if (visible) { - if (LayoutRequired) { + try + { + if (visible) + { + if (LayoutRequired) + { LayoutTransaction.DoLayout(this, this, PropertyNames.Visible); } - bool openingEventCancelled = true; // assume that it's been cancelled so that if we throw we do nothing. - try { + // Assume that it's been cancelled so that if we throw we do nothing. + bool openingEventCancelled = true; + + try + { // Add opening event. - // Snap the foreground window BEFORE calling any user events so they dont have a - // chance to activate something else. This covers the case where someone handles the - // opening event and throws up a messagebox. - IntPtr foregroundWindow = UnsafeNativeMethods.GetForegroundWindow(); + // Snap the foreground window BEFORE calling any user events so they + // dont have a chance to activate something else. This covers the case + // where someone handles the opening event and throws up a messagebox. + IntPtr foregroundWindow = UnsafeNativeMethods.GetForegroundWindow(); // Fire Opening event - // Cancellable event in which default value of e.Cancel depends on the number of displayed items >0. - // - CancelEventArgs openEventArgs = new CancelEventArgs(/*cancel=*/(DisplayedItems.Count == 0)); - OnOpening(openEventArgs); + // Cancellable event in which default value of e.Cancel depends on + // the number of displayed items >0. + CancelEventArgs openEventArgs = new CancelEventArgs(cancel: DisplayedItems.Count == 0); + OnOpening(openEventArgs); openingEventCancelled = openEventArgs.Cancel; - - if (!openingEventCancelled) { + + if (!openingEventCancelled) + { // do the actual work to open the window. - if (TopLevel) { + if (TopLevel) + { ReparentToActiveToolStripWindow(); } - // review: what is this used for? - if (OwnerToolStrip != null) { + + if (OwnerToolStrip != null) + { OwnerToolStrip.ActiveDropDowns.Add(this); // the act of showing this window can cause a spurious mouse move // in the parent, make sure it retains where the mouse really was. @@ -1799,67 +1731,68 @@ protected override void SetVisibleCore(bool visible) { // Make sure that mouse capture // transitions between the owner and dropdown. - if (OwnerToolStrip.CaptureInternal) { + if (OwnerToolStrip.CaptureInternal) + { CaptureInternal = true; } - } - base.SetVisibleCore(visible); - if (TopLevel){ + } + base.SetVisibleCore(visible); + if (TopLevel) + { ApplyTopMost(true); } - else if (IsHandleCreated && SafeNativeMethods.IsWindowEnabled(new HandleRef(this, Handle))) { + else if (IsHandleCreated && SafeNativeMethods.IsWindowEnabled(new HandleRef(this, Handle))) + { SafeNativeMethods.SetWindowPos(new HandleRef(this, Handle), NativeMethods.HWND_TOP, 0, 0, 0, 0, NativeMethods.SWP_NOMOVE | NativeMethods.SWP_NOSIZE | NativeMethods.SWP_NOACTIVATE); } - } - } - finally { - // Fire Opened event - // fire the opened event only if we actually opened the control. - // - if (!openingEventCancelled) { + finally + { + // Fire the opened event only if we actually opened the control. + if (!openingEventCancelled) + { OnOpened(EventArgs.Empty); } } - } - else { - if (GetVisibleCore()) { + else + { + if (GetVisibleCore()) + { ToolStripDropDownCloseReason reason = closeReason; ResetCloseReason(); - - ToolStripDropDownClosingEventArgs e = new ToolStripDropDownClosingEventArgs(reason); + + var e = new ToolStripDropDownClosingEventArgs(reason); // Fire Closing Event // Cancel is prepopulated based on AutoClose feature. - // - if (e.CloseReason != ToolStripDropDownCloseReason.CloseCalled) { + if (e.CloseReason != ToolStripDropDownCloseReason.CloseCalled) + { e.Cancel = !AutoClose; } - else { + else + { e.Cancel = false; } - try { + try + { OnClosing(e); } - finally { - // - - - if (!e.Cancel || IsRestrictedWindow /*delay evaluate only in the case we need it*/) { - + finally + { + // delay evaluate only in the case we need it + if (!e.Cancel) + { // setting to not visible. Dismiss our child drop downs, reset, set ourselves visible false. DismissActiveDropDowns(); // Make sure we cancel auto expansion on the root ToolStrip topLevelToolStrip = GetToplevelOwnerToolStrip(); - ToolStrip parentToolStrip = null; - if (this.OwnerItem != null) { - parentToolStrip = this.OwnerItem.ParentInternal; - } + ToolStrip parentToolStrip = OwnerItem?.ParentInternal; + // We don't consider reason == ToolStripDropDownCloseReason.Keyboard here. // DropDown needs to be closed when Alt or ESC is pressed, // but these two keys are handled in ToolStrip.RestoreFocusInternal() @@ -1870,70 +1803,71 @@ protected override void SetVisibleCore(bool visible) { if ((reason == ToolStripDropDownCloseReason.AppClicked) || (reason == ToolStripDropDownCloseReason.ItemClicked) || (reason == ToolStripDropDownCloseReason.CloseCalled && topLevelToolStrip == parentToolStrip) || - (reason == ToolStripDropDownCloseReason.AppFocusChange && topLevelToolStrip == parentToolStrip)) { + (reason == ToolStripDropDownCloseReason.AppFocusChange && topLevelToolStrip == parentToolStrip)) + { CancelAutoExpand(); } // if this came through via a click event we should actually - // dismiss everyone in the chain. Other windows will recieve a - // close, closing event with reason AppFocusChange. This is by + // dismiss everyone in the chain. Other windows will recieve a + // close, closing event with reason AppFocusChange. This is by // design since the item wasnt clicked on that window. - if (reason == ToolStripDropDownCloseReason.ItemClicked) { + if (reason == ToolStripDropDownCloseReason.ItemClicked) + { // Preserve the SourceControl value up the chain. - this.saveSourceControl = true; - DismissAll(); + saveSourceControl = true; + DismissAll(); + // make sure that when we roll up, our owner item's selection is cleared. ToolStripItem rootOwnerItem = GetToplevelOwnerItem(); - if (rootOwnerItem != null) { - rootOwnerItem.Unselect(); - } + rootOwnerItem?.Unselect(); ToolStripManager.ModalMenuFilter.RemoveActiveToolStrip(this); - Debug.WriteLineIf(ToolStrip.SnapFocusDebug.TraceVerbose,"[ToolStripDropDown.SetVisibleCore] Exiting menu mode because item clicked"); + Debug.WriteLineIf(ToolStrip.SnapFocusDebug.TraceVerbose, "[ToolStripDropDown.SetVisibleCore] Exiting menu mode because item clicked"); ToolStripManager.ModalMenuFilter.ExitMenuMode(); } - else { + else + { ToolStripManager.ModalMenuFilter.RemoveActiveToolStrip(this); } - // snap our bounds, we'll need it for some invalidation later. Rectangle bounds = this.Bounds; - - try { + try + { base.SetVisibleCore(visible); } - finally { - - // remove ourselves from the active dropdown list. - if (OwnerToolStrip != null) { - OwnerToolStrip.ActiveDropDowns.Remove(this); - } + finally + { + // rRmove ourselves from the active dropdown list. + OwnerToolStrip?.ActiveDropDowns.Remove(this); ActiveDropDowns.Clear(); + // If the user traps the click event and starts // pumping their own messages by calling Application.DoEvents, we // should release mouse capture. - if (CaptureInternal) { + if (CaptureInternal) + { CaptureInternal = false; } } // Fire OnClosed. // if you make VisibleChanged throw you dont get closed. Sorry. - - ToolStripDropDownClosedEventArgs closedEventArgs = new ToolStripDropDownClosedEventArgs(reason); + var closedEventArgs = new ToolStripDropDownClosedEventArgs(reason); OnClosed(closedEventArgs); - - if (TopLevel && (!IsDisposed || !Disposing)) { + + if (TopLevel && (!IsDisposed || !Disposing)) + { // Parent back up to our DropDownOwnerWindow. ReparentToDropDownOwnerWindow(); } - - if (!this.saveSourceControl) { + if (!saveSourceControl) + { Debug.Assert(reason != ToolStripDropDownCloseReason.ItemClicked, "Why are we resetting SourceControl on a click event?"); @@ -1945,35 +1879,39 @@ protected override void SetVisibleCore(bool visible) { // We may be about to invoke a click event here... // if we're the topmost dropdown then invalidate our // intersection with the toplevel toolstrip - if (!DesignMode && IsFirstDropDown && OwnerItem != null && TopLevel) { + if (!DesignMode && IsFirstDropDown && OwnerItem != null && TopLevel) + { ToolStrip toolStrip = GetToplevelOwnerToolStrip(); - if (toolStrip != null && !(toolStrip.IsDisposed || toolStrip.Disposing)) { + if (toolStrip != null && !(toolStrip.IsDisposed || toolStrip.Disposing)) + { // translate the bounds (already in screen coords) to toolstrip. bounds.Location = toolStrip.PointToClient(bounds.Location); // find the intersection with the client and use that to invalidate bounds.Intersect(toolStrip.ClientRectangle); - - if (bounds.Width > 0 && bounds.Height >0) { + + if (bounds.Width > 0 && bounds.Height > 0) + { toolStrip.Invalidate(bounds); toolStrip.Update(); } } } - + } } } - else { + else + { ToolStripManager.ModalMenuFilter.RemoveActiveToolStrip(this); } } } - finally { - state[stateInSetVisibleCore] = false; - this.saveSourceControl = false; + finally + { + state[stateInSetVisibleCore] = false; + saveSourceControl = false; } - } private bool ShouldSerializeDefaultDropDownDirection() { @@ -2080,69 +2018,50 @@ internal void UnassignDropDownItem() { countDropDownItemsAssignedTo = Math.Max(--countDropDownItemsAssignedTo, 0); } - protected override void WndProc(ref Message m) { - - if (m.Msg >= NativeMethods.WM_KEYFIRST && m.Msg <= NativeMethods.WM_KEYLAST && IsRestrictedWindow) { - // - - - - - // NOTE the same kind of fix needs to go into ToolStripScrollButton.StickyLabel (the only alloewed ControlHost) - DefWndProc(ref m); - return; - } - switch (m.Msg) { - case NativeMethods.WM_NCACTIVATE: - // if someone clicks on a child control of the toolstrip dropdown, we want - // the title bar to continue appearing active. Normally we just show without - // taking window activation (ShowWindow(SHOWNOACTIVATE)) but we cant stop - // child controls from taking focus. - WmNCActivate(ref m); - return; - case NativeMethods.WM_ACTIVATE: - // This is the Chrome Panel collection editor scenario - // we had focus, then the Chrome panel was activated and we never went away - // when we get focus again, we should reactivate our message filter. - Debug.WriteLineIf(ToolStrip.SnapFocusDebug.TraceVerbose, "[ToolStripDropDown.WndProc] got a WM_ACTIVATE " + (((int)m.WParam == NativeMethods.WA_ACTIVE) ? "WA_ACTIVE" : "WA_INACTIVE") + " - checkin if we need to set the active toolstrip"); - - if((int)m.WParam == NativeMethods.WA_ACTIVE) { - if (this.Visible) { - if (ToolStripManager.ModalMenuFilter.GetActiveToolStrip() != this) { - // if we were inactive and now we are, we should enter menu mode - ToolStripManager.ModalMenuFilter.SetActiveToolStrip(this); - } - } - else { - Debug.Fail("Why are we being activated when we're not visible? Deactivating thingee is " + WindowsFormsUtils.GetControlInformation(m.LParam)); - } - } - else { - Debug.WriteLineIf(ToolStrip.SnapFocusDebug.TraceVerbose, "[ToolStripDropDown.WndProc] activating thingee is " + WindowsFormsUtils.GetControlInformation(m.LParam)); - } - - base.WndProc(ref m); - return; -/* case NativeMethods.WM_SYSKEYUP: - Keys keyData = (Keys)(int)m.WParam; - base.WndProc(ref m); - // handle the case where the ALT key has been pressed down while a dropdown - // was open. We need to clear off the MenuKeyToggle so the next ALT will activate - // the menu. - if (IsMenuKey(keyData)) { - ToolStrip toplevel = GetToplevelOwnerToolStrip(); - if (toplevel != null && toplevel.MenuKeyToggle) { - Debug.WriteLineIf(ToolStrip.SnapFocusDebug.TraceVerbose, "[ToolStripDropDown WM_SYSKEYUP]: Got Menu Key, restoring MenuKeyToggle."); - toplevel.MenuKeyToggle = false; + protected override void WndProc(ref Message m) + { + switch (m.Msg) + { + case NativeMethods.WM_NCACTIVATE: + // if someone clicks on a child control of the toolstrip dropdown, we want + // the title bar to continue appearing active. Normally we just show without + // taking window activation (ShowWindow(SHOWNOACTIVATE)) but we cant stop + // child controls from taking focus. + WmNCActivate(ref m); + return; + case NativeMethods.WM_ACTIVATE: + // This is the Chrome Panel collection editor scenario + // we had focus, then the Chrome panel was activated and we never went away + // when we get focus again, we should reactivate our message filter. + Debug.WriteLineIf(ToolStrip.SnapFocusDebug.TraceVerbose, "[ToolStripDropDown.WndProc] got a WM_ACTIVATE " + (((int)m.WParam == NativeMethods.WA_ACTIVE) ? "WA_ACTIVE" : "WA_INACTIVE") + " - checkin if we need to set the active toolstrip"); + + if ((int)m.WParam == NativeMethods.WA_ACTIVE) + { + if (Visible) + { + if (ToolStripManager.ModalMenuFilter.GetActiveToolStrip() != this) + { + // if we were inactive and now we are, we should enter menu mode + ToolStripManager.ModalMenuFilter.SetActiveToolStrip(this); + } + } + else + { + Debug.Fail("Why are we being activated when we're not visible? Deactivating thingee is " + WindowsFormsUtils.GetControlInformation(m.LParam)); } } - return;*/ - default: - base.WndProc(ref m); - return; - } + else + { + Debug.WriteLineIf(ToolStrip.SnapFocusDebug.TraceVerbose, "[ToolStripDropDown.WndProc] activating thingee is " + WindowsFormsUtils.GetControlInformation(m.LParam)); + } - } + base.WndProc(ref m); + return; + default: + base.WndProc(ref m); + return; + } + } #region DropDownSpecific diff --git a/src/System.Windows.Forms/tests/UnitTests/FormTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/FormTests.cs similarity index 51% rename from src/System.Windows.Forms/tests/UnitTests/FormTests.cs rename to src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/FormTests.cs index c81722cdab9..cce8883623e 100644 --- a/src/System.Windows.Forms/tests/UnitTests/FormTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/FormTests.cs @@ -12,12 +12,18 @@ namespace System.Windows.Forms.Tests public class FormTests { [Fact] - public void Form_Constructor() + public void Form_Ctor_Default() { var form = new Form(); - - // and & assert - Assert.NotNull(form); + Assert.False(form.Active); + Assert.Null(form.ActiveMdiChild); + Assert.False(form.AllowTransparency); +#pragma warning disable 0618 + Assert.True(form.AutoScale); +#pragma warning restore 0618 + Assert.Equal(AutoScaleMode.Inherit, form.AutoScaleMode); + Assert.False(form.AutoScroll); + Assert.False(form.AutoSize); Assert.False(form.IsRestrictedWindow); Assert.True(form.TopLevel); Assert.False(form.Visible); @@ -35,23 +41,19 @@ public void Form_AcceptButtonGetSet() Assert.Equal(mock.Object, form.AcceptButton); } - #region Activation - - /// - /// Data for the ActiveGetSet test - /// - public static TheoryData ActiveGetSetData => - CommonTestHelper.GetBoolTheoryData(); - [Theory] - [MemberData(nameof(ActiveGetSetData))] - public void Form_ActiveGetSet(bool expected) + [CommonMemberData(nameof(CommonTestHelper.GetBoolTheoryData))] + public void Form_Active_Set_GetReturnsExpected(bool value) { - var form = new Form(); - - form.Active = expected; - - Assert.Equal(expected, form.Active); + var form = new Form + { + Active = value + }; + Assert.Equal(value, form.Active); + + // Set same. + form.Active = value; + Assert.Equal(value, form.Active); } // non deterministic, commenting out for now @@ -120,86 +122,83 @@ public void Form_ActiveMdiChildGetSetChildNotEnabled() Assert.Null(form.ActiveMdiChild); } - [Fact] - public void Form_ActiveMdiChildNoSet() + [Theory] + [CommonMemberData(nameof(CommonTestHelper.GetBoolTheoryData))] + public void Form_AllowTransparency_Set_GetReturnsExpected(bool value) { - var form = new Form(); - - // act - - Assert.Null(form.ActiveMdiChild); + var form = new Form + { + AllowTransparency = value + }; + Assert.Equal(value, form.AllowTransparency); + + // Set same. + form.AllowTransparency = value; + Assert.Equal(value, form.AllowTransparency); } - #endregion - - /// - /// Data for the AllowTransparencyGetSet test - /// - public static TheoryData AllowTransparencyGetSetData => - CommonTestHelper.GetBoolTheoryData(); +#pragma warning disable 0618 [Theory] - [MemberData(nameof(AllowTransparencyGetSetData))] - public void Form_AllowTransparencyGetSet(bool expected) + [CommonMemberData(nameof(CommonTestHelper.GetBoolTheoryData))] + public void Form_AutoScale_Set_GetReturnsExpected(bool value) { - var form = new Form(); - - form.AllowTransparency = expected; - - Assert.Equal(expected, form.AllowTransparency); + var form = new Form + { + AutoScale = value + }; + Assert.Equal(value, form.AutoScale); + + // Set same. + form.AutoScale = value; + Assert.Equal(value, form.AutoScale); } - /// - /// Data for the AutoScaleModeGetSet test - /// - public static TheoryData AutoScaleModeGetSetData => - CommonTestHelper.GetEnumTheoryData(); +#pragma warning restore 0618 [Theory] - [MemberData(nameof(AutoScaleModeGetSetData))] - public void Form_AutoScaleModeGetSet(AutoScaleMode expected) + [CommonMemberData(nameof(CommonTestHelper.GetEnumTypeTheoryData), typeof(AutoScaleMode))] + public void Form_AutoScaleMode_Set_GetReturnsExpected(AutoScaleMode value) { - var form = new Form(); - - form.AutoScaleMode = expected; - - Assert.Equal(expected, form.AutoScaleMode); + var form = new Form + { + AutoScaleMode = value + }; + Assert.Equal(value, form.AutoScaleMode); + + // Set same. + form.AutoScaleMode = value; + Assert.Equal(value, form.AutoScaleMode); } - /// - /// Data for the AutoScrollGetSet test - /// - public static TheoryData AutoScrollGetSetData => - CommonTestHelper.GetBoolTheoryData(); - [Theory] - [MemberData(nameof(AutoScrollGetSetData))] - public void Form_AutoScrollGetSet(bool expected) + [CommonMemberData(nameof(CommonTestHelper.GetBoolTheoryData))] + public void Form_AutoScroll_Set_GetReturnsExpected(bool value) { - var form = new Form(); - - form.AutoScroll = expected; - - Assert.Equal(expected, form.AutoScroll); + var form = new Form + { + AutoScroll = value + }; + Assert.Equal(value, form.AutoScroll); + + // Set same. + form.AutoScroll = value; + Assert.Equal(value, form.AutoScroll); } - /// - /// Data for the AutoSizeGetSet test - /// - public static TheoryData AutoSizeGetSetData => - CommonTestHelper.GetBoolTheoryData(); - [Theory] - [MemberData(nameof(AutoSizeGetSetData))] - public void Form_AutoSizeGetSet(bool expected) + [CommonMemberData(nameof(CommonTestHelper.GetBoolTheoryData))] + public void Form_AutoSizeSet_GetReturnsExpected(bool value) { - var form = new Form(); - - form.AutoSize = expected; - - Assert.Equal(expected, form.AutoSize); + var form = new Form + { + AutoSize = value + }; + Assert.Equal(value, form.AutoSize); + + // Set same. + form.AutoSize = value; + Assert.Equal(value, form.AutoSize); } - - } }