本文整理汇总了C#中IArrangedElement类的典型用法代码示例。如果您正苦于以下问题:C# IArrangedElement类的具体用法?C# IArrangedElement怎么用?C# IArrangedElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IArrangedElement类属于命名空间,在下文中一共展示了IArrangedElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPreferredSize
internal override Size GetPreferredSize(IArrangedElement container, Size proposedConstraints) {
#if DEBUG
if (CompModSwitches.FlowLayout.TraceInfo) {
Debug.WriteLine("FlowLayout::GetPreferredSize("
+ "container=" + container.ToString() + ", "
+ "proposedConstraints=" + proposedConstraints.ToString() + ")");
Debug.Indent();
}
#endif
Rectangle measureBounds = new Rectangle(new Point(0, 0), proposedConstraints);
Size prefSize = xLayout(container, measureBounds, /* measureOnly = */ true);
if(prefSize.Width > proposedConstraints.Width || prefSize.Height> proposedConstraints.Height) {
// Controls measured earlier than a control which couldn't be fit to constraints may
// shift around with the new bounds. We need to make a 2nd pass through the
// controls using these bounds which are gauranteed to fit.
measureBounds.Size = prefSize;
prefSize = xLayout(container, measureBounds, /* measureOnly = */ true);
}
#if DEBUG
if (CompModSwitches.FlowLayout.TraceInfo) {
Debug.Unindent();
Debug.WriteLine("GetPreferredSize returned " + prefSize);
}
#endif
return prefSize;
}
示例2: ClearMaximumSize
internal static void ClearMaximumSize(IArrangedElement element)
{
if (element.Properties.ContainsObject(_maximumSizeProperty))
{
element.Properties.RemoveObject(_maximumSizeProperty);
}
}
示例3: MoveElement
// Repositions a element in this list.
internal void MoveElement(IArrangedElement element, int fromIndex, int toIndex) {
int delta = toIndex - fromIndex;
switch (delta) {
case -1:
case 1:
// simple swap
this.InnerList[fromIndex] = this.InnerList[toIndex];
break;
default:
int start = 0;
int dest = 0;
// which direction are we moving?
if (delta > 0) {
// shift down by the delta to open the new spot
start = fromIndex + 1;
dest = fromIndex;
}
else {
// shift up by the delta to open the new spot
start = toIndex;
dest = toIndex + 1;
// make it positive
delta = -delta;
}
Copy(this, start, this, dest, delta);
break;
}
this.InnerList[toIndex] = element;
}
示例4: PerformLayout
public virtual void PerformLayout(IArrangedElement container, string propertyName)
{
if (this.suspendCount <= 0)
{
this.OnLayout(new LayoutEventArgs(container, propertyName));
}
}
示例5: MoveElement
internal void MoveElement(IArrangedElement element, int fromIndex, int toIndex)
{
int length = toIndex - fromIndex;
switch (length)
{
case -1:
case 1:
this.InnerList[fromIndex] = this.InnerList[toIndex];
break;
default:
{
int sourceIndex = 0;
int destinationIndex = 0;
if (length > 0)
{
sourceIndex = fromIndex + 1;
destinationIndex = fromIndex;
}
else
{
sourceIndex = toIndex;
destinationIndex = toIndex + 1;
length = -length;
}
Copy(this, sourceIndex, this, destinationIndex, length);
break;
}
}
this.InnerList[toIndex] = element;
}
示例6: EnsureOwnership
internal void EnsureOwnership(IArrangedElement owner)
{
this._owner = owner;
for (int i = 0; i < this.Count; i++)
{
this[i].Owner = owner;
}
}
示例7: GetAutoSizeMode
internal static AutoSizeMode GetAutoSizeMode(IArrangedElement element)
{
if (GetLayoutState(element)[_autoSizeModeSection] != 0)
{
return AutoSizeMode.GrowAndShrink;
}
return AutoSizeMode.GrowOnly;
}
示例8: SetFlowDirection
public static void SetFlowDirection(IArrangedElement container, FlowDirection value)
{
if (!System.Windows.Forms.ClientUtils.IsEnumValid(value, (int) value, 0, 3))
{
throw new InvalidEnumArgumentException("value", (int) value, typeof(FlowDirection));
}
container.Properties.SetInteger(_flowDirectionProperty, (int) value);
LayoutTransaction.DoLayout(container, container, PropertyNames.FlowDirection);
}
示例9: CreateTransactionIf
public static IDisposable CreateTransactionIf(bool condition, Control controlToLayout, IArrangedElement elementCausingLayout, string property)
{
if (condition)
{
return new LayoutTransaction(controlToLayout, elementCausingLayout, property);
}
CommonProperties.xClearPreferredSizeCache(elementCausingLayout);
return new NullLayoutTransaction();
}
示例10: GetMargin
internal static Padding GetMargin(IArrangedElement element)
{
bool flag;
Padding padding = element.Properties.GetPadding(_marginProperty, out flag);
if (flag)
{
return padding;
}
return DefaultMargin;
}
示例11: GetLayoutBounds
internal static Size GetLayoutBounds(IArrangedElement element)
{
bool flag;
Size size = element.Properties.GetSize(_layoutBoundsProperty, out flag);
if (flag)
{
return size;
}
return Size.Empty;
}
示例12: GetPreferredSize
internal override Size GetPreferredSize(IArrangedElement container, Size proposedConstraints)
{
Rectangle displayRect = new Rectangle(new Point(0, 0), proposedConstraints);
Size size = this.xLayout(container, displayRect, true);
if ((size.Width <= proposedConstraints.Width) && (size.Height <= proposedConstraints.Height))
{
return size;
}
displayRect.Size = size;
return this.xLayout(container, displayRect, true);
}
示例13: DoLayout
public static void DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, string property)
{
if (elementCausingLayout != null)
{
CommonProperties.xClearPreferredSizeCache(elementCausingLayout);
if (elementToLayout != null)
{
CommonProperties.xClearPreferredSizeCache(elementToLayout);
elementToLayout.PerformLayout(elementCausingLayout, property);
}
}
}
示例14: DoLayoutIf
public static void DoLayoutIf(bool condition, IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, string property)
{
if (!condition)
{
if (elementCausingLayout != null)
{
CommonProperties.xClearPreferredSizeCache(elementCausingLayout);
}
}
else
{
DoLayout(elementToLayout, elementCausingLayout, property);
}
}
示例15: CreateContainerProxy
private static ContainerProxy CreateContainerProxy(IArrangedElement container, FlowDirection flowDirection) {
switch (flowDirection) {
case FlowDirection.RightToLeft:
return new RightToLeftProxy(container);
case FlowDirection.TopDown:
return new TopDownProxy(container);
case FlowDirection.BottomUp:
return new BottomUpProxy(container);
case FlowDirection.LeftToRight:
default:
return new ContainerProxy(container);
}
}