This document is archived and information here might be outdated. Recommended version. |
Indicates if the ToolbarControl has a transparent background.
[Visual Basic .NET]
Public Property Transparent As Boolean
[C#]
public bool Transparent {get; set;}
[C++]
HRESULT get_Transparent(
void
);
[C++]
HRESULT put_Transparent(
);
Determines whether the background of the ToolbarControl is transparent. This property is false by default.
When Transparent is true, the parent window containing the ToolbarControl must not clip children windows for transparency to work. This ensures the area of the window under the ToolbarControl gets painted.
The BackColor, FadeColor and FillDirection properties do not affect the visual appearance of the ToolbarControl when Transparent is set to true.
public class
Form1 : System.Windows.Forms.Form { [DllImport("User32", CharSet=CharSet.Auto)]private static extern int
GetWindowLong(IntPtr hWnd,int
Index); [DllImport("User32", CharSet=CharSet.Auto)]private static extern int
SetWindowLong(IntPtr hWnd,int
Index,int
Value);const int
GWL_STYLE = -16;const int
WS_CLIPCHILDREN = 0x02000000;private void
Form1_Load(object
sender, System.EventArgs e) {//Set label to not clip controls so ToolbarControl background is re-painted
int
style = GetWindowLong(myTransparentLabel.Handle, GWL_STYLE); SetWindowLong(myTransparentLabel.Handle, GWL_STYLE, style & ~WS_CLIPCHILDREN);//Set the ToolbarControl to be transparent
axToolbarControl1.Transparent = true;//Set the ToolbarControl to be a child control of the label
axToolbarControl1.Parent = myTransparentLabel; } }
Public Class
Form1Inherits
System.Windows.Forms.Form <DllImport("User32", CharSet:=CharSet.Auto)> _Public Shared Function
GetWindowLong(ByVal
hWndAs Integer
,ByVal
indexAs Integer
)As Integer End Function
<DllImport("User32", CharSet:=CharSet.Auto)> _Public Shared Function
SetWindowLong(ByVal
hwndAs Integer
,ByVal
indexAs Integer
,ByVal
valueAs Integer
)As Integer End Function Const
GWL_STYLEAs
Int32 = (-16)Const
WS_CLIPCHILDREN = &H2000000Private Sub
Form1_Load(ByVal
senderAs
System.Object,ByVal
eAs
System.EventArgs)Handles
MyBase.Load'Set label to not clip controls so ToolbarControl background is re-painted
Dim
styleAs Integer
= GetWindowLong(myTransparentLabel.Handle.ToInt32, GWL_STYLE) SetWindowLong(myTransparentLabel.Handle.ToInt32, GWL_STYLE, styleAnd Not
WS_CLIPCHILDREN)'Set the ToolbarControl to be transparent
AxToolbarControl1.Transparent =True
'Set the ToolbarControl to be a child control of the label
AxToolbarControl1.Parent = myTransparentLabelEnd Sub End
Class