Back to Devexpress

Implement Alpha Blending by Customizing Appearances

windowsforms-5665-controls-and-libraries-tree-list-feature-center-appearances-and-look-and-feel-alpha-blending-implement-alpha-blending-by-customizing-appearances.md

latest1.8 KB
Original Source

Implement Alpha Blending by Customizing Appearances

  • Oct 29, 2020
  • 2 minutes to read

You can assign transparency to Tree List elements via appearance properties provided by the Tree List control and its columns. These properties are:

When providing transparent or semi-transparent background colors for the Tree List rows, columns and/or empty area, an end-user will be able to see the control’s background.

Example

  1. Assign a background image to the Tree List control from its BackgroundImage property:

  2. Invoke the Tree List Designer and switch to the Appearances page.

  3. Now select the Row item in the Appearances listbox, and set the BackColor property to a semi-transparent light-brown color, (e.g., “150, 209, 157, 139”).

  4. Run the project and see the result:

The following is the runtime code for the design-time actions illustrated above.

csharp
treeList1.BackgroundImage = Image.FromFile("C:\\Images\\bg6.png");
treeList1.Appearance.Empty.BackColor = Color.Transparent;
treeList1.Appearance.Row.BackColor = Color.FromArgb(150, 209, 157, 139);
vb
TreeList1.BackgroundImage = Image.FromFile("C:\Images\bg6.png")
TreeList1.Appearance.Empty.BackColor = Color.Transparent
TreeList1.Appearance.Empty.BackColor = Color.FromArgb(150, 209, 157, 139)