Home > .Net Framework > .Net other > C# / WinForm set transparent or translucent controls the background color

C# / WinForm set transparent or translucent controls the background color

generative-art The.Net framework on the transparent color with very good support, in the Color class constructor, then the incoming said transparency alpha parameters.

But in the inheritance and System.Windows.Form.Control controls, can set the BackColor transparency, investigate its reason is unknown, but can be accomplished by means to make them perfect support transparent.

In the custom inheritance and   System.Windows.Form.Control type control code constructor, add control Windows style code as follows:

SetStyle (ControlStyles.SupportsTransparentBackColor, true);

The code can make controls can support a transparent color to the background, and then set the background color of the time, can be used to control the background transparency transparent:

BackColor = Color.FromArgb (50, 40, 60, 82);

Color.FromArgb the first parameter of the method is transparent value, value between 0-255, behind the three parameter is the RGB color component.

The strange thing is that, this method can make the inheritance and System.Windows.Forms.TextBox custom text box to produce translucent background, for an unknown reason, know why friends can make a explanation in the comments.

Winform flowery Dev control

Used to do WinForm, has been entangled dev component, dev component is too strong, but the general solution is the development of machine not to have ...
2012-10-08 20:24 Tags: web-to-winforms 3rd-party-controls

C# inherit Control practical custom controls

Start Step one: new library project, the new FirstControl.cs Using  System; Using  System.Collections.Generic; Using  System.Linq; ...
2012-10-08 20:28 Tags: class-table-inheritance 3rd-party-controls android-custom-view

C# inherits the basic control to realize custom controls

Custom control is divided into three categories: 1: basic control composite control assembly.Inherit from UserControl 2 extended controls: inherited...
2012-10-08 20:03 Tags: basic 3rd-party-controls android-custom-view

Winform development framework of HTML edit control

We know, doing Web development time, many controls can be used to make HTML content editing, Winform development is relatively less, but a lot of time...
2012-10-08 20:05 Tags: web-to-winforms agile-development .NET Framework .cshtml ace-editor 3rd-party-controls Read More ​»

Winform development framework of the document set of play

Early on in my next article "Web print solutions sets of documents to play", introduced based on the Web certificate printing; in my code generation t...
2012-10-08 20:15 Tags: web-to-winforms agile-development .NET Framework activex-documents airplay Read More ​»

Related Topics