tất cả các bất biến được thành lập bởi các nhà xây dựng thực tế và nó không cho phép một kẻ tấn công để truy cập những phần bên trong của đối tượng đang được xây dựng. Dựa vào cơ chế deserialization mặc định dễ dàng có thể để lại các đối tượng tham nhũng bất biến và truy cập bất hợp pháp | KnownColor Enumeration Field Value Field Value GrayText 12 AliceBlue 28 Highlight 13 Antiquewhite 29 HighlightText 14 HotTrack 15 Yellow 166 InactiveBorder 16 YellowGreen 167 Although KnownColor is the third la gest enumeration in the entire .NET F amewo k it s not used fo very much. The Color class has a static method that lets you c eate a colo based on a KnownColor value but if that s something you need it p obably makes mo e sense to use one of the static Color o SystemColors p ope ties. What to Use Somewhe e in the const ucto fo the Control class the following code is p obably executed BackColor ForeColor What the Control and ControlText system colo s a e is enti ely up to the use . No mally they e g ay and black espectively. When a button cont ol fo example d aws itself it uses the BackColor p ope ty to colo its backg ound and the ForeColor p ope ty to display the button text. A Form object uses the BackColor p ope ty to e ase the backg ound of the client a ea but doesn t itself use the ForeColor p ope ty. That p ope ty is made available fo applications inhe iting o instantiating Form. So the question is What b ush should you be using to d aw text I think I ve p etty well established that it s not . A much bette choice would be . Howeve I m not so su e that s optimum eithe . Conside this question Why a e the BackColor and ForeColor p ope ties of Form set to the system colo s used fo cont ols The answe is because the Windows Fo ms develope s have assumed that you ll be cove ing a fo m with cont ols o using a fo m fo a dialog box. If you e not putting cont ols on a fo m though and if you want you fo m to look like a egula old Windows p og am you should be putting the following two statements in the const ucto fo you fo m BackColor ForeColor In that case the Drawstring calls in you OnPaint code should use SystemBrushes. WindowText to be