/// <param name="ownerGroup">Group that this collection belongs to</param> internal RibbonItemGroupItemCollection(RibbonItemGroup ownerGroup) { _ownerGroup = ownerGroup; }
/// <summary> /// Sets the value of the OwnerList property /// </summary> /// <param name="ownerList"></param> internal virtual void SetOwnerGroup(RibbonItemGroup ownerGroup) { _ownerItem = ownerGroup; }
/// <summary> /// Draws the background of the specified RibbonItemGroup /// </summary> /// <param name="e"></param> /// <param name="?"></param> public void DrawItemGroupBorder(RibbonItemRenderEventArgs e, RibbonItemGroup grp) { if ((e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007) || e.Ribbon.IsDesignMode()) { Rectangle outerR = Rectangle.FromLTRB( grp.Bounds.Left, grp.Bounds.Top, grp.Bounds.Right - 1, grp.Bounds.Bottom - 1); Rectangle innerR = Rectangle.FromLTRB( outerR.Left + 1, outerR.Top + 1, outerR.Right - 1, outerR.Bottom - 1); GraphicsPath outer = RoundRectangle(outerR, 2); GraphicsPath inner = RoundRectangle(innerR, 2); using (Pen dark = new Pen(ColorTable.ItemGroupSeparatorDark)) { using (Pen light = new Pen(ColorTable.ItemGroupSeparatorLight)) { foreach (RibbonItem item in grp.Items) { if (item == grp.LastItem) break; e.Graphics.DrawLine(dark, new Point(item.Bounds.Right, item.Bounds.Top), new Point(item.Bounds.Right, item.Bounds.Bottom - 1)); e.Graphics.DrawLine(light, new Point(item.Bounds.Right + 1, item.Bounds.Top), new Point(item.Bounds.Right + 1, item.Bounds.Bottom - 1)); } } } using (Pen p = new Pen(ColorTable.ItemGroupOuterBorder)) { e.Graphics.DrawPath(p, outer); } using (Pen p = new Pen(ColorTable.ItemGroupInnerBorder)) { e.Graphics.DrawPath(p, inner); } outer.Dispose(); inner.Dispose(); } }
/// <summary> /// Draws the background of the specified RibbonItemGroup /// </summary> /// <param name="e"></param> /// <param name="?"></param> public void DrawItemGroup(RibbonItemRenderEventArgs e, RibbonItemGroup grp) { if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007) { Rectangle outerR = Rectangle.FromLTRB( grp.Bounds.Left, grp.Bounds.Top, grp.Bounds.Right - 1, grp.Bounds.Bottom - 1); Rectangle innerR = Rectangle.FromLTRB( outerR.Left + 1, outerR.Top + 1, outerR.Right - 1, outerR.Bottom - 1); Rectangle glossyR = Rectangle.FromLTRB( outerR.Left + 1, outerR.Top + outerR.Height / 2 + 1, outerR.Right - 1, outerR.Bottom - 1); GraphicsPath outer = RoundRectangle(outerR, 2); GraphicsPath inner = RoundRectangle(innerR, 2); GraphicsPath glossy = RoundRectangle(glossyR, 2); using (LinearGradientBrush b = new LinearGradientBrush( innerR, ColorTable.ItemGroupBgNorth, ColorTable.ItemGroupBgSouth, 90)) { e.Graphics.FillPath(b, inner); } using (LinearGradientBrush b = new LinearGradientBrush( glossyR, ColorTable.ItemGroupBgGlossy, Color.Transparent, 90)) { e.Graphics.FillPath(b, glossy); } outer.Dispose(); inner.Dispose(); } }
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); }