Follow these steps to create image side-bar for an popup menu:
- Create your menu as usual using DotNetBar designer or code
- In the form that is hosting DotNetBarManager add new Form.Load event handler
- Get the reference to the item that is parent of your popup menu
- Assign to the PopUpSideBar property new instance of the SideBarImage structure that describes your side-bar
Following code is taken from Popup sample that shows how to assign the side-bar image to an popup menu:
VB
.
.
.
' Setup side-bar, make sure that image that is used fits, or exceeds the height
' Side-bar will be displayed only for popup menus
Dim si As DevComponents.DotNetBar.SideBarImage
si = New DevComponents.DotNetBar.SideBarImage()
si.Picture = New Bitmap(Me.GetType(), "devco.jpg")
' If image exceeds the size of the popup menu this specifies the image alignment
si.Alignment = DevComponents.DotNetBar.eAlignment.Bottom
' If there is no image specified gradient can be used
si.GradientColor1 = Color.Orange
si.GradientColor2 = Color.Black
myParentPopupItem.PopUpSideBar = si
.
.
.
C#
.
.
.
// Setup side-bar, make sure that image that is used fits, or exceeds the height
// Side-bar will be displayed only for popup menus
DevComponents.DotNetBar.SideBarImage si=new DevComponents.DotNetBar.SideBarImage();
si.Picture=new Bitmap(typeof(Popup.Form1),"devco.jpg");
// If image exceeds the size of the popup menu this specifies the image alignment
si.Alignment=DevComponents.DotNetBar.eAlignment.Bottom;
// If there is no image specified gradient can be used
si.GradientColor1=Color.Orange;
si.GradientColor2=Color.Black;
myParentPopupItem.PopUpSideBar=si;
You can find working example of menu side-bar and associated code in Popup sample.
