public Ribbon3d() { // Get a reference to the current assembly. This is where the ribbon XML is embedded. var assembly = System.Reflection.Assembly.GetExecutingAssembly(); // In this example, XML file must have a build action of "Embedded Resource". this.LoadXml(assembly, _embeddedResourceName); // Example of how to bind a local variable to a particular ribbon control. _buttonBoundingBox = GetButton(20); _buttonOpenGlBoxes = GetButton(21); _buttonGdiPlus = GetButton(22); // Example of how to bind a particular ribbon control click event. _buttonBoundingBox.Click += _buttonBoundingBox_Click; _buttonOpenGlBoxes.Click += _buttonOpenGlBoxes_Click; _buttonGdiPlus.Click += _buttonGdiPlus_Click; // Get the Solid Edge version. var version = DemoAddIn.Instance.SolidEdgeVersion; // View.GetModelRange() is only available in ST6 or greater. if (version.Major < 106) { _buttonBoundingBox.Enabled = false; } }
/// <summary> /// Adds the specified item to the collection /// </summary> public new void Add(RibbonButton item) { CheckRestrictions(item as RibbonButton); item.SetOwner(Owner); item.SetOwnerPanel(OwnerPanel); item.SetOwnerTab(OwnerTab); base.Add(item); }
/// <summary> /// Checks for the restrictions that buttons should have on the RibbonButton List /// </summary> /// <param name="button"></param> private void CheckRestrictions(RibbonButton button) { if (button == null) throw new ApplicationException("The RibbonButtonList only accepts button in the Buttons collection"); //if (!string.IsNullOrEmpty(button.Text)) // throw new ApplicationException("The buttons on the RibbonButtonList should have no text"); if (button.Style != RibbonButtonStyle.Normal) throw new ApplicationException("The only style supported by the RibbonButtonList is Normal"); }
public void toggleQuickAccessButton(RibbonButton dropDownButton, RibbonButton quickAccessButton) { if (quickAccessButton.Visible) { dropDownButton.SmallImage = global::RibbonDemo.Properties.Resources.unchecked16; quickAccessButton.Visible = false; } else { dropDownButton.SmallImage = global::RibbonDemo.Properties.Resources.exit16; quickAccessButton.Visible = true; } // if / else }
//modulhoz ribbon group létrehozása public override RibbonGroup ModuleRibbonGroup(RibbonBase MyRibbon, RibbonTab MyRibbonTab) { RibbonGroup myGroup = MyRibbon.Factory.CreateRibbonGroup(); myGroup.Name = this.Name; myGroup.Label = this.Label; testButton = MyRibbon.Factory.CreateRibbonButton(); testButton.Name = "tesztGomb"; testButton.Label = "Teszt"; myGroup.Items.Add(testButton); return myGroup; }
public override Microsoft.Office.Tools.Ribbon.RibbonGroup ModuleRibbonGroup(Microsoft.Office.Tools.Ribbon.RibbonBase MyRibbon, Microsoft.Office.Tools.Ribbon.RibbonTab MyRibbonTab) { RibbonGroup myGroup = MyRibbon.Factory.CreateRibbonGroup(); myGroup.Name = this.Name; myGroup.Label = this.Label; btnShowTaskPane = GeneralModuleObjects.CreateButton(MyRibbon, this, GeneralModuleObjects.ButtonType.Download); btnShowTaskPane.Label = "Show Tab"; btnShowTaskPane.OfficeImageId = "ViewsFormView"; myGroup.Items.Add(btnShowTaskPane); return myGroup; }
public override Microsoft.Office.Tools.Ribbon.RibbonGroup ModuleRibbonGroup(RibbonBase MyRibbon, RibbonTab MyRibbonTab) { RibbonGroup rGroup = MyRibbon.Factory.CreateRibbonGroup(); rGroup.Name = this.Name; rGroup.Label = this.Label; exportButton = MyRibbon.Factory.CreateRibbonButton(); exportButton.Name = "ExportButton"; exportButton.Label = "Exportbutton"; rGroup.Items.Add(exportButton); return rGroup; }
internal RibbonQuickAccessToolbar(Ribbon ownerRibbon) { if (ownerRibbon == null) throw new ArgumentNullException("ownerRibbon"); SetOwner(ownerRibbon); _dropDownButton = new RibbonButton(); _dropDownButton.SetOwner(ownerRibbon); _dropDownButton.SmallImage = CreateDropDownButtonImage(); _margin = new Padding(9); _padding = new Padding(3, 0, 0, 0); _items = new RibbonQuickAccessToolbarItemCollection(this); _sensor = new RibbonMouseSensor(ownerRibbon, ownerRibbon, Items); _DropDownButtonVisible = true; }
public static void AddRibbonButton(Ribbon ribbon, string tabText, string buttonName, string text, Image image, string tooltip, bool enable, bool isChecked, RibbonButtonAlignment alignment, EventHandler clickHandler) { if (ribbon == null) { return; } RibbonItem ribbonItem = null; if (RibbonModulePluginProvider.Ribbon_Separator.Equals(buttonName)) { ribbonItem = new RibbonSeparator(); } else { ribbonItem = new RibbonButton(); ribbonItem.Text = text; ribbonItem.Image = image; ribbonItem.ToolTip = tooltip; ribbonItem.Enabled = enable; ribbonItem.Checked = isChecked; ribbonItem.Click += new EventHandler(clickHandler); } ribbonItem.Name = buttonName; RibbonTab ribbonTab = RibbonHelper.FindRibbonTab(ribbon, tabText); if (ribbonTab == null) { return; } int panelIndex = alignment == RibbonButtonAlignment.Right ? 1 : 0; ribbonTab.Panels[panelIndex].Items.Add(ribbonItem); }
private void InitHelpTab() { RibbonButton btnReadme = new RibbonButton("Readme.txt"); btnReadme.Image = Resources.readme_32; btnReadme.Click += new EventHandler(readmeRibbonButton_Click); RibbonButton btnAbout = new RibbonButton("About"); btnAbout.Image = Resources.orca_32; btnAbout.Click += new EventHandler(aboutRibbonButton_Click); RibbonPanel panelHelp = new RibbonPanel(); panelHelp.Items.Add(btnReadme); panelHelp.Items.Add(btnAbout); RibbonTab tabHelp = new RibbonTab(mRibbon, "Help"); tabHelp.Panels.Add(panelHelp); mRibbon.Tabs.Add(tabHelp); }
private void InitViewTab() { chkBackground = new RibbonCheckBox("Background"); chkBackground.Checked = true; chkBackground.CheckedChanged += new EventHandler(showBackgroundRibbonButton_Click); chkInterface = new RibbonCheckBox("Interface"); chkInterface.Checked = true; chkInterface.CheckedChanged += new EventHandler(showInterfaceRibbonButton_Click); chkObjects = new RibbonCheckBox("Objects"); chkObjects.Checked = true; chkObjects.CheckedChanged += new EventHandler(showPegsRibbonButton_Click); chkCollision = new RibbonCheckBox("Collision"); chkCollision.CheckedChanged += new EventHandler(showCollisionRibbonButton_Click); chkPreview = new RibbonCheckBox("Preview"); chkPreview.CheckedChanged += new EventHandler(showPreviewRibbonButton_Click); RibbonPanel panelShowHide = new RibbonPanel("Show / Hide"); panelShowHide.Items.Add(chkBackground); panelShowHide.Items.Add(chkInterface); panelShowHide.Items.Add(chkObjects); panelShowHide.Items.Add(chkCollision); panelShowHide.Items.Add(chkPreview); RibbonButton btnPackExplorer = new RibbonButton("Pack Explorer"); btnPackExplorer.Image = Resources.pack_explorer_32; btnPackExplorer.Click += new EventHandler(packExplorerRibbonButton_Click); RibbonButton btnProperties = new RibbonButton("Properties"); btnProperties.Image = Resources.properties_32; btnProperties.Click += new EventHandler(propertiesRibbonButton_Click); RibbonButton btnEntryList = new RibbonButton("Entry List"); btnEntryList.Image = Resources.properties_32; btnEntryList.Click += new EventHandler(entryListRibbonButton_Click); RibbonPanel panelWindow = new RibbonPanel("Window"); panelWindow.Items.Add(btnPackExplorer); panelWindow.Items.Add(btnProperties); panelWindow.Items.Add(btnEntryList); RibbonTab tabView = new RibbonTab(mRibbon, "View"); tabView.Panels.Add(panelShowHide); tabView.Panels.Add(panelWindow); mRibbon.Tabs.Add(tabView); }
private void InitObjectTab() { RibbonButton btnSameLocation = new RibbonButton("Relocate"); btnSameLocation.Image = Resources.properties_32; btnSameLocation.Click += new EventHandler(sameLocationRibbonButton_Click); RibbonPanel panelProperties = new RibbonPanel("Properties"); panelProperties.Items.Add(btnSameLocation); RibbonButton btnMovementType = new RibbonButton("Type"); btnMovementType.Image = Resources.peg_move_type_32; btnMovementType.Style = RibbonButtonStyle.DropDown; for (int i = 0; i <= (int)MovementType.WeirdShape; i++) { RibbonButton ritem = new RibbonButton(); ritem.Text = ((MovementType)i).ToString(); ritem.Tag = i; ritem.Click += new EventHandler(movementTypeRibbonButton_Click); btnMovementType.DropDownItems.Add(ritem); } RibbonButton btnSpreadPhase = new RibbonButton("Phase"); btnSpreadPhase.Image = Resources.spread_phase_32; btnSpreadPhase.Click += new EventHandler(spreadPhaseRibbonButton_Click); RibbonButton btnDuplicateAndPhase = new RibbonButton("Duplicate & Phase"); btnDuplicateAndPhase.Image = Resources.duplicate_and_phase_32; btnDuplicateAndPhase.Click += new EventHandler(duplicateAndPhaseRibbonButton_Click); RibbonButton btnLinkSubMovements = new RibbonButton("Link Sub-movements"); btnLinkSubMovements.Image = Resources.link_sub_movements_32; btnLinkSubMovements.Click += new EventHandler(linkSubMovementsRibbonButton_Click); RibbonPanel panelMovement = new RibbonPanel("Movement"); panelMovement.Items.Add(btnMovementType); panelMovement.Items.Add(btnSpreadPhase); panelMovement.Items.Add(btnDuplicateAndPhase); panelMovement.Items.Add(btnLinkSubMovements); RibbonTab tabObject = new RibbonTab(mRibbon, "Object"); tabObject.Panels.Add(panelProperties); tabObject.Panels.Add(panelMovement); mRibbon.Tabs.Add(tabObject); }
private void InitToolTab() { //Tool panel btnSelectTool = new RibbonButton("Select"); btnSelectTool.Image = Resources.pointer_32; btnSelectTool.Click += new EventHandler(selectRibbonButton_Click); btnPegTool = new RibbonButton("Peg"); btnPegTool.Image = Resources.peg_32; btnPegTool.Click += new EventHandler(pegRibbonButton_Click); btnBrickTool = new RibbonButton("Brick"); btnBrickTool.Image = Resources.brick_32; btnBrickTool.Click += new EventHandler(brickRibbonButton_Click); btnCircle = new RibbonButton("Circle"); btnCircle.Image = Resources.material_32; btnCircle.Click += new EventHandler(circleRibbonButton_Click); btnPolygon = new RibbonButton("Polygon"); btnPolygon.Image = Resources.polygon_32; btnPolygon.Click += new EventHandler(polygonRibbonButton_Click); btnRod = new RibbonButton("Rod"); btnRod.Image = Resources.rod_32; btnRod.Click += new EventHandler(rodRibbonButton_Click); btnTeleport = new RibbonButton("Teleport"); btnTeleport.Image = Resources.teleport_32; btnTeleport.Click += new EventHandler(teleportRibbonButton_Click); btnEmitter = new RibbonButton("Emitter"); btnEmitter.Image = Resources.emitter_32; btnEmitter.Click += new EventHandler(emitterRibbonButton_Click); RibbonButton btnGenerator = new RibbonButton("Generator"); btnGenerator.Style = RibbonButtonStyle.DropDown; btnGenerator.Image = Resources.peg_circle_32; btnPegGenerator = new RibbonButton("Peg Generator"); btnPegGenerator.SmallImage = Resources.peg_16; btnPegGenerator.Click += new EventHandler(pegGeneratorRibbonButton_Click); btnBrickGenerator = new RibbonButton("Brick Generator"); btnBrickGenerator.SmallImage = Resources.brick_16; btnBrickGenerator.Click += new EventHandler(brickGeneratorRibbonButton_Click); btnGenerator.DropDownItems.Add(btnPegGenerator); btnGenerator.DropDownItems.Add(btnBrickGenerator); panelInsert = new RibbonPanel("Tools"); panelInsert.Items.Add(btnSelectTool); panelInsert.Items.Add(btnPegTool); panelInsert.Items.Add(btnBrickTool); panelInsert.Items.Add(btnCircle); panelInsert.Items.Add(btnPolygon); panelInsert.Items.Add(btnRod); panelInsert.Items.Add(btnTeleport); panelInsert.Items.Add(btnEmitter); panelInsert.Items.Add(btnGenerator); RibbonPanel panelFunctions = new RibbonPanel("Functions"); RibbonButton btnApplyFunction = new RibbonButton("Apply"); btnApplyFunction.Image = Resources.execute_32; btnApplyFunction.Click += new EventHandler(applyFunctionRibbonButton_Click); btnScript = new RibbonButton("Script"); btnScript.Image = Resources.script_32; btnScript.Click += new EventHandler(scriptRibbonButton_Click); panelFunctions.Items.Add(btnApplyFunction); panelFunctions.Items.Add(btnScript); RibbonButton btnRemove = new RibbonButton("Remove"); btnRemove.Image = Resources.remove_peg_32; btnRemove.Style = RibbonButtonStyle.DropDown; RibbonButton btnDuplicatePegs = new RibbonButton("Duplicate Pegs"); btnDuplicatePegs.Click += new EventHandler(removeDuplicatePegsRibbonButton_Click); RibbonButton btnOffscreenPegs = new RibbonButton("Offscreen Pegs"); btnOffscreenPegs.Click += new EventHandler(removeOffscreenPegsRibbonButton_Click); btnRemove.DropDownItems.Add(btnDuplicatePegs); btnRemove.DropDownItems.Add(btnOffscreenPegs); panelRemove = new RibbonPanel("Remove"); panelRemove.Items.Add(btnRemove); RibbonTab tabTools = new RibbonTab(mRibbon, "Tools"); tabTools.Panels.Add(panelInsert); tabTools.Panels.Add(panelFunctions); tabTools.Panels.Add(panelRemove); mRibbon.Tabs.Add(tabTools); }
/// <summary> /// Cập nhật thành viên trong phòng phía client /// </summary> /// <param name="name"></param> public void roomclient(string name) { RibbonButton button = new RibbonButton(); button.Text = name; button.MaxSizeMode = System.Windows.Forms.RibbonElementSizeMode.Medium; button.MinSizeMode = System.Windows.Forms.RibbonElementSizeMode.Medium; _myMember.Add(button); rbpnl_RoomClient.Items.Add(button); rbbtn_Connect.Enabled = false; }
/// <summary> /// Draws a SplitDropDown button with the dropdown area pressed /// </summary> /// <param name="e"></param> /// <param name="button"></param> public void DrawSplitButtonDropDownPressed(RibbonItemRenderEventArgs e, RibbonButton button) { }
/// <summary> /// Draws the button as a selected button /// </summary> /// <param name="g"></param> /// <param name="button"></param> public void DrawButtonSelected(Graphics g, RibbonButton button, Ribbon ribbon) { DrawButtonSelected(g, button.Bounds, ButtonCorners(button), ribbon); }
/// <summary> /// Determines button's dropDown corners /// </summary> /// <param name="button"></param> /// <returns></returns> private Corners ButtonDdRounding(RibbonButton button) { if (!(button.OwnerItem is RibbonItemGroup)) { if (button.SizeMode == RibbonElementSizeMode.Large) { return Corners.South; } else { return Corners.East; } } else { Corners c = Corners.None; RibbonItemGroup g = button.OwnerItem as RibbonItemGroup; if (button == g.LastItem) { c |= Corners.East; } return c; } }
/// <summary> /// Draws the button as pressed /// </summary> /// <param name="g"></param> /// <param name="button"></param> public void DrawButtonPressed(Graphics g, RibbonButton button) { DrawButtonPressed(g, button.Bounds, ButtonCorners(button)); }
public RibbonButtonRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonButton button) : base(owner, g, clip) { Button = button; }
public override void SetBounds(System.Drawing.Rectangle bounds) { base.SetBounds(bounds); #region Assign control buttons bounds int cbtns = Canvas is RibbonDropDown ? 2 : 3; int buttonHeight = bounds.Height / cbtns; int buttonWidth = _controlButtonsWidth; _buttonUpBounds = Rectangle.FromLTRB(bounds.Right - buttonWidth, bounds.Top, bounds.Right, bounds.Top + buttonHeight); _buttonDownBounds = Rectangle.FromLTRB(_buttonUpBounds.Left, _buttonUpBounds.Bottom, bounds.Right, _buttonUpBounds.Bottom + buttonHeight); if (cbtns == 2) { _buttonDropDownBounds = Rectangle.Empty; } else { _buttonDropDownBounds = Rectangle.FromLTRB(_buttonDownBounds.Left, _buttonDownBounds.Bottom, bounds.Right, bounds.Bottom + 1); } _contentBounds = Rectangle.FromLTRB(bounds.Left, bounds.Top, _buttonUpBounds.Left, bounds.Bottom); #endregion #region Assign buttons regions _buttonUpEnabled = _offset < 0; if (!_buttonUpEnabled) { _offset = 0; } _buttonDownEnabled = false; int curLeft = ContentBounds.Left + 1; int curTop = ContentBounds.Top + 1 + _offset; int maxBottom = int.MinValue; foreach (RibbonItem item in Buttons) { item.SetBounds(Rectangle.Empty); } for (int i = 0; i < Buttons.Count; i++) { RibbonButton button = Buttons[i] as RibbonButton; if (button == null) { break; } if (curLeft + button.LastMeasuredSize.Width > ContentBounds.Right) { curLeft = ContentBounds.Left + 1; curTop = maxBottom + 1; if (curTop > ContentBounds.Bottom) { break; } } button.SetBounds(new Rectangle(curLeft, curTop, button.LastMeasuredSize.Width, button.LastMeasuredSize.Height)); curLeft = button.Bounds.Right + 1; maxBottom = Math.Max(maxBottom, button.Bounds.Bottom); if (button.Bounds.Bottom > ContentBounds.Bottom) { _buttonDownEnabled = true; } _jumpDownSize = button.Bounds.Height; _jumpUpSize = button.Bounds.Height; } #endregion }
public override void SetBounds(System.Drawing.Rectangle bounds) { base.SetBounds(bounds); #region Assign control buttons bounds if (ScrollType != ListScrollType.Scrollbar) { #region Custom Buttons int cbtns = 3; // Canvas is RibbonDropDown ? 2 : 3; int buttonHeight = bounds.Height / cbtns; int buttonWidth = ControlButtonsWidth; _buttonUpBounds = Rectangle.FromLTRB(bounds.Right - buttonWidth, bounds.Top, bounds.Right, bounds.Top + buttonHeight); _buttonDownBounds = Rectangle.FromLTRB(_buttonUpBounds.Left, _buttonUpBounds.Bottom, bounds.Right, _buttonUpBounds.Bottom + buttonHeight); if (cbtns == 2) { _buttonDropDownBounds = Rectangle.Empty; } else { _buttonDropDownBounds = Rectangle.FromLTRB(_buttonDownBounds.Left, _buttonDownBounds.Bottom, bounds.Right, bounds.Bottom + 1); } _thumbBounds.Location = Point.Empty; #endregion } else { #region Scrollbar int bwidth = ThumbBounds.Width; int bheight = ThumbBounds.Width; _buttonUpBounds = Rectangle.FromLTRB(bounds.Right - bwidth, bounds.Top + 1, bounds.Right, bounds.Top + bheight + 1); _buttonDownBounds = Rectangle.FromLTRB(_buttonUpBounds.Left, bounds.Bottom - bheight, bounds.Right, bounds.Bottom); _buttonDropDownBounds = Rectangle.Empty; _thumbBounds.X = _buttonUpBounds.Left; #endregion } _contentBounds = Rectangle.FromLTRB(bounds.Left + 1, bounds.Top + 1, _buttonUpBounds.Left - 1, bounds.Bottom - 1); #endregion #region Assign buttons regions _buttonUpEnabled = _offset < 0; if (!_buttonUpEnabled) { _offset = 0; } _buttonDownEnabled = false; int curLeft = ContentBounds.Left + 1; int curTop = ContentBounds.Top + 1 + _offset; int maxBottom = curTop; // int.MinValue; int iniTop = curTop; foreach (RibbonItem item in Buttons) { item.SetBounds(Rectangle.Empty); } for (int i = 0; i < Buttons.Count; i++) { RibbonButton button = Buttons[i] as RibbonButton; if (button == null) { break; } if (curLeft + button.LastMeasuredSize.Width > ContentBounds.Right) { curLeft = ContentBounds.Left + 1; curTop = maxBottom + 1; } button.SetBounds(new Rectangle(curLeft, curTop, button.LastMeasuredSize.Width, button.LastMeasuredSize.Height)); curLeft = button.Bounds.Right + 1; maxBottom = Math.Max(maxBottom, button.Bounds.Bottom); if (button.Bounds.Bottom > ContentBounds.Bottom) { _buttonDownEnabled = true; } _jumpDownSize = button.Bounds.Height; _jumpUpSize = button.Bounds.Height; } //Kevin - The bottom row of buttons were always getting cropped off a tiny bit maxBottom += 1; #endregion #region Adjust thumb size double contentHeight = maxBottom - iniTop; double viewHeight = ContentBounds.Height; if (contentHeight > viewHeight && contentHeight != 0) { double viewPercent = viewHeight / contentHeight; double availHeight = ButtonDownBounds.Top - ButtonUpBounds.Bottom; double thumbHeight = Math.Ceiling(viewPercent * availHeight); if (thumbHeight < 30) { if (availHeight >= 30) { thumbHeight = 30; } else { thumbHeight = availHeight; } } _thumbBounds.Height = Convert.ToInt32(thumbHeight); fullContentBounds = Rectangle.FromLTRB(ContentBounds.Left, iniTop, ContentBounds.Right, maxBottom); _scrollBarEnabled = true && !NoScroll; UpdateThumbPos(); } else { _scrollBarEnabled = false; } #endregion }
/// <summary> /// Gets the corners to round on the specified button /// </summary> /// <param name="r"></param> /// <param name="button"></param> /// <returns></returns> private Corners ButtonCorners(RibbonButton button) { if (!(button.OwnerItem is RibbonItemGroup)) { return Corners.All; } else { RibbonItemGroup g = button.OwnerItem as RibbonItemGroup; Corners c = Corners.None; if (button == g.FirstItem) { c |= Corners.West; } if (button == g.LastItem) { c |= Corners.East; } return c; } }
public RibbonButtonRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonButton button) : base(owner, g, clip) { Button = button; }
/// <summary> /// Draws the arrow of buttons /// </summary> /// <param name="g"></param> /// <param name="button"></param> public void DrawButtonDropDownArrow(Graphics g, RibbonButton button, Rectangle textLayout) { Rectangle bounds = Rectangle.Empty; if (button.SizeMode == RibbonElementSizeMode.Large || button.SizeMode == RibbonElementSizeMode.Overflow) { bounds = LargeButtonDropDownArrowBounds(g, button.Owner.Font, button.Text, textLayout); } else { //bounds = new Rectangle( // button.ButtonFaceBounds.Right + (button.DropDownBounds.Width - arrowSize.Width) / 2, // button.Bounds.Top + (button.Bounds.Height - arrowSize.Height) / 2, // arrowSize.Width, arrowSize.Height); bounds = textLayout; } DrawArrowShaded(g, bounds, button.DropDownArrowDirection, button.Enabled); }
private void InitLists() { Image[] images = new Image[255]; RibbonProfessionalRenderer rend = new RibbonProfessionalRenderer(); BackColor = Theme.ColorTable.RibbonBackground; Random r = new Random(); #region Color Squares using (GraphicsPath path = RibbonProfessionalRenderer.RoundRectangle(new Rectangle(3, 3, 26, 26), 4)) { using (GraphicsPath outer = RibbonProfessionalRenderer.RoundRectangle(new Rectangle(0, 0, 32, 32), 4)) { for (int i = 0; i < images.Length; i++) { Bitmap b = new Bitmap(32, 32); using (Graphics g = Graphics.FromImage(b)) { g.SmoothingMode = SmoothingMode.AntiAlias; using (SolidBrush br = new SolidBrush(Color.FromArgb(255, i * (255 / images.Length), 0))) { g.FillPath(br, path); } using (Pen p = new Pen(Color.White, 3)) { g.DrawPath(p, path); } g.DrawPath(Pens.Wheat, path); g.DrawString(Convert.ToString(i + 1), Font, Brushes.White, new Point(10, 10)); } images[i] = b; RibbonButton btn = new RibbonButton(); btn.Image = b; lst.Buttons.Add(btn); } } } //lst.DropDownItems.Add(new RibbonSeparator("Available styles")); RibbonButtonList lst2 = new RibbonButtonList(); for (int i = 0; i < images.Length; i++) { RibbonButton btn = new RibbonButton(); btn.Image = images[i]; lst2.Buttons.Add(btn); } lst.DropDownItems.Add(lst2); lst.DropDownItems.Add(new RibbonButton("Save selection as a new quick style...")); lst.DropDownItems.Add(new RibbonButton("Erase Format")); lst.DropDownItems.Add(new RibbonButton("Apply style...")); #endregion #region Theme Colors RibbonButton[] buttons = new RibbonButton[30]; int square = 16; int squares = 4; int sqspace = 2; for (int i = 0; i < buttons.Length; i++) { #region Create color squares Bitmap colors = new Bitmap((square + sqspace) * squares, square + 1); string[] colorss = new string[squares]; using (Graphics g = Graphics.FromImage(colors)) { for (int j = 0; j < 4; j++) { Color sqcolor = GetRandomColor(r); colorss[j] = sqcolor.Name; using (SolidBrush b = new SolidBrush(sqcolor)) { g.FillRectangle(b, new Rectangle(j * (square + sqspace), 0, square, square)); } g.DrawRectangle(Pens.Gray, new Rectangle(j * (square + sqspace), 0, square, square)); } } #endregion buttons[i] = new RibbonButton(colors); buttons[i].Text = string.Join(", ", colorss); ; buttons[i].MaxSizeMode = RibbonElementSizeMode.Medium; buttons[i].MinSizeMode = RibbonElementSizeMode.Medium; } RibbonButtonList blst = new RibbonButtonList(buttons); blst.FlowToBottom = false; blst.ItemsSizeInDropwDownMode = new Size(1, 10); itemColors.DropDownItems.Insert(0, blst); itemColors.DropDownResizable = true; #endregion }
/// <summary> /// Draws a SplitDropDown button in normal state /// </summary> /// <param name="e"></param> /// <param name="button"></param> public void DrawSplitButton(RibbonItemRenderEventArgs e, RibbonButton button) { }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.ribbonBar = new Genetibase.UI.RibbonControl(); this.blankTab = new Genetibase.UI.RibbonTab(); this.actionsTab = new Genetibase.UI.RibbonTab(); this.fileButtonsGroup = new Genetibase.UI.RibbonGroup(); this.importButton = new Genetibase.UI.RibbonButton(); this.exportButton = new Genetibase.UI.RibbonButton(); this.openButton = new Genetibase.UI.RibbonButton(); this.saveButton = new Genetibase.UI.RibbonButton(); this.editButtonsGroup = new Genetibase.UI.RibbonGroup(); this.cutButton = new Genetibase.UI.RibbonButton(); this.copyButton = new Genetibase.UI.RibbonButton(); this.pasteButton = new Genetibase.UI.RibbonButton(); this.pasteAsButton = new Genetibase.UI.RibbonButton(); this.selectTab = new Genetibase.UI.RibbonTab(); this.selectButtonsGroup = new Genetibase.UI.RibbonGroup(); this.selectButton = new Genetibase.UI.RibbonButton(); this.curveButtonsGroup = new Genetibase.UI.RibbonGroup(); this.curvePointButton = new Genetibase.UI.RibbonButton(); this.segmentButton = new Genetibase.UI.RibbonButton(); this.pointMatchButton = new Genetibase.UI.RibbonButton(); this.curveCombo = new System.Windows.Forms.ComboBox(); this.measureButtonsGroup = new Genetibase.UI.RibbonGroup(); this.measureButton = new Genetibase.UI.RibbonButton(); this.measureCombo = new System.Windows.Forms.ComboBox(); this.scaleButtonsGroup = new Genetibase.UI.RibbonGroup(); this.axisButton = new Genetibase.UI.RibbonButton(); this.scaleButton = new Genetibase.UI.RibbonButton(); this.normalStatus = new System.Windows.Forms.StatusBarPanel(); this.permanentStatus = new System.Windows.Forms.StatusBarPanel(); this.resStatus = new System.Windows.Forms.StatusBarPanel(); this.coordsStatus = new System.Windows.Forms.StatusBarPanel(); this.statusBar = new Genetibase.NuGenTransform.NuGenStatusBar(); this.ribbonBar.SuspendLayout(); this.actionsTab.SuspendLayout(); this.fileButtonsGroup.SuspendLayout(); this.editButtonsGroup.SuspendLayout(); this.selectTab.SuspendLayout(); this.selectButtonsGroup.SuspendLayout(); this.curveButtonsGroup.SuspendLayout(); this.measureButtonsGroup.SuspendLayout(); this.scaleButtonsGroup.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.normalStatus)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.permanentStatus)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.resStatus)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.coordsStatus)).BeginInit(); this.SuspendLayout(); // // ribbonBar // this.ribbonBar.Controls.Add(this.blankTab); this.ribbonBar.Controls.Add(this.actionsTab); this.ribbonBar.Controls.Add(this.selectTab); this.ribbonBar.Dock = System.Windows.Forms.DockStyle.Top; this.ribbonBar.Location = new System.Drawing.Point(0, 0); this.ribbonBar.Name = "ribbonBar"; this.ribbonBar.SelectedIndex = 1; this.ribbonBar.Size = new System.Drawing.Size(800, 116); this.ribbonBar.TabIndex = 0; this.ribbonBar.OnPopup += new Genetibase.UI.RibbonPopupEventHandler(this.ribbonBar_OnPopup); // // blankTab // this.blankTab.Location = new System.Drawing.Point(4, 25); this.blankTab.Name = "blankTab"; this.blankTab.Size = new System.Drawing.Size(792, 87); this.blankTab.TabIndex = 0; this.blankTab.Text = "Menu"; // // actionsTab // this.actionsTab.Controls.Add(this.fileButtonsGroup); this.actionsTab.Controls.Add(this.editButtonsGroup); this.actionsTab.Location = new System.Drawing.Point(4, 25); this.actionsTab.Name = "actionsTab"; this.actionsTab.Padding = new System.Windows.Forms.Padding(3); this.actionsTab.Size = new System.Drawing.Size(792, 87); this.actionsTab.TabIndex = 0; this.actionsTab.Text = "Actions"; this.actionsTab.UseVisualStyleBackColor = true; // // fileButtonsGroup // this.fileButtonsGroup.Controls.Add(this.importButton); this.fileButtonsGroup.Controls.Add(this.exportButton); this.fileButtonsGroup.Controls.Add(this.openButton); this.fileButtonsGroup.Controls.Add(this.saveButton); this.fileButtonsGroup.Location = new System.Drawing.Point(5, 5); this.fileButtonsGroup.Margin = new System.Windows.Forms.Padding(1); this.fileButtonsGroup.Name = "fileButtonsGroup"; this.fileButtonsGroup.Size = new System.Drawing.Size(280, 79); this.fileButtonsGroup.TabIndex = 1; this.fileButtonsGroup.TabStop = false; this.fileButtonsGroup.Text = "File"; // // importButton // this.importButton.Command = null; this.importButton.Image = global::Genetibase.NuGenTransform.Properties.Resources.fileimport; this.importButton.IsFlat = true; this.importButton.IsPressed = false; this.importButton.Location = new System.Drawing.Point(5, 5); this.importButton.Margin = new System.Windows.Forms.Padding(0); this.importButton.Name = "importButton"; this.importButton.Padding = new System.Windows.Forms.Padding(2); this.importButton.Size = new System.Drawing.Size(64, 48); this.importButton.TabIndex = 0; this.importButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // exportButton // this.exportButton.Command = null; this.exportButton.Image = global::Genetibase.NuGenTransform.Properties.Resources.fileexport; this.exportButton.IsFlat = true; this.exportButton.IsPressed = false; this.exportButton.Location = new System.Drawing.Point(74, 5); this.exportButton.Margin = new System.Windows.Forms.Padding(0); this.exportButton.Name = "exportButton"; this.exportButton.Padding = new System.Windows.Forms.Padding(2); this.exportButton.Size = new System.Drawing.Size(64, 48); this.exportButton.TabIndex = 1; this.exportButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // openButton // this.openButton.Command = null; this.openButton.Image = global::Genetibase.NuGenTransform.Properties.Resources.fileopen; this.openButton.IsFlat = true; this.openButton.IsPressed = false; this.openButton.Location = new System.Drawing.Point(143, 5); this.openButton.Margin = new System.Windows.Forms.Padding(0); this.openButton.Name = "openButton"; this.openButton.Padding = new System.Windows.Forms.Padding(2); this.openButton.Size = new System.Drawing.Size(64, 48); this.openButton.TabIndex = 2; this.openButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // saveButton // this.saveButton.Command = null; this.saveButton.Image = global::Genetibase.NuGenTransform.Properties.Resources.filesave; this.saveButton.IsFlat = true; this.saveButton.IsPressed = false; this.saveButton.Location = new System.Drawing.Point(210, 5); this.saveButton.Margin = new System.Windows.Forms.Padding(0); this.saveButton.Name = "saveButton"; this.saveButton.Padding = new System.Windows.Forms.Padding(2); this.saveButton.Size = new System.Drawing.Size(64, 48); this.saveButton.TabIndex = 3; this.saveButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // editButtonsGroup // this.editButtonsGroup.Controls.Add(this.cutButton); this.editButtonsGroup.Controls.Add(this.copyButton); this.editButtonsGroup.Controls.Add(this.pasteButton); this.editButtonsGroup.Controls.Add(this.pasteAsButton); this.editButtonsGroup.Location = new System.Drawing.Point(290, 5); this.editButtonsGroup.Margin = new System.Windows.Forms.Padding(1); this.editButtonsGroup.Name = "editButtonsGroup"; this.editButtonsGroup.Size = new System.Drawing.Size(280, 79); this.editButtonsGroup.TabIndex = 1; this.editButtonsGroup.TabStop = false; this.editButtonsGroup.Text = "Edit"; // // cutButton // this.cutButton.Command = null; this.cutButton.IsFlat = true; this.cutButton.IsPressed = false; this.cutButton.Location = new System.Drawing.Point(5, 5); this.cutButton.Margin = new System.Windows.Forms.Padding(0); this.cutButton.Name = "cutButton"; this.cutButton.Padding = new System.Windows.Forms.Padding(2); this.cutButton.Size = new System.Drawing.Size(64, 48); this.cutButton.TabIndex = 0; this.cutButton.Text = "Cut"; this.cutButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // copyButton // this.copyButton.Command = null; this.copyButton.IsFlat = true; this.copyButton.IsPressed = false; this.copyButton.Location = new System.Drawing.Point(74, 5); this.copyButton.Margin = new System.Windows.Forms.Padding(0); this.copyButton.Name = "copyButton"; this.copyButton.Padding = new System.Windows.Forms.Padding(2); this.copyButton.Size = new System.Drawing.Size(64, 48); this.copyButton.TabIndex = 1; this.copyButton.Text = "Copy"; this.copyButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // pasteButton // this.pasteButton.Command = null; this.pasteButton.IsFlat = true; this.pasteButton.IsPressed = false; this.pasteButton.Location = new System.Drawing.Point(143, 5); this.pasteButton.Margin = new System.Windows.Forms.Padding(0); this.pasteButton.Name = "pasteButton"; this.pasteButton.Padding = new System.Windows.Forms.Padding(2); this.pasteButton.Size = new System.Drawing.Size(64, 48); this.pasteButton.TabIndex = 2; this.pasteButton.Text = "Paste"; this.pasteButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // pasteAsButton // this.pasteAsButton.Command = null; this.pasteAsButton.IsFlat = true; this.pasteAsButton.IsPressed = false; this.pasteAsButton.Location = new System.Drawing.Point(210, 5); this.pasteAsButton.Margin = new System.Windows.Forms.Padding(0); this.pasteAsButton.Name = "pasteAsButton"; this.pasteAsButton.Padding = new System.Windows.Forms.Padding(2); this.pasteAsButton.Size = new System.Drawing.Size(64, 48); this.pasteAsButton.TabIndex = 3; this.pasteAsButton.Text = "Paste As"; this.pasteAsButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // selectTab // this.selectTab.Controls.Add(this.selectButtonsGroup); this.selectTab.Controls.Add(this.curveButtonsGroup); this.selectTab.Controls.Add(this.measureButtonsGroup); this.selectTab.Controls.Add(this.scaleButtonsGroup); this.selectTab.Location = new System.Drawing.Point(4, 25); this.selectTab.Name = "selectTab"; this.selectTab.Padding = new System.Windows.Forms.Padding(3); this.selectTab.Size = new System.Drawing.Size(792, 87); this.selectTab.TabIndex = 1; this.selectTab.Text = "Mode"; this.selectTab.UseVisualStyleBackColor = true; // // selectButtonsGroup // this.selectButtonsGroup.Controls.Add(this.selectButton); this.selectButtonsGroup.Location = new System.Drawing.Point(5, 5); this.selectButtonsGroup.Margin = new System.Windows.Forms.Padding(1); this.selectButtonsGroup.Name = "selectButtonsGroup"; this.selectButtonsGroup.Size = new System.Drawing.Size(74, 79); this.selectButtonsGroup.TabIndex = 1; this.selectButtonsGroup.TabStop = false; this.selectButtonsGroup.Text = "Select"; // // selectButton // this.selectButton.Command = null; this.selectButton.Image = global::Genetibase.NuGenTransform.Properties.Resources.digitselectlarge; this.selectButton.IsFlat = true; this.selectButton.IsPressed = false; this.selectButton.Location = new System.Drawing.Point(5, 5); this.selectButton.Margin = new System.Windows.Forms.Padding(0); this.selectButton.Name = "selectButton"; this.selectButton.Padding = new System.Windows.Forms.Padding(2); this.selectButton.Size = new System.Drawing.Size(64, 48); this.selectButton.TabIndex = 0; this.selectButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // curveButtonsGroup // this.curveButtonsGroup.Controls.Add(this.curvePointButton); this.curveButtonsGroup.Controls.Add(this.segmentButton); this.curveButtonsGroup.Controls.Add(this.pointMatchButton); this.curveButtonsGroup.Controls.Add(this.curveCombo); this.curveButtonsGroup.Location = new System.Drawing.Point(232, 5); this.curveButtonsGroup.Margin = new System.Windows.Forms.Padding(1); this.curveButtonsGroup.Name = "curveButtonsGroup"; this.curveButtonsGroup.Size = new System.Drawing.Size(345, 79); this.curveButtonsGroup.TabIndex = 2; this.curveButtonsGroup.TabStop = false; this.curveButtonsGroup.Text = "Curve Mode"; // // curvePointButton // this.curvePointButton.Command = null; this.curvePointButton.Image = global::Genetibase.NuGenTransform.Properties.Resources.digitcurvelarge; this.curvePointButton.IsFlat = true; this.curvePointButton.IsPressed = false; this.curvePointButton.Location = new System.Drawing.Point(5, 5); this.curvePointButton.Margin = new System.Windows.Forms.Padding(0); this.curvePointButton.Name = "curvePointButton"; this.curvePointButton.Padding = new System.Windows.Forms.Padding(2); this.curvePointButton.Size = new System.Drawing.Size(64, 48); this.curvePointButton.TabIndex = 0; this.curvePointButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // segmentButton // this.segmentButton.Command = null; this.segmentButton.Image = global::Genetibase.NuGenTransform.Properties.Resources.digitsegmentlarge; this.segmentButton.IsFlat = true; this.segmentButton.IsPressed = false; this.segmentButton.Location = new System.Drawing.Point(74, 5); this.segmentButton.Margin = new System.Windows.Forms.Padding(0); this.segmentButton.Name = "segmentButton"; this.segmentButton.Padding = new System.Windows.Forms.Padding(2); this.segmentButton.Size = new System.Drawing.Size(64, 48); this.segmentButton.TabIndex = 1; this.segmentButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // pointMatchButton // this.pointMatchButton.Command = null; this.pointMatchButton.Image = global::Genetibase.NuGenTransform.Properties.Resources.digitmatchlarge; this.pointMatchButton.IsFlat = true; this.pointMatchButton.IsPressed = false; this.pointMatchButton.Location = new System.Drawing.Point(143, 5); this.pointMatchButton.Margin = new System.Windows.Forms.Padding(0); this.pointMatchButton.Name = "pointMatchButton"; this.pointMatchButton.Padding = new System.Windows.Forms.Padding(2); this.pointMatchButton.Size = new System.Drawing.Size(64, 48); this.pointMatchButton.TabIndex = 2; this.pointMatchButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // curveCombo // this.curveCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.curveCombo.Location = new System.Drawing.Point(210, 30); this.curveCombo.Name = "curveCombo"; this.curveCombo.Size = new System.Drawing.Size(121, 21); this.curveCombo.TabIndex = 3; // // measureButtonsGroup // this.measureButtonsGroup.Controls.Add(this.measureButton); this.measureButtonsGroup.Controls.Add(this.measureCombo); this.measureButtonsGroup.Location = new System.Drawing.Point(582, 5); this.measureButtonsGroup.Margin = new System.Windows.Forms.Padding(1); this.measureButtonsGroup.Name = "measureButtonsGroup"; this.measureButtonsGroup.Size = new System.Drawing.Size(200, 79); this.measureButtonsGroup.TabIndex = 3; this.measureButtonsGroup.TabStop = false; this.measureButtonsGroup.Text = "Measure Mode"; // // measureButton // this.measureButton.Command = null; this.measureButton.Image = global::Genetibase.NuGenTransform.Properties.Resources.digitmeasurelarge; this.measureButton.IsFlat = true; this.measureButton.IsPressed = false; this.measureButton.Location = new System.Drawing.Point(5, 5); this.measureButton.Margin = new System.Windows.Forms.Padding(0); this.measureButton.Name = "measureButton"; this.measureButton.Padding = new System.Windows.Forms.Padding(2); this.measureButton.Size = new System.Drawing.Size(64, 48); this.measureButton.TabIndex = 0; this.measureButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // measureCombo // this.measureCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.measureCombo.Location = new System.Drawing.Point(74, 30); this.measureCombo.Name = "measureCombo"; this.measureCombo.Size = new System.Drawing.Size(121, 21); this.measureCombo.TabIndex = 1; // // scaleButtonsGroup // this.scaleButtonsGroup.Controls.Add(this.axisButton); this.scaleButtonsGroup.Controls.Add(this.scaleButton); this.scaleButtonsGroup.Location = new System.Drawing.Point(84, 5); this.scaleButtonsGroup.Margin = new System.Windows.Forms.Padding(1); this.scaleButtonsGroup.Name = "scaleButtonsGroup"; this.scaleButtonsGroup.Size = new System.Drawing.Size(143, 79); this.scaleButtonsGroup.TabIndex = 1; this.scaleButtonsGroup.TabStop = false; this.scaleButtonsGroup.Text = "Graph Scale"; // // axisButton // this.axisButton.Command = null; this.axisButton.Image = global::Genetibase.NuGenTransform.Properties.Resources.digitaxissmall; this.axisButton.IsFlat = true; this.axisButton.IsPressed = false; this.axisButton.Location = new System.Drawing.Point(5, 5); this.axisButton.Margin = new System.Windows.Forms.Padding(0); this.axisButton.Name = "axisButton"; this.axisButton.Padding = new System.Windows.Forms.Padding(2); this.axisButton.Size = new System.Drawing.Size(64, 48); this.axisButton.TabIndex = 0; this.axisButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // scaleButton // this.scaleButton.Command = null; this.scaleButton.Image = global::Genetibase.NuGenTransform.Properties.Resources.digitscalelarge; this.scaleButton.IsFlat = true; this.scaleButton.IsPressed = false; this.scaleButton.Location = new System.Drawing.Point(74, 5); this.scaleButton.Margin = new System.Windows.Forms.Padding(0); this.scaleButton.Name = "scaleButton"; this.scaleButton.Padding = new System.Windows.Forms.Padding(2); this.scaleButton.Size = new System.Drawing.Size(64, 48); this.scaleButton.TabIndex = 1; this.scaleButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // normalStatus // this.normalStatus.Name = "normalStatus"; this.normalStatus.Width = 320; // // permanentStatus // this.permanentStatus.Name = "permanentStatus"; this.permanentStatus.Width = 320; // // resStatus // this.resStatus.Name = "resStatus"; this.resStatus.Width = 80; // // coordsStatus // this.coordsStatus.Name = "coordsStatus"; this.coordsStatus.Width = 80; // // statusBar // this.statusBar.Dock = System.Windows.Forms.DockStyle.Bottom; this.statusBar.Font = new System.Drawing.Font("Helvetica", 8.25F); this.statusBar.Location = new System.Drawing.Point(0, 575); this.statusBar.Name = "statusBar"; this.statusBar.ShowPanels = true; this.statusBar.Size = new System.Drawing.Size(800, 25); this.statusBar.TabIndex = 1; // // NuGenForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(200)))), ((int)(((byte)(200)))), ((int)(((byte)(200))))); this.ClientSize = new System.Drawing.Size(800, 600); this.Controls.Add(this.ribbonBar); this.Controls.Add(this.statusBar); this.MinimumSize = new System.Drawing.Size(565, 200); this.Name = "NuGenForm"; this.Text = "Form1"; this.ribbonBar.ResumeLayout(false); this.actionsTab.ResumeLayout(false); this.fileButtonsGroup.ResumeLayout(false); this.editButtonsGroup.ResumeLayout(false); this.selectTab.ResumeLayout(false); this.selectButtonsGroup.ResumeLayout(false); this.curveButtonsGroup.ResumeLayout(false); this.measureButtonsGroup.ResumeLayout(false); this.scaleButtonsGroup.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.normalStatus)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.permanentStatus)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.resStatus)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.coordsStatus)).EndInit(); this.ResumeLayout(false); }
/// <summary> /// Draws a SplitDropDown button with the dropdown area selected /// </summary> /// <param name="e"></param> /// <param name="button"></param> public void DrawSplitButtonDropDownSelected(RibbonItemRenderEventArgs e, RibbonButton button) { Rectangle outerR = Rectangle.FromLTRB( button.DropDownBounds.Left, button.DropDownBounds.Top, button.DropDownBounds.Right - 1, button.DropDownBounds.Bottom - 1); Rectangle innerR = Rectangle.FromLTRB( outerR.Left + 1, outerR.Top + (button.SizeMode == RibbonElementSizeMode.Large ? 1 : 0), outerR.Right - 1, outerR.Bottom - 1); Rectangle faceOuterR = Rectangle.FromLTRB( button.ButtonFaceBounds.Left, button.ButtonFaceBounds.Top, button.ButtonFaceBounds.Right - 1, button.ButtonFaceBounds.Bottom - 1); Rectangle faceInnerR = Rectangle.FromLTRB( faceOuterR.Left + 1, faceOuterR.Top + 1, faceOuterR.Right + (button.SizeMode == RibbonElementSizeMode.Large ? -1 : 0), faceOuterR.Bottom + (button.SizeMode == RibbonElementSizeMode.Large ? 0 : -1)); Corners faceCorners = ButtonFaceRounding(button); Corners ddCorners = ButtonDdRounding(button); GraphicsPath outer = RoundRectangle(outerR, 3, ddCorners); GraphicsPath inner = RoundRectangle(innerR, 2, ddCorners); GraphicsPath faceOuter = RoundRectangle(faceOuterR, 3, faceCorners); GraphicsPath faceInner = RoundRectangle(faceInnerR, 2, faceCorners); using (SolidBrush b = new SolidBrush(Color.FromArgb(150, Color.White))) { e.Graphics.FillPath(b, faceInner); } using (Pen p = new Pen(button.Pressed && button.SizeMode != RibbonElementSizeMode.DropDown ? ColorTable.ButtonPressedBorderIn : ColorTable.ButtonSelectedBorderIn)) { e.Graphics.DrawPath(p, faceInner); } using (Pen p = new Pen(button.Pressed && button.SizeMode != RibbonElementSizeMode.DropDown ? ColorTable.ButtonPressedBorderOut : ColorTable.ButtonSelectedBorderOut)) { e.Graphics.DrawPath(p, faceOuter); } outer.Dispose(); inner.Dispose(); faceOuter.Dispose(); faceInner.Dispose(); }
public void UpdateRecentPackFiles() { RibbonItemCollection collection = mRibbon.OrbDropDown.RecentItems; collection.Clear(); for (int i = 0; i < Settings.RecentPackFiles.Count; i++) { RibbonButton item = new RibbonButton(); item.Text = PathShortener(Settings.RecentPackFiles[i], 40); item.Tag = Settings.RecentPackFiles[i]; item.Click += new EventHandler(recentItem_Click); collection.Add(item); } }
/// <summary> /// Hàm cập nhật phòng phía Server /// </summary> /// <param name="_name">Tên của thành viên</param> public void updateRoom(string _name) { if (_myMember.Count < PnlPaint._clientSocket.Count) { RibbonButton button = new RibbonButton(); button.Text = _name + "(F)"; button.MaxSizeMode = System.Windows.Forms.RibbonElementSizeMode.Medium; button.MinSizeMode = System.Windows.Forms.RibbonElementSizeMode.Medium; button.Click += Remove; _myMember.Add(button); rbpnl_Room.Items.Add(button); rbbtn_Create.Enabled = false; //Gởi thành viên vừa mới gia nhập đến các thành viên còn lại PaintState temp = new PaintState(); byte[] buffer; for (int i = 0; i < _myMember.Count - 1; i++) { string t = _myMember[i].Text.Remove(_myMember[i].Text.Length - 3, 3); temp = new PaintState(); temp.FirstPoint = new Point(-7, -7); temp.Text = t; buffer = temp.ToByteArray(); PnlPaint._clientSocket[PnlPaint._clientSocket.Count - 1].Send(buffer); Thread.Sleep(50); } Thread.Sleep(50); temp = new PaintState(); temp.FirstPoint = new Point(-7, -7); temp.Text = _name; buffer = temp.ToByteArray(); for (int i = 0; i < PnlPaint._clientSocket.Count; i++) { PnlPaint._clientSocket[i].Send(buffer); } } }
private void InitQuickAccess() { RibbonButton btnNew = new RibbonButton(); btnNew.SmallImage = Resources.new_16; btnNew.Click += new EventHandler(newRibbonButton_Click); RibbonButton btnOpen = new RibbonButton(); btnOpen.SmallImage = Resources.open_16; btnOpen.Click += new EventHandler(openRibbonButton_Click); RibbonButton btnSave = new RibbonButton(); btnSave.SmallImage = Resources.save_16; btnSave.Click += new EventHandler(saveRibbonButton_Click); RibbonButton btnSaveAs = new RibbonButton(); btnSaveAs.SmallImage = Resources.saveas_16; btnSaveAs.Click += new EventHandler(saveAsRibbonButton_Click); RibbonButton btnUndo = new RibbonButton(); btnUndo.SmallImage = Resources.undo_16; btnUndo.Click += new EventHandler(undoRibbonButton_Click); mRibbon.QuickAcessToolbar.Items.Add(btnNew); mRibbon.QuickAcessToolbar.Items.Add(btnOpen); mRibbon.QuickAcessToolbar.Items.Add(btnSave); mRibbon.QuickAcessToolbar.Items.Add(btnSaveAs); mRibbon.QuickAcessToolbar.Items.Add(btnUndo); }
private void InitializeComponent() { this.ribbonButton1 = new Genetibase.UI.RibbonButton(); this.ribbonButton2 = new Genetibase.UI.RibbonButton(); this.ribbonButton3 = new Genetibase.UI.RibbonButton(); this.ribbonButton4 = new Genetibase.UI.RibbonButton(); this.ribbonButton5 = new Genetibase.UI.RibbonButton(); this.ribbonButton6 = new Genetibase.UI.RibbonButton(); this.ribbonButton7 = new Genetibase.UI.RibbonButton(); this.ribbonButton8 = new Genetibase.UI.RibbonButton(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // ribbonButton1 // this.ribbonButton1.BackColor = System.Drawing.Color.WhiteSmoke; this.ribbonButton1.IsFlat = true; this.ribbonButton1.IsPressed = false; this.ribbonButton1.Location = new System.Drawing.Point(5, 230); this.ribbonButton1.Margin = new System.Windows.Forms.Padding(1); this.ribbonButton1.Name = "ribbonButton1"; this.ribbonButton1.Padding = new System.Windows.Forms.Padding(2); this.ribbonButton1.Size = new System.Drawing.Size(144, 52); this.ribbonButton1.TabIndex = 1; this.ribbonButton1.Text = "Close"; this.ribbonButton1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.ribbonButton1.Click += new System.EventHandler(this.ribbonButton1_Click); this.ribbonButton1.MouseEnter += new EventHandler(MouseEnterDefault); // // ribbonButton2 // this.ribbonButton2.BackColor = System.Drawing.Color.WhiteSmoke; this.ribbonButton2.IsFlat = true; this.ribbonButton2.IsPressed = false; this.ribbonButton2.Location = new System.Drawing.Point(5, 282); this.ribbonButton2.Margin = new System.Windows.Forms.Padding(1); this.ribbonButton2.Name = "ribbonButton2"; this.ribbonButton2.Padding = new System.Windows.Forms.Padding(2); this.ribbonButton2.Size = new System.Drawing.Size(144, 52); this.ribbonButton2.TabIndex = 1; this.ribbonButton2.Text = "Export"; this.ribbonButton2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.ribbonButton2.Click += new System.EventHandler(this.ribbonButton2_Click); this.ribbonButton2.MouseEnter += new EventHandler(MouseEnterDefault); // // ribbonButton3 // this.ribbonButton3.BackColor = System.Drawing.Color.WhiteSmoke; this.ribbonButton3.IsFlat = true; this.ribbonButton3.IsPressed = false; this.ribbonButton3.Location = new System.Drawing.Point(5, 334); this.ribbonButton3.Margin = new System.Windows.Forms.Padding(1); this.ribbonButton3.Name = "ribbonButton3"; this.ribbonButton3.Padding = new System.Windows.Forms.Padding(2); this.ribbonButton3.Size = new System.Drawing.Size(144, 52); this.ribbonButton3.TabIndex = 1; this.ribbonButton3.Text = "Print"; this.ribbonButton3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.ribbonButton3.Click += new System.EventHandler(this.ribbonButton3_Click); this.ribbonButton3.MouseEnter += new EventHandler(MouseEnterDefault); // // ribbonButton4 // this.ribbonButton4.BackColor = System.Drawing.Color.WhiteSmoke; this.ribbonButton4.IsFlat = true; this.ribbonButton4.IsPressed = false; this.ribbonButton4.Location = new System.Drawing.Point(5, 386); this.ribbonButton4.Margin = new System.Windows.Forms.Padding(1); this.ribbonButton4.Name = "ribbonButton4"; this.ribbonButton4.Padding = new System.Windows.Forms.Padding(2); this.ribbonButton4.Size = new System.Drawing.Size(144, 52); this.ribbonButton4.TabIndex = 1; this.ribbonButton4.Text = "Exit"; this.ribbonButton4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.ribbonButton4.Click += new System.EventHandler(this.ribbonButton4_Click); this.ribbonButton4.MouseEnter += new EventHandler(MouseEnterDefault); // // ribbonButton5 // this.ribbonButton5.BackColor = System.Drawing.Color.WhiteSmoke; this.ribbonButton5.Image = global::Genetibase.NuGenTransform.Properties.Resources.greenarrow; this.ribbonButton5.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.ribbonButton5.IsFlat = true; this.ribbonButton5.IsPressed = false; this.ribbonButton5.Location = new System.Drawing.Point(5, 5); this.ribbonButton5.Margin = new System.Windows.Forms.Padding(1); this.ribbonButton5.Name = "ribbonButton5"; this.ribbonButton5.Padding = new System.Windows.Forms.Padding(2); this.ribbonButton5.Size = new System.Drawing.Size(144, 52); this.ribbonButton5.TabIndex = 1; this.ribbonButton5.Text = "View"; this.ribbonButton5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.ribbonButton5.Click += new System.EventHandler(this.ribbonButton1_Click); this.ribbonButton5.MouseEnter += new EventHandler(ribbonButton5_MouseEnter); // // ribbonButton6 // this.ribbonButton6.BackColor = System.Drawing.Color.WhiteSmoke; this.ribbonButton6.Image = global::Genetibase.NuGenTransform.Properties.Resources.greenarrow; this.ribbonButton6.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.ribbonButton6.IsFlat = true; this.ribbonButton6.IsPressed = false; this.ribbonButton6.Location = new System.Drawing.Point(5, 57); this.ribbonButton6.Margin = new System.Windows.Forms.Padding(1); this.ribbonButton6.Name = "ribbonButton6"; this.ribbonButton6.Padding = new System.Windows.Forms.Padding(2); this.ribbonButton6.Size = new System.Drawing.Size(144, 52); this.ribbonButton6.TabIndex = 1; this.ribbonButton6.Text = "Settings"; this.ribbonButton6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.ribbonButton6.Click += new System.EventHandler(this.ribbonButton1_Click); this.ribbonButton6.MouseEnter += new EventHandler(ribbonButton6_MouseEnter); // // ribbonButton7 // this.ribbonButton7.BackColor = System.Drawing.Color.WhiteSmoke; this.ribbonButton7.Image = global::Genetibase.NuGenTransform.Properties.Resources.greenarrow; this.ribbonButton7.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.ribbonButton7.IsFlat = true; this.ribbonButton7.IsPressed = false; this.ribbonButton7.Location = new System.Drawing.Point(5, 109); this.ribbonButton7.Margin = new System.Windows.Forms.Padding(1); this.ribbonButton7.Name = "ribbonButton7"; this.ribbonButton7.Padding = new System.Windows.Forms.Padding(2); this.ribbonButton7.Size = new System.Drawing.Size(144, 52); this.ribbonButton7.TabIndex = 1; this.ribbonButton7.Text = "Window"; this.ribbonButton7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.ribbonButton7.Click += new System.EventHandler(this.ribbonButton1_Click); this.ribbonButton7.MouseEnter += new EventHandler(ribbonButton7_MouseEnter); // // ribbonButton8 // this.ribbonButton8.BackColor = System.Drawing.Color.WhiteSmoke; this.ribbonButton8.Image = global::Genetibase.NuGenTransform.Properties.Resources.greenarrow; this.ribbonButton8.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.ribbonButton8.IsFlat = true; this.ribbonButton8.IsPressed = false; this.ribbonButton8.Location = new System.Drawing.Point(5, 161); this.ribbonButton8.Margin = new System.Windows.Forms.Padding(1); this.ribbonButton8.Name = "ribbonButton8"; this.ribbonButton8.Padding = new System.Windows.Forms.Padding(2); this.ribbonButton8.Size = new System.Drawing.Size(144, 52); this.ribbonButton8.TabIndex = 1; this.ribbonButton8.Text = "File"; this.ribbonButton8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.ribbonButton8.Click += new System.EventHandler(this.ribbonButton1_Click); this.ribbonButton8.MouseEnter += new EventHandler(ribbonButton8_MouseEnter); // // pictureBox1 // this.pictureBox1.BackColor = System.Drawing.Color.Silver; this.pictureBox1.Location = new System.Drawing.Point(0, 221); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(155, 1); this.pictureBox1.TabIndex = 2; this.pictureBox1.TabStop = false; // // NuGenPopupMenu // this.BackColor = System.Drawing.Color.DimGray; this.ClientSize = new System.Drawing.Size(155, 444); this.Controls.Add(this.pictureBox1); this.Controls.Add(this.ribbonButton4); this.Controls.Add(this.ribbonButton3); this.Controls.Add(this.ribbonButton2); this.Controls.Add(this.ribbonButton7); this.Controls.Add(this.ribbonButton6); this.Controls.Add(this.ribbonButton5); this.Controls.Add(this.ribbonButton1); this.Controls.Add(this.ribbonButton8); this.Name = "NuGenPopupMenu"; this.Paint += new System.Windows.Forms.PaintEventHandler(this.NuGenPopupMenu_Paint); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); }
private void InitHomeTab() { //Clipboard panel RibbonButton btnPaste = new RibbonButton("Paste"); btnPaste.Image = Resources.paste_32; btnPaste.Click += new EventHandler(pasteRibbonButton_Click); RibbonButton btnCut = new RibbonButton("Cut"); btnCut.MaxSizeMode = RibbonElementSizeMode.Medium; btnCut.SmallImage = Resources.cut_16; btnCut.Click += new EventHandler(cutRibbonButton_Click); RibbonButton btnCopy = new RibbonButton("Copy"); btnCopy.MaxSizeMode = RibbonElementSizeMode.Medium; btnCopy.SmallImage = Resources.copy_16; btnCopy.Click += new EventHandler(copyRibbonButton_Click); RibbonButton btnDelete = new RibbonButton("Delete"); btnDelete.MaxSizeMode = RibbonElementSizeMode.Medium; btnDelete.SmallImage = Resources.delete_16; btnDelete.Click += new EventHandler(deleteRibbonButton_Click); panelClipboard = new RibbonPanel("Clipboard"); panelClipboard.Items.Add(btnPaste); panelClipboard.Items.Add(btnCut); panelClipboard.Items.Add(btnCopy); panelClipboard.Items.Add(btnDelete); //Arrange RibbonButton btnAlignHorizontally = new RibbonButton(); btnAlignHorizontally.SmallImage = Resources.align_horizontally_16; btnAlignHorizontally.MaxSizeMode = RibbonElementSizeMode.Compact; btnAlignHorizontally.Click += new EventHandler(alignHorizontallyRibbonButton_Click); RibbonButton btnAlignVertically = new RibbonButton(); btnAlignVertically.SmallImage = Resources.align_vertically_16; btnAlignVertically.MaxSizeMode = RibbonElementSizeMode.Compact; btnAlignVertically.Click += new EventHandler(alignVerticallyRibbonButton_Click); RibbonButton btnSpaceHorizontally = new RibbonButton(); btnSpaceHorizontally.SmallImage = Resources.space_horizontally_16; btnSpaceHorizontally.MaxSizeMode = RibbonElementSizeMode.Compact; btnSpaceHorizontally.Click += new EventHandler(spaceHorizontallyRibbonButton_Click); RibbonButton btnSpaceVertically = new RibbonButton(); btnSpaceVertically.SmallImage = Resources.space_vertically_16; btnSpaceVertically.MaxSizeMode = RibbonElementSizeMode.Compact; btnSpaceVertically.Click += new EventHandler(spaceVerticallyRibbonButton_Click); RibbonItemGroup itemgroupAlignment = new RibbonItemGroup(); itemgroupAlignment.Items.Add(btnAlignHorizontally); itemgroupAlignment.Items.Add(btnAlignVertically); itemgroupAlignment.Items.Add(btnSpaceHorizontally); itemgroupAlignment.Items.Add(btnSpaceVertically); RibbonButton btnFlipHorizontally = new RibbonButton(); btnFlipHorizontally.SmallImage = Resources.flip_horizontally_16; btnFlipHorizontally.MaxSizeMode = RibbonElementSizeMode.Compact; btnFlipHorizontally.Click += new EventHandler(flipHorizontallyRibbonButton_Click); RibbonButton btnFlipVertically = new RibbonButton(); btnFlipVertically.SmallImage = Resources.flip_vertically_16; btnFlipVertically.MaxSizeMode = RibbonElementSizeMode.Compact; btnFlipVertically.Click += new EventHandler(flipVerticallyRibbonButton_Click); RibbonItemGroup itemgroupTransform = new RibbonItemGroup(); itemgroupTransform.Items.Add(btnFlipHorizontally); itemgroupTransform.Items.Add(btnFlipVertically); RibbonButton btnRotateAntiClockwise = new RibbonButton(); btnRotateAntiClockwise.SmallImage = Resources.rotate_acw_16; btnRotateAntiClockwise.MaxSizeMode = RibbonElementSizeMode.Compact; btnRotateAntiClockwise.Click += new EventHandler(rotateACwRibbonButton_Click); RibbonButton btnRotateClockwise = new RibbonButton(); btnRotateClockwise.SmallImage = Resources.rotate_cw_16; btnRotateClockwise.MaxSizeMode = RibbonElementSizeMode.Compact; btnRotateClockwise.Click += new EventHandler(rotateCwRibbonButton_Click); RibbonItemGroup itemgroupRotatation = new RibbonItemGroup(); itemgroupRotatation.Items.Add(btnRotateAntiClockwise); itemgroupRotatation.Items.Add(btnRotateClockwise); panelAlignment = new RibbonPanel("Alignment"); panelAlignment.FlowsTo = RibbonPanelFlowDirection.Right; panelAlignment.Items.Add(itemgroupAlignment); panelAlignment.Items.Add(itemgroupTransform); panelAlignment.Items.Add(itemgroupRotatation); RibbonButton btnBringForward = new RibbonButton("Bring Forwards"); btnBringForward.Image = Resources.bring_forward_32; btnBringForward.Click += new EventHandler(bringForwardRibbonButton_Click); RibbonButton btnSendBackward = new RibbonButton("Send Backwards"); btnSendBackward.Image = Resources.send_backward_32; btnSendBackward.Click += new EventHandler(sendBackwardRibbonButton_Click); RibbonButton btnBringToFront = new RibbonButton("Bring to Front"); btnBringToFront.Image = Resources.bring_to_front_32; btnBringToFront.Click += new EventHandler(bringToFrontRibbonButton_Click); RibbonButton btnSendToBack = new RibbonButton("Send to Back"); btnSendToBack.Image = Resources.send_to_back_32; btnSendToBack.Click += new EventHandler(sendToBackRibbonButton_Click); panelZOrder = new RibbonPanel("Z Order"); panelZOrder.Items.Add(btnBringForward); panelZOrder.Items.Add(btnSendBackward); panelZOrder.Items.Add(btnBringToFront); panelZOrder.Items.Add(btnSendToBack); RibbonButton btnLaunchPeggleNights = new RibbonButton("Nights"); btnLaunchPeggleNights.Image = Resources.PeggleNights_32; btnLaunchPeggleNights.Click += new EventHandler(peggleNightsRibbonButton_Click); RibbonPanel panelPeggle = new RibbonPanel("Launch Peggle"); panelPeggle.Items.Add(btnLaunchPeggleNights); RibbonTab tabHome = new RibbonTab(mRibbon, "Home"); tabHome.Panels.Add(panelClipboard); tabHome.Panels.Add(panelAlignment); tabHome.Panels.Add(panelZOrder); tabHome.Panels.Add(panelPeggle); mRibbon.Tabs.Add(tabHome); }