本文整理汇总了C#中RibbonElementSizeMode类的典型用法代码示例。如果您正苦于以下问题:C# RibbonElementSizeMode类的具体用法?C# RibbonElementSizeMode怎么用?C# RibbonElementSizeMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RibbonElementSizeMode类属于命名空间,在下文中一共展示了RibbonElementSizeMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnGetTextBounds
internal override Rectangle OnGetTextBounds(RibbonElementSizeMode sMode, Rectangle bounds)
{
Rectangle r = base.OnGetTextBounds(sMode, bounds);
r.X = Bounds.Left + 3;
return r;
}
示例2: RibbonPanel
/// <summary>
/// Creates a new RibbonPanel
/// </summary>
public RibbonPanel()
{
_items = new RibbonItemCollection();
_sizeMode = RibbonElementSizeMode.None;
_flowsTo = RibbonPanelFlowDirection.Bottom;
_buttonMoreEnabled = true;
_buttonMoreVisible = true;
_items.SetOwnerPanel(this);
_enabled = true;
}
示例3: RibbonButtonList
public RibbonButtonList()
{
_buttons = new RibbonButtonCollection(this);
_dropDownItems = new RibbonItemCollection();
_controlButtonsWidth = 16;
_itemsInLargeMode = 7;
_itemsInMediumMode = 3;
_ItemsInDropwDownMode = new Size(7, 5);
_buttonsSizeMode = RibbonElementSizeMode.Large;
}
示例4: RibbonDropDown
internal RibbonDropDown(RibbonItem parentItem, IEnumerable<RibbonItem> items, Ribbon ownerRibbon, RibbonElementSizeMode measuringSize)
: this()
{
_items = items;
_ownerRibbon = ownerRibbon;
_sizingGripHeight = 12;
_parentItem = parentItem;
_sensor = new RibbonMouseSensor(this, OwnerRibbon, items);
_MeasuringSize = measuringSize;
if (Items != null)
foreach (RibbonItem item in Items)
{
item.SetSizeMode(RibbonElementSizeMode.DropDown);
item.SetCanvas(this);
}
UpdateSize();
}
示例5: RibbonDropDown
internal RibbonDropDown(RibbonItem parentItem, IEnumerable<RibbonItem> items, Ribbon ownerRibbon, RibbonElementSizeMode measuringSize)
: this()
{
_items = items;
_ownerRibbon = ownerRibbon;
_sizingGripHeight = 12;
_parentItem = parentItem;
_sensor = new RibbonMouseSensor(this, OwnerRibbon, items);
_MeasuringSize = measuringSize;
_scrollBarSize = 16;
if (Items != null)
foreach (RibbonItem item in Items)
{
item.SetSizeMode(RibbonElementSizeMode.DropDown);
item.SetCanvas(this);
//If item is a RibbonHost, the MouseSensor will not detect the mouse move event, so manually hook into the event.
if (item is RibbonHost)
{
((RibbonHost)item).ClientMouseMove += new MouseEventHandler(OnRibbonHostMouseMove);
}
}
UpdateSize();
}
示例6: UpdateRegionsFlowsToRight
/// <summary>
/// Updates the bounds of child elements when flow is to bottom
/// </summary>
private void UpdateRegionsFlowsToRight(Graphics g, RibbonElementSizeMode mode)
{
int curLeft = ContentBounds.Left;
int curTop = ContentBounds.Top;
int padding = mode == RibbonElementSizeMode.Medium ? 7 : 0;
int maxBottom = 0;
#region Sorts from larger to smaller
RibbonItem[] array = Items.ToArray();
for (int i = (array.Length - 1); i >= 0; i--)
{
for (int j = 1; j <= i; j++)
{
if (array[j - 1].LastMeasuredSize.Width < array[j].LastMeasuredSize.Width)
{
RibbonItem temp = array[j - 1];
array[j - 1] = array[j];
array[j] = temp;
}
}
}
#endregion
List<RibbonItem> list = new List<RibbonItem>(array);
///Attend elements, deleting every attended element from the list
while (list.Count > 0)
{
///Extract item and delete it
RibbonItem item = list[0];
list.Remove(item);
///If not enough space left, reset left and advance top
if (curLeft + item.LastMeasuredSize.Width > ContentBounds.Right)
{
curLeft = ContentBounds.Left;
curTop = maxBottom + Owner.ItemPadding.Vertical + 1 + padding;
}
///Set item's bounds
item.SetBounds(new Rectangle(new Point(curLeft, curTop), item.LastMeasuredSize));
///Increment reminders
curLeft += item.Bounds.Width + Owner.ItemPadding.Horizontal;
maxBottom = Math.Max(maxBottom, item.Bounds.Bottom);
///Check available space after placing item
int spaceAvailable = ContentBounds.Right - curLeft;
///Check for elements that fit on available space
for (int i = 0; i < list.Count; i++)
{
///If item fits on the available space
if (list[i].LastMeasuredSize.Width < spaceAvailable)
{
///Place the item there and reset the counter to check for further items
list[i].SetBounds(new Rectangle(new Point(curLeft, curTop), list[i].LastMeasuredSize));
curLeft += list[i].Bounds.Width + Owner.ItemPadding.Horizontal;
maxBottom = Math.Max(maxBottom, list[i].Bounds.Bottom);
spaceAvailable = ContentBounds.Right - curLeft;
list.RemoveAt(i);
i = 0;
}
}
}
}
示例7: UpdateItemsRegions
/// <summary>
/// Updates the bounds of child elements
/// </summary>
internal void UpdateItemsRegions(Graphics g, RibbonElementSizeMode mode)
{
switch (FlowsTo)
{
case RibbonPanelFlowDirection.Right:
UpdateRegionsFlowsToRight(g, mode);
break;
case RibbonPanelFlowDirection.Bottom:
UpdateRegionsFlowsToBottom(g, mode);
break;
}
///Center items on the panel
CenterItems();
}
示例8: SetSizeMode
internal override void SetSizeMode(RibbonElementSizeMode sizeMode)
{
if (sizeMode == RibbonElementSizeMode.Overflow)
{
base.SetSizeMode(RibbonElementSizeMode.Large);
}
else
{
base.SetSizeMode(sizeMode);
}
}
示例9: OnGetImageBounds
/// <summary>
/// Sets the bounds of the image of the button when SetBounds is called.
/// Override this method to change image bounds
/// </summary>
/// <param name="sMode">Mode which is being measured</param>
/// <param name="bounds">Bounds of the button</param>
/// <remarks>
/// The measuring occours in the following order:
/// <list type="">
/// <item>OnSetImageBounds</item>
/// <item>OnSetTextBounds</item>
/// <item>OnSetDropDownBounds</item>
/// <item>OnSetButtonFaceBounds</item>
/// </list>
/// </remarks>
internal virtual Rectangle OnGetImageBounds(RibbonElementSizeMode sMode, Rectangle bounds)
{
if (sMode == RibbonElementSizeMode.Large)// || this is RibbonOrbMenuItem)
{
if (Image != null)
{
return new Rectangle(
Bounds.Left + ((Bounds.Width - Image.Width) / 2),
Bounds.Top + Owner.ItemMargin.Top,
Image.Width,
Image.Height);
}
else
{
return new Rectangle(ContentBounds.Location, new Size(32, 32));
}
}
else
{
if (SmallImage != null)
{
return new Rectangle(
Bounds.Left + Owner.ItemMargin.Left,
Bounds.Top + ((Bounds.Height - SmallImage.Height) / 2),
SmallImage.Width,
SmallImage.Height);
}
else
{
return new Rectangle(ContentBounds.Location, new Size(0, 0));
}
}
}
示例10: OnGetButtonFaceBounds
/// <summary>
/// Sets the bounds of the button face part of the button when SetBounds is called.
/// Override this method to change image bounds
/// </summary>
/// <param name="sMode">Mode which is being measured</param>
/// <param name="bounds">Bounds of the button</param>
/// <remarks>
/// The measuring occours in the following order:
/// <list type="">
/// <item>OnSetImageBounds</item>
/// <item>OnSetTextBounds</item>
/// <item>OnSetDropDownBounds</item>
/// <item>OnSetButtonFaceBounds</item>
/// </list>
/// </remarks>
internal virtual Rectangle OnGetButtonFaceBounds(RibbonElementSizeMode sMode, Rectangle bounds)
{
Rectangle sideBounds = Rectangle.FromLTRB(
bounds.Right - _dropDownMargin.Horizontal - 2,
bounds.Top, bounds.Right, bounds.Bottom);
switch (SizeMode)
{
case RibbonElementSizeMode.Large:
case RibbonElementSizeMode.Overflow:
return Rectangle.FromLTRB(bounds.Left,
bounds.Top, bounds.Right, _dropDownBounds.Top);
case RibbonElementSizeMode.DropDown:
case RibbonElementSizeMode.Medium:
case RibbonElementSizeMode.Compact:
return Rectangle.FromLTRB(bounds.Left, bounds.Top,
_dropDownBounds.Left, bounds.Bottom);
}
return Rectangle.Empty;
}
示例11: RibbonElementPaintEventArgs
internal RibbonElementPaintEventArgs(Rectangle clip, Graphics graphics, RibbonElementSizeMode mode, Control control)
: this(clip, graphics, mode)
{
_control = control;
}
示例12: OnGetImageBounds
internal override Rectangle OnGetImageBounds(RibbonElementSizeMode sMode, System.Drawing.Rectangle bounds)
{
return Rectangle.Empty;
}
示例13: AddButton
private RibbonButton AddButton(RibbonItemCollection collection, RibbonButtonStyle style, string label, string msoImageName,
string msoCommandName, RibbonElementSizeMode maxSizeMode = RibbonElementSizeMode.None, Action customAction = null)
{
RibbonButton button = new RibbonButton();
button.Style = style;
button.MaxSizeMode = maxSizeMode;
button.Text = label;
AssignImage(button, msoImageName);
if (customAction == null) {
AssignAction(button, msoCommandName);
} else {
EventHandler handler = new EventHandler(delegate(object sender, EventArgs ea) {
RunCommand(customAction);
});
button.Click += handler;
button.DoubleClick += handler;
}
collection.Add(button);
return button;
}
示例14: RibbonElementMeasureSizeEventArgs
/// <summary>
/// Creates a new RibbonElementMeasureSizeEventArgs object
/// </summary>
/// <param name="graphics">Device info to draw and measure</param>
/// <param name="sizeMode">Size mode to measure</param>
internal RibbonElementMeasureSizeEventArgs(System.Drawing.Graphics graphics, RibbonElementSizeMode sizeMode)
{
_graphics = graphics;
_sizeMode = sizeMode;
}
示例15: SetSizeMode
/// <summary>
/// Sets the value of the SizeMode property
/// </summary>
/// <param name="sizeMode"></param>
internal virtual void SetSizeMode(RibbonElementSizeMode sizeMode)
{
_sizeMode = GetNearestSize(sizeMode);
}