![]() |
This document is archived and information here might be outdated. Recommended version. |
| ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > IToolbarControl2 Interface > IToolbarControl2.Transparent Property (ArcObjects .NET 10.4 SDK) |
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(
VARIANT_BOOL* pVal
);
[C++]
HRESULT put_Transparent(
VARIANT_BOOL pVal
);
[C++]
Parameters pVal [out, retval] pVal is a parameter of type VARIANT_BOOL pVal [in] pVal is a parameter of type VARIANT_BOOL
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 classForm1 : System.Windows.Forms.Form { [DllImport("User32", CharSet=CharSet.Auto)]private static extern intGetWindowLong(IntPtr hWnd,intIndex); [DllImport("User32", CharSet=CharSet.Auto)]private static extern intSetWindowLong(IntPtr hWnd,intIndex,intValue);const intGWL_STYLE=-16;const intWS_CLIPCHILDREN=0x02000000;private voidForm1_Load(objectsender, System.EventArgs e) {//Set label to not clip controls so ToolbarControl background is re-paintedintstyle=GetWindowLong(myTransparentLabel.Handle, GWL_STYLE); SetWindowLong(myTransparentLabel.Handle, GWL_STYLE, style & ~WS_CLIPCHILDREN);//Set the ToolbarControl to be transparentaxToolbarControl1.Transparent=true;//Set the ToolbarControl to be a child control of the labelaxToolbarControl1.Parent=myTransparentLabel; } }
Alternatively, add the following code to the containing windows form to disable 'WS_CLIPCHILDREN'.
protected overrideCreateParams CreateParams { get { CreateParams createParams=base.CreateParams;const intWS_CLIPCHILDREN=0x02000000; createParams.Style &= ~WS_CLIPCHILDREN;returncreateParams; } }
Public ClassForm1InheritsSystem.Windows.Forms.Form <DllImport("User32", CharSet:=CharSet.Auto)> _Public Shared FunctionGetWindowLong(ByValhWndAs Integer,ByValindexAs Integer)As Integer End Function<DllImport("User32", CharSet:=CharSet.Auto)> _Public Shared FunctionSetWindowLong(ByValhwndAs Integer,ByValindexAs Integer,ByValvalueAs Integer)As Integer End Function ConstGWL_STYLEAsInt32=(-16)ConstWS_CLIPCHILDREN=&H2000000Private SubForm1_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load'Set label to not clip controls so ToolbarControl background is re-paintedDimstyleAs Integer=GetWindowLong(myTransparentLabel.Handle.ToInt32, GWL_STYLE) SetWindowLong(myTransparentLabel.Handle.ToInt32, GWL_STYLE, styleAnd NotWS_CLIPCHILDREN)'Set the ToolbarControl to be transparentAxToolbarControl1.Transparent=True'Set the ToolbarControl to be a child control of the labelAxToolbarControl1.Parent=myTransparentLabelEnd Sub EndClass
Alternatively, add the following code to the containing windows form to disable 'WS_CLIPCHILDREN'.
Protected Overloads Overrides ReadOnly PropertyCreateParams()AsCreateParamsGet DimcreateParametersAsCreateParams=MyBase.CreateParamsConstWS_CLIPCHILDRENAs Integer=33554432 createParameters.Style=createParameters.StyleAnd NotWS_CLIPCHILDRENReturncreateParametersEnd Get EndProperty