- ribbonsource0.4.zip
- System.Windows.Forms.Ribbon
- RibbonDemo
- BlackForm.cs
- BlackForm.Designer.cs
- BlackForm.resx
- MainForm.cs
- MainForm.Designer.cs
- MainForm.resx
- Program.cs
- Properties
- Resources
- addons32.png
- bold16.png
- borderbottom16.png
- casing16.png
- close32.png
- copy16.png
- copyformat16.png
- cut16.png
- eraseformat16.png
- exit16.png
- fill16.png
- find32.png
- fontcolor16.png
- fontsizedecrease16.png
- fontsizeincrease16.png
- goto16.png
- hilight16.png
- indentdecrease16.png
- indentdecrease161.png
- indentincrease16.png
- invisiblechars16.png
- italic16.png
- multilevellist16.png
- newdocument32.png
- open16.png
- open32.png
- options16.png
- orderedlist16.png
- pageblank16.png
- paragraphspacing16.png
- paste16.png
- paste32.png
- paste321.png
- pastelink16.png
- pastespecial16.png
- prepare32.png
- print32.png
- print321.png
- printpreview32.png
- printquick16.png
- printquick32.png
- publish32.png
- replace16.png
- save16.png
- save32.png
- saveas32.png
- saveas321.png
- select16.png
- send32.png
- sort16.png
- strikethru16.png
- style16.png
- stylechange32.png
- styleset16.png
- subindex16.png
- superindex16.png
- textaligncenter16.png
- textalignjustify16.png
- textalignleft16.png
- textalignright16.png
- themefont.png
- underline16.png
- undo16.png
- unorderedlist16.png
- word2003doc32.png
- worddocument32.png
- wordtemplate32.png
- RibbonDemo.csproj
- System.Windows.Forms.Ribbon.sln
- System.Windows.Forms.Ribbon.suo
- System.Windows.Forms.Ribbon
- ribbondemo0.4.zip
- RibbonDemo.exe
- System.Windows.Forms.Ribbon.dll
- ribbondemo_0.2.zip
- RibbonDemo.exe
- System.Windows.Forms.Ribbon.dll
- ribbonsource_0.3.zip
- bin
- RibbonDemo_0.3.zip
- RibbonDemo.exe
- System.Windows.Forms.Ribbon.dll
- RibbonDemo.zip
- RibbonDemo.exe
- System.Windows.Forms.Ribbon.dll
- ribbonsource_0.2.zip
|
/*
2008 Jos� Manuel Men�ndez Poo
*
* Please give me credit if you use this code. It's all I ask.
*
* Contact me for more info: menendezpoo@gmail.com
*
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace System.Windows.Forms
{
public sealed class RibbonSeparator : RibbonItem
{
public RibbonSeparator()
{
}
public RibbonSeparator(string text)
{
Text = text;
}
public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
{
Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(
Owner, e.Graphics, e.Clip, this));
if (!string.IsNullOrEmpty(Text))
{
Owner.Renderer.OnRenderRibbonItemText(new RibbonTextEventArgs(
Owner, e.Graphics, e.Clip, this,
Rectangle.FromLTRB(
Bounds.Left + Owner.ItemMargin.Left,
Bounds.Top + Owner.ItemMargin.Top,
Bounds.Right - Owner.ItemMargin.Right,
Bounds.Bottom - Owner.ItemMargin.Bottom), Text, FontStyle.Bold));
}
}
public override void SetBounds(System.Drawing.Rectangle bounds)
{
base.SetBounds(bounds);
}
public override Size MeasureSize(object sender, RibbonElementMeasureSizeEventArgs e)
{
if (e.SizeMode == RibbonElementSizeMode.DropDown)
{
if (string.IsNullOrEmpty(Text))
{
SetLastMeasuredSize(new Size(1, 3));
}
else
{
Size sz = e.Graphics.MeasureString(Text, new Font(Owner.Font, FontStyle.Bold)).ToSize();
SetLastMeasuredSize(new Size(sz.Width + Owner.ItemMargin.Horizontal, sz.Height + Owner.ItemMargin.Vertical));
}
}
else
{
SetLastMeasuredSize( new Size(2, OwnerPanel.ContentBounds.Height - Owner.ItemPadding.Vertical - Owner.ItemMargin.Vertical));
}
return LastMeasuredSize;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
- I've been programming Windows and Web apps since 1997.
- My greatest concern nowadays is product, user interface, and usability.
- TypeScript / React expert
@geeksplainer