本文整理汇总了C#中ComponentFactory.Krypton.Toolkit.ViewLayoutContext类的典型用法代码示例。如果您正苦于以下问题:C# ViewLayoutContext类的具体用法?C# ViewLayoutContext怎么用?C# ViewLayoutContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ViewLayoutContext类属于ComponentFactory.Krypton.Toolkit命名空间,在下文中一共展示了ViewLayoutContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Layout
/// <summary>
/// Perform a layout of the elements.
/// </summary>
/// <param name="context">Layout context.</param>
public override void Layout(ViewLayoutContext context)
{
Debug.Assert(context != null);
// We take on all the available display area
ClientRectangle = context.DisplayRectangle;
// Are we allowed to layout child controls?
if (!context.ViewManager.DoNotLayoutControls)
{
// Are we allowed to actually layout the pages?
if (_navigator.InternalCanLayout)
{
// Do not position the child panel if it is borrowed
if (!_navigator.IsChildPanelBorrowed)
{
// Position the child panel for showing page information
_navigator.ChildPanel.SetBounds(HIDDEN_OFFSET,
HIDDEN_OFFSET,
ClientWidth,
ClientHeight);
}
}
}
}
示例2: Layout
/// <summary>
/// Perform a layout of the elements.
/// </summary>
/// <param name="context">Layout context.</param>
public override void Layout(ViewLayoutContext context)
{
Debug.Assert(context != null);
// We take on all the available display area
ClientRectangle = context.DisplayRectangle;
// Are we allowed to layout child controls?
if (!context.ViewManager.DoNotLayoutControls)
{
// Are we allowed to actually layout the pages?
if (_navigator.InternalCanLayout)
{
// Update position of page if not already in correct position
if ((_page.Location != Point.Empty) ||
(_page.Width != ClientWidth) ||
(_page.Height != ClientHeight))
{
_page.SetBounds(0, 0, ClientWidth, ClientHeight);
}
// Update position of child panel if not already in correct position
if ((_navigator.ChildPanel.Location != ClientLocation) ||
(_navigator.ChildPanel.Width != ClientWidth) ||
(_navigator.ChildPanel.Height != ClientHeight))
{
// Position the child panel for showing page
_navigator.ChildPanel.SetBounds(ClientLocation.X,
ClientLocation.Y,
ClientWidth,
ClientHeight);
}
}
}
}
示例3: Layout
/// <summary>
/// Perform a layout of the elements.
/// </summary>
/// <param name="context">Layout context.</param>
public override void Layout(ViewLayoutContext context)
{
Debug.Assert(context != null);
// Validate incoming reference
if (context == null) throw new ArgumentNullException("context");
// We take on all the available display area
ClientRectangle = context.DisplayRectangle;
// Layout children from top to bottom with equal height and the total width
int yOffset = 0;
int childHeight = (ClientHeight / Count) + 1;
foreach (ViewBase child in this)
{
// If this is the last child in collection...
if (child == this[Count - 1])
{
//...then give it all the remainder space
childHeight = ClientHeight - yOffset;
}
// Position the child
context.DisplayRectangle = new Rectangle(ClientLocation.X, yOffset, ClientWidth, childHeight);
child.Layout(context);
// Move down to next position
yOffset += (childHeight - 1);
}
// Put back the original display value now we have finished
context.DisplayRectangle = ClientRectangle;
}
示例4: GetPreferredSize
/// <summary>
/// Discover the preferred size of the element.
/// </summary>
/// <param name="context">Layout context.</param>
public override Size GetPreferredSize(ViewLayoutContext context)
{
Debug.Assert(context != null);
// Ask the renderer for the required size of the drop down button
return context.Renderer.RenderGlyph.GetDropDownButtonPreferredSize(context, _palette, State, Orientation);
}
示例5: GetPreferredSize
/// <summary>
/// Discover the preferred size of the element.
/// </summary>
/// <param name="context">Layout context.</param>
public override Size GetPreferredSize(ViewLayoutContext context)
{
Debug.Assert(context != null);
// Accumulate the stacked size
Size preferredSize = Size.Empty;
foreach (ViewBase child in this)
{
if (child.Visible)
{
// Get the preferred size of the child
Size childSize = child.GetPreferredSize(context);
// Depending on orientation, add up child sizes
if (Horizontal)
{
preferredSize.Height = Math.Max(preferredSize.Height, childSize.Height);
preferredSize.Width += childSize.Width;
}
else
{
preferredSize.Height += childSize.Height;
preferredSize.Width = Math.Max(preferredSize.Width, childSize.Width);
}
}
}
return preferredSize;
}
示例6: Layout
/// <summary>
/// Perform a layout of the elements.
/// </summary>
/// <param name="context">Layout context.</param>
public override void Layout(ViewLayoutContext context)
{
Debug.Assert(context != null);
// We take on all the available display area
ClientRectangle = context.DisplayRectangle;
}
示例7: GetPreferredSize
/// <summary>
/// Discover the preferred size of the element.
/// </summary>
/// <param name="context">Layout context.</param>
public override Size GetPreferredSize(ViewLayoutContext context)
{
Debug.Assert(context != null);
// We are a null leaf, so have no size
return Size.Empty;
}
示例8: GetPreferredSize
public override Size GetPreferredSize(ViewLayoutContext context)
{
Size preferredSize = Size.Empty;
// We need an owning form to perform calculations
if (_ownerForm != null)
{
// We only have size if custom chrome is being used with composition
if (_ownerForm.ApplyCustomChrome && _ownerForm.ApplyComposition)
{
try
{
// Create structure that will be populated by call to WM_GETTITLEBARINFOEX
PI.TITLEBARINFOEX tbi = new PI.TITLEBARINFOEX();
tbi.cbSize = (uint)Marshal.SizeOf(tbi);
// Ask the window for the title bar information
PI.SendMessage(_ownerForm.Handle, PI.WM_GETTITLEBARINFOEX, IntPtr.Zero, ref tbi);
// Find width of the button rectangle
int closeWidth = tbi.rcCloseButton.right - tbi.rcCloseButton.left;
int helpWidth = tbi.rcHelpButton.right - tbi.rcHelpButton.left;
int minWidth = tbi.rcMinButton.right - tbi.rcMinButton.left;
int maxWidth = tbi.rcMaxButton.right - tbi.rcMaxButton.left;
int clientWidth = _ownerForm.ClientSize.Width;
int clientScreenRight = _ownerForm.RectangleToScreen(_ownerForm.ClientRectangle).Right;
int leftMost = clientScreenRight;
// Find the left most button edge (start with right side of client area)
if ((closeWidth > 0) && (closeWidth < clientWidth))
leftMost = Math.Min(leftMost, tbi.rcCloseButton.left);
if ((helpWidth > 0) && (helpWidth < clientWidth))
leftMost = Math.Min(leftMost, tbi.rcHelpButton.left);
if ((minWidth > 0) && (minWidth < clientWidth))
leftMost = Math.Min(leftMost, tbi.rcMinButton.left);
if ((maxWidth > 0) && (maxWidth < clientWidth))
leftMost = Math.Min(leftMost, tbi.rcMaxButton.left);
// Our width is the distance between the left most button edge and the right
// side of the client area (this space the buttons are taking up). Plus a small
// extra gap between the first button and the caption elements to its left.
_width = (clientScreenRight - leftMost) + SPACING_GAP;
preferredSize.Width = _width;
}
catch(ObjectDisposedException)
{
// Asking for the WM_GETTITLEBARINFOEX can cause exception if the form level
// Icon has already been disposed. This happens in rare circumstances.
}
}
}
return preferredSize;
}
示例9: Layout
/// <summary>
/// Perform a layout of the elements.
/// </summary>
/// <param name="context">Layout context.</param>
public override void Layout(ViewLayoutContext context)
{
// Make all stacking items that should be visible are visible
ViewBuilder.UnshrinkAppropriatePages();
// Let base class continue with standard layout
base.Layout(context);
}
示例10: GetPreferredSize
/// <summary>
/// Discover the preferred size of the element.
/// </summary>
/// <param name="context">Layout context.</param>
public override Size GetPreferredSize(ViewLayoutContext context)
{
// Get the preferred size of the contained content
Size preferredSize = base.GetPreferredSize(context);
// Add on the padding we need around edges
return new Size(preferredSize.Width + _preferredPadding.Horizontal,
preferredSize.Height + _preferredPadding.Vertical);
}
示例11: Layout
/// <summary>
/// Perform a layout of the elements.
/// </summary>
/// <param name="context">Layout context.</param>
public override void Layout(ViewLayoutContext context)
{
Debug.Assert(context != null);
// Validate incoming reference
if (context == null) throw new ArgumentNullException("context");
// We take on all the available display area
Rectangle original = context.DisplayRectangle;
ClientRectangle = original;
// Layout each child
int offset = 0;
int space = (_orientation == Orientation.Vertical ? ClientHeight : ClientWidth);
for(int i=0; i<Count; i++)
{
ViewBase child = this[i];
// Find length of this item
int length = 0;
// If this is the last item then it takes the remaining space
if (i == (Count - 1))
length = space;
else
{
// Give this item an equal portion of the remainder
length = space / (Count - i);
}
// Ask child for it's own preferred size
Size childPreferred = child.GetPreferredSize(context);
// Size child to our relevant dimension
if (_orientation == Orientation.Vertical)
context.DisplayRectangle = new Rectangle(ClientRectangle.X,
ClientRectangle.Y + offset,
childPreferred.Width,
length);
else
context.DisplayRectangle = new Rectangle(ClientRectangle.X + offset,
ClientRectangle.Y,
length,
ClientRectangle.Height);
// Ask the child to layout
child.Layout(context);
// Adjust running values
offset += length;
space -= length;
}
// Put back the original display value now we have finished
context.DisplayRectangle = original;
}
示例12: GetPreferredSize
/// <summary>
/// Discover the preferred size of the element.
/// </summary>
/// <param name="context">Layout context.</param>
public override Size GetPreferredSize(ViewLayoutContext context)
{
Debug.Assert(context != null);
// Get the sizing metric
int length = _paletteMetric.GetMetricInt(ElementState, _metricInt);
// Use the same size for vertical and horizontal
return new Size(length, length);
}
示例13: Layout
/// <summary>
/// Perform a layout of the elements.
/// </summary>
/// <param name="context">Layout context.</param>
public override void Layout(ViewLayoutContext context)
{
Debug.Assert(context != null);
// Get the sizing metric
int length = _paletteMetric.GetMetricInt(ElementState, _metricInt);
// Always use the metric and ignore given space
ClientRectangle = new Rectangle(context.DisplayRectangle.Location, new Size(length, length));
}
示例14: Layout
/// <summary>
/// Perform a layout of the elements.
/// </summary>
/// <param name="context">Layout context.</param>
public override void Layout(ViewLayoutContext context)
{
Debug.Assert(context != null);
// We take on all the available display area
ClientRectangle = context.DisplayRectangle;
// Ensure all children are layed out in our total space
base.Layout(context);
}
示例15: Layout
/// <summary>
/// Perform a layout of the elements.
/// </summary>
/// <param name="context">Layout context.</param>
public override void Layout(ViewLayoutContext context)
{
Debug.Assert(context != null);
// We take on all the available display area
ClientRectangle = context.DisplayRectangle;
// Put back the original display value now we have finished
context.DisplayRectangle = ClientRectangle;
}