Code
TD.SandBar.MenuBar menuBar;
TD.SandBar.SandBarManager sandBarManager;
TD.SandBar.ToolBarContainer topSandBarDock;
TD.SandBar.ToolBar toolBarView;
private void Form1_Load(object sender, EventArgs e)
{
//窗体布局控件初始化;
menuBar = new TD.SandBar.MenuBar();
sandBarManager = new TD.SandBar.SandBarManager();
topSandBarDock = new TD.SandBar.ToolBarContainer();
toolBarView = new TD.SandBar.ToolBar();
//menuBar
this.menuBar.Movable = false;
this.menuBar.Name = "menuBar";
this.menuBar.OwnerForm = this;
//toolBarView
this.toolBarView.DockLine = 1;
this.toolBarView.DrawActionsButton = false;
this.toolBarView.Name = "toolBarView";
//sandBarManager
this.sandBarManager.OwnerForm = this;
//topSandBarDock
this.topSandBarDock.Controls.Add(toolBarView);
this.topSandBarDock.Controls.Add(this.menuBar);
this.topSandBarDock.Dock = System.Windows.Forms.DockStyle.Top;
this.topSandBarDock.Manager = this.sandBarManager;
this.topSandBarDock.Name = "topSandBarDock";
// 添加子窗体
this.Controls.Add(topSandBarDock);
CreateMenu();
CreateToolBarView();
}
public void CreateToolBarView()
{
TD.SandBar.ButtonItem zoomAll = new TD.SandBar.ButtonItem();
zoomAll.Text = "全图";
zoomAll.ToolTipText = "全图";
zoomAll.Tag = String.Format("{0}", 1);
//zoomAll.Image = Bitmap.FromFile("");
toolBarView.Text = "查看工具栏";
toolBarView.Items.Add(zoomAll);
}
public void CreateMenu()
{
// menuBarItem
TD.SandBar.MenuBarItem mnuView = new TD.SandBar.MenuBarItem();
mnuView.Text = "查看";
// menuButtonItem
TD.SandBar.MenuButtonItem mnuZoomIn = new TD.SandBar.MenuButtonItem();
mnuZoomIn.ToolTipText = "放大地图";
mnuZoomIn.Text = "放大";
mnuView.Items.Add(mnuZoomIn);
this.menuBar.Items.Add(mnuView);
}
TD.SandBar.MenuBar menuBar;
TD.SandBar.SandBarManager sandBarManager;
TD.SandBar.ToolBarContainer topSandBarDock;
TD.SandBar.ToolBar toolBarView;
private void Form1_Load(object sender, EventArgs e)
{
//窗体布局控件初始化;
menuBar = new TD.SandBar.MenuBar();
sandBarManager = new TD.SandBar.SandBarManager();
topSandBarDock = new TD.SandBar.ToolBarContainer();
toolBarView = new TD.SandBar.ToolBar();
//menuBar
this.menuBar.Movable = false;
this.menuBar.Name = "menuBar";
this.menuBar.OwnerForm = this;
//toolBarView
this.toolBarView.DockLine = 1;
this.toolBarView.DrawActionsButton = false;
this.toolBarView.Name = "toolBarView";
//sandBarManager
this.sandBarManager.OwnerForm = this;
//topSandBarDock
this.topSandBarDock.Controls.Add(toolBarView);
this.topSandBarDock.Controls.Add(this.menuBar);
this.topSandBarDock.Dock = System.Windows.Forms.DockStyle.Top;
this.topSandBarDock.Manager = this.sandBarManager;
this.topSandBarDock.Name = "topSandBarDock";
// 添加子窗体
this.Controls.Add(topSandBarDock);
CreateMenu();
CreateToolBarView();
}
public void CreateToolBarView()
{
TD.SandBar.ButtonItem zoomAll = new TD.SandBar.ButtonItem();
zoomAll.Text = "全图";
zoomAll.ToolTipText = "全图";
zoomAll.Tag = String.Format("{0}", 1);
//zoomAll.Image = Bitmap.FromFile("");
toolBarView.Text = "查看工具栏";
toolBarView.Items.Add(zoomAll);
}
public void CreateMenu()
{
// menuBarItem
TD.SandBar.MenuBarItem mnuView = new TD.SandBar.MenuBarItem();
mnuView.Text = "查看";
// menuButtonItem
TD.SandBar.MenuButtonItem mnuZoomIn = new TD.SandBar.MenuButtonItem();
mnuZoomIn.ToolTipText = "放大地图";
mnuZoomIn.Text = "放大";
mnuView.Items.Add(mnuZoomIn);
this.menuBar.Items.Add(mnuView);
}