public override void ZoomFont(Control control, ZoomFontInfo infos) { control.Font = infos.Zoom(control.Font); C1MainMenu menu = control as C1MainMenu; ZoomCommandLinksFont(infos, menu.CommandLinks); }
private void AddFixMenu(C1MainMenu mainMenu) { var commMenu = this.AddMainLink(mainMenu, "系统"); var commenu = this.AddLink(commMenu, new ND_MENU() { MENUCAPTION = "重新登录", SYSTEMNAME = "SYS" }); }
private C1CommandMenu AddMainLink(C1MainMenu mainMenu, string menuname) { C1CommandMenu commandMenu = new C1CommandMenu(); C1.Win.C1Command.C1CommandLink link = new C1.Win.C1Command.C1CommandLink(); link.Text = menuname; link.Command = commandMenu; mainMenu.CommandLinks.AddRange(new C1.Win.C1Command.C1CommandLink[] { link }); commandHolder.Commands.Add(commandMenu); return(commandMenu); }
public override IEnumerable <Control> GetChildren(Control control) { List <Control> controls = new List <Control>(); foreach (Control child in control.Controls) { controls.Add(child); } C1MainMenu menu = control as C1MainMenu; AddChildren(controls, menu.CommandLinks); return(controls); }
private void AddMainMenu(C1MainMenu mainMenu, List <ND_MENU> menus) { AddFixMenu(mainMenu); var list = (from m in menus where m.PARENTID == -1 orderby m.SORTID select m).Take(20).ToList(); foreach (ND_MENU m in list) { var commMenu = this.AddMainLink(mainMenu, m.MENUCAPTION); AddMenu(commMenu, menus, m.Id); } }
public static Control CreateControl(string zoomPolicy, Font font, Size layoutSize) { switch (zoomPolicy) { case "C1ChartZoomPolicy": C1ChartSample chart1 = new C1ChartSample(); chart1.Dock = DockStyle.Fill; return(chart1); case "C1Chart3DZoomPolicy": C1Charts3DSample chart3d1 = new C1Charts3DSample(); chart3d1.Dock = DockStyle.Fill; return(chart3d1); case "C1FlexGridZoomPolicy": FlexGridSample flexGridSample1 = new FlexGridSample(); flexGridSample1.c1FlexGrid1.Dock = DockStyle.Fill; return(flexGridSample1.c1FlexGrid1); case "C1TrueDBGridZoomPolicy": C1TrueDBGrid trueDBGrid1 = new C1TrueDBGrid(); trueDBGrid1.BackColor = Color.AliceBlue; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ZoomPolicyDemo)); trueDBGrid1.GroupByCaption = "Drag a column header here to group by that column"; trueDBGrid1.Name = "c1TrueDBGrid1"; trueDBGrid1.Dock = DockStyle.Fill; trueDBGrid1.TabAction = C1.Win.C1TrueDBGrid.TabActionEnum.GridNavigation; trueDBGrid1.TabIndex = 0; trueDBGrid1.Text = "c1TrueDBGrid1"; trueDBGrid1.PropBag = resources.GetString("c1TrueDBGrid_bag"); trueDBGrid1.AllowFilter = false; trueDBGrid1.VisualStyle = C1.Win.C1TrueDBGrid.VisualStyle.Office2007Blue; return(trueDBGrid1); case "C1PrintPreviewControlZoomPolicy": C1PrintPreviewControlSample printPreviewSample = new C1PrintPreviewControlSample(); printPreviewSample.Dock = DockStyle.Fill; return(printPreviewSample); case "C1RibbonZoomPolicy": C1RibbonSample ribbonSample1 = new C1RibbonSample(); ribbonSample1.Dock = DockStyle.Fill; return(ribbonSample1); case "C1StatusBarZoomPolicy": C1.Win.C1Ribbon.C1StatusBar c1StatusBar1 = new C1.Win.C1Ribbon.C1StatusBar(); C1.Win.C1Ribbon.RibbonLabel DocumentModifiedLabel = new C1.Win.C1Ribbon.RibbonLabel(); C1.Win.C1Ribbon.RibbonLabel zoomLabel1 = new C1.Win.C1Ribbon.RibbonLabel(); C1.Win.C1Ribbon.RibbonTrackBar ZoomTrackBar1 = new C1.Win.C1Ribbon.RibbonTrackBar(); c1StatusBar1.LeftPaneItems.Add(DocumentModifiedLabel); c1StatusBar1.RightPaneItems.Add(ZoomTrackBar1); c1StatusBar1.RightPaneItems.Add(zoomLabel1); c1StatusBar1.RightPaneWidth = 180; c1StatusBar1.Text = "Ready"; c1StatusBar1.VisualStyle = C1.Win.C1Ribbon.VisualStyle.Office2010Blue; // // DocumentModifiedLabel // DocumentModifiedLabel.Text = "Edit"; // // ZoomTrackBar1 // ZoomTrackBar1.Maximum = 1000; ZoomTrackBar1.Minimum = 10; ZoomTrackBar1.Value = 100; // // zoomLabel1 // zoomLabel1.FontPadding = C1.Win.C1Ribbon.FontPadding.Yes; zoomLabel1.Text = "100%"; return(c1StatusBar1); case "C1CalendarZoomPolicy": C1.Win.C1Schedule.C1Calendar c1Calendar1 = new C1.Win.C1Schedule.C1Calendar(); ZoomPolicyProviderBase.PutControlInCenter(c1Calendar1, layoutSize); return(c1Calendar1); case "C1ScheduleZoomPolicy": C1.Win.C1Schedule.C1Schedule c1Schedule1 = new C1.Win.C1Schedule.C1Schedule(); c1Schedule1.Dock = DockStyle.Fill; return(c1Schedule1); case "C1MainMenuZoomPolicy": C1MainMenu c1MainMenu1 = new C1MainMenu(); C1CommandLink commandLink1 = new C1CommandLink(); C1CommandMenu commandMenu1 = new C1CommandMenu(); commandMenu1.Font = new Font(c1MainMenu1.Font.FontFamily, 12); commandMenu1.Text = "commandMenu1"; commandLink1.Command = commandMenu1; c1MainMenu1.CommandLinks.Add(commandLink1); return(c1MainMenu1); case "C1DockingTabZoomPolicy": C1DockingTab dockingTab1 = new C1DockingTab(); C1DockingTabPage dockintTabPage1 = new C1DockingTabPage(); C1DockingTabPage dockintTabPage2 = new C1DockingTabPage(); C1DockingTabPage dockintTabPage3 = new C1DockingTabPage(); C1DockingTabPage dockintTabPage4 = new C1DockingTabPage(); dockintTabPage1.Text = "TabPage1"; dockintTabPage2.Text = "TabPage2"; dockintTabPage3.Text = "TabPage3"; dockintTabPage4.Text = "TabPage4"; dockingTab1.Controls.Add(dockintTabPage1); dockingTab1.Controls.Add(dockintTabPage2); dockingTab1.Controls.Add(dockintTabPage3); dockingTab1.Controls.Add(dockintTabPage4); dockingTab1.ItemSize = new Size(80, 20); dockingTab1.SplitterWidth = 5; dockingTab1.TabAreaSpacing = 5; dockingTab1.TabsSpacing = 5; return(dockingTab1); case "C1NavBarPolicy": C1NavBarSample navBarSample1 = new C1NavBarSample(); navBarSample1.Dock = DockStyle.Fill; return(navBarSample1); case "C1OutBarZoomPolicy": C1OutBarSample outBarSample1 = new C1OutBarSample(); outBarSample1.Dock = DockStyle.Fill; return(outBarSample1); default: break; } return(null); }
public override void ZoomBounds(Control control, ZoomBoundsInfo infos) { C1MainMenu menu = control as C1MainMenu; ZoomCommandLinksBounds(infos, menu.CommandLinks); }
private void Form1_Load(object sender, System.EventArgs e) { C1CommandHolder ch = C1CommandHolder.CreateCommandHolder(this); // In this sample, we use a single event handler for all commands, // and use a switch statement inside that handler to select the specific // action. Alternatively, each command can be assigned its own Click // event handler. Or, a mix of the two approaches is possible. ch.CommandClick += new CommandClickEventHandler(CommandClickHandler); // use the image list for command images ch.ImageList = this.imageList1; // modern look: ch.LookAndFeel = LookAndFeelEnum.Office2003; C1MainMenu mm = new C1MainMenu(); this.Controls.Add(mm); // For the main menu, its CommandHolder property should be set // (this is not required for builds 1.0.20041.47 or later of C1Command). mm.CommandHolder = ch; // Main menu - File C1CommandMenu mFile = (C1CommandMenu)ch.CreateCommand(typeof(C1CommandMenu)); mFile.Text = "&File"; mm.CommandLinks.Add(new C1CommandLink(mFile)); // create commands for file ops C1Command cNew = ch.CreateCommand(); cNew.Text = "&New"; // UserData is arbitrary data associated with commands; // In this example we use text labels to recognize specific commands // in the single command handler. Alternatively, we could have commands // as members of our class, and compare objects to recognize commands. cNew.UserData = "file_new"; cNew.Shortcut = Shortcut.CtrlN; cNew.ImageIndex = 1; C1Command cOpen = ch.CreateCommand(); cOpen.Text = "&Open"; cOpen.UserData = "file_open"; cOpen.Shortcut = Shortcut.CtrlO; cOpen.ImageIndex = 0; C1Command cExit = ch.CreateCommand(); cExit.Text = "E&xit"; cExit.UserData = "exit"; cExit.Shortcut = Shortcut.CtrlX; mFile.CommandLinks.Add(new C1CommandLink(cNew)); mFile.CommandLinks.Add(new C1CommandLink(cOpen)); mFile.CommandLinks.Add(new C1CommandLink()); mFile.CommandLinks[mFile.CommandLinks.Count - 1].Text = "-"; mFile.CommandLinks.Add(new C1CommandLink(cExit)); // Main menu - Window C1CommandMenu mWindow = (C1CommandMenu)ch.CreateCommand(typeof(C1CommandMenu)); mWindow.Text = "&Window"; mm.CommandLinks.Add(new C1CommandLink(mWindow)); C1Command cNewWindow = ch.CreateCommand(); cNewWindow.Text = "New &Window"; cNewWindow.UserData = "window_new"; cNewWindow.Shortcut = Shortcut.CtrlW; cNewWindow.ImageIndex = 2; mWindow.CommandLinks.Add(new C1CommandLink(cNewWindow)); // For toolbars to be dockable/floatable, we must put them // in a C1CommandDock: C1CommandDock dock = new C1CommandDock(); this.Controls.Add(dock); dock.Dock = DockStyle.Top; // Add a toolbar, link it to the (already existing) commands: C1ToolBar tb = new C1ToolBar(); // add file commands and the window menu to the toolbar tb.CommandLinks.Add(new C1CommandLink(cNew)); tb.CommandLinks.Add(new C1CommandLink(cOpen)); C1CommandLink cl; tb.CommandLinks.Add(cl = new C1CommandLink(mWindow)); // because we did not provide an image for the window menu, // make it show as text cl.ButtonLook = ButtonLookFlags.Text; tb.CommandLinks.Add(cl = new C1CommandLink(cExit)); // ditto for the exit command cl.ButtonLook = ButtonLookFlags.Text; // add the new toolbar to the dock dock.Controls.Add(tb); }