本文整理汇总了C#中IArrangedElement类的典型用法代码示例。如果您正苦于以下问题:C# IArrangedElement类的具体用法?C# IArrangedElement怎么用?C# IArrangedElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IArrangedElement类属于命名空间,在下文中一共展示了IArrangedElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:28,代码来源:FlowLayout.cs
示例2: ClearMaximumSize
internal static void ClearMaximumSize(IArrangedElement element)
{
if (element.Properties.ContainsObject(_maximumSizeProperty))
{
element.Properties.RemoveObject(_maximumSizeProperty);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:CommonProperties.cs
示例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;
}
开发者ID:JianwenSun,项目名称:cc,代码行数:34,代码来源:ArrangedElementCollection.cs
示例4: PerformLayout
public virtual void PerformLayout(IArrangedElement container, string propertyName)
{
if (this.suspendCount <= 0)
{
this.OnLayout(new LayoutEventArgs(container, propertyName));
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ArrangedElement.cs
示例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;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:ArrangedElementCollection.cs
示例6: EnsureOwnership
internal void EnsureOwnership(IArrangedElement owner)
{
this._owner = owner;
for (int i = 0; i < this.Count; i++)
{
this[i].Owner = owner;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:TableLayoutStyleCollection.cs
示例7: GetAutoSizeMode
internal static AutoSizeMode GetAutoSizeMode(IArrangedElement element)
{
if (GetLayoutState(element)[_autoSizeModeSection] != 0)
{
return AutoSizeMode.GrowAndShrink;
}
return AutoSizeMode.GrowOnly;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:CommonProperties.cs
示例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);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:FlowLayout.cs
示例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();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:LayoutTransaction.cs
示例10: GetMargin
internal static Padding GetMargin(IArrangedElement element)
{
bool flag;
Padding padding = element.Properties.GetPadding(_marginProperty, out flag);
if (flag)
{
return padding;
}
return DefaultMargin;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:CommonProperties.cs
示例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;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:CommonProperties.cs
示例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);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:FlowLayout.cs
示例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);
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:LayoutTransaction.cs
示例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);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:14,代码来源:LayoutTransaction.cs
示例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);
}
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:15,代码来源:FlowLayout.cs
示例16: LayoutTransaction
public LayoutTransaction(Control controlToLayout, IArrangedElement controlCausingLayout, string property, bool resumeLayout)
{
CommonProperties.xClearPreferredSizeCache(controlCausingLayout);
this._controlToLayout = controlToLayout;
this._resumeLayout = resumeLayout;
if (this._controlToLayout != null)
{
this._controlToLayout.SuspendLayout();
CommonProperties.xClearPreferredSizeCache(this._controlToLayout);
if (resumeLayout)
{
this._controlToLayout.PerformLayout(new LayoutEventArgs(controlCausingLayout, property));
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:LayoutTransaction.cs
示例17: LayoutCore
// Entry point from LayoutEngine
internal override bool LayoutCore(IArrangedElement container, LayoutEventArgs args) {
#if DEBUG
if (CompModSwitches.FlowLayout.TraceInfo) {
Debug.WriteLine("FlowLayout::Layout("
+ "container=" + container.ToString() + ", "
+ "displayRect=" + container.DisplayRectangle.ToString() + ", "
+ "args=" + args.ToString() + ")");
}
Debug.Indent();
#endif
// ScrollableControl will first try to get the layoutbounds from the derived control when
// trying to figure out if ScrollBars should be added.
// VSWhidbey #392913
CommonProperties.SetLayoutBounds(container, xLayout(container, container.DisplayRectangle, /* measureOnly = */ false));
#if DEBUG
Debug.Unindent();
#endif
return CommonProperties.GetAutoSize(container);
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:21,代码来源:FlowLayout.cs
示例18: LayoutAutoSizedControls
// Loop through the AutoSized controls and expand them if they are smaller than
// their preferred size. If expanding the controls causes overlap, bump the overlapped
// control if it is AutoRelocatable.
private static void LayoutAutoSizedControls(IArrangedElement container) {
ArrangedElementCollection children = container.Children;
for (int i = children.Count - 1; i >= 0; i--) {
IArrangedElement element = children[i];
if(CommonProperties.xGetAutoSizedAndAnchored(element)) {
Rectangle bounds = GetCachedBounds(element);
AnchorStyles anchor = GetAnchor(element);
Size proposedConstraints = LayoutUtils.MaxSize;
if ((anchor & (AnchorStyles.Left | AnchorStyles.Right)) == (AnchorStyles.Left | AnchorStyles.Right)) {
proposedConstraints.Width = bounds.Width;
}
if ((anchor & (AnchorStyles.Top | AnchorStyles.Bottom)) == (AnchorStyles.Top | AnchorStyles.Bottom)) {
proposedConstraints.Height = bounds.Height;
}
Size prefSize = element.GetPreferredSize(proposedConstraints);
Rectangle newBounds = bounds;
if (CommonProperties.GetAutoSizeMode(element) == AutoSizeMode.GrowAndShrink) {
// this is the case for simple things like radio button, checkbox, etc.
newBounds = GetGrowthBounds(element, prefSize);
}
else {
// we had whacked this check, but it turns out it causes undesirable
// behavior in things like panel. a panel with no elements sizes to 0,0.
if(bounds.Width < prefSize.Width || bounds.Height < prefSize.Height) {
Size newSize = LayoutUtils.UnionSizes(bounds.Size, prefSize);
newBounds = GetGrowthBounds(element, newSize);
}
}
if (newBounds != bounds) {
SetCachedBounds(element, newBounds);
}
}
}
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:42,代码来源:DockAndAnchorLayout.cs
示例19: ApplyCachedBounds
private static void ApplyCachedBounds(IArrangedElement container)
{
if (CommonProperties.GetAutoSize(container))
{
Rectangle displayRectangle = container.DisplayRectangle;
if ((displayRectangle.Width == 0) || (displayRectangle.Height == 0))
{
ClearCachedBounds(container);
return;
}
}
IDictionary dictionary = (IDictionary) container.Properties.GetObject(_cachedBoundsProperty);
if (dictionary != null)
{
foreach (DictionaryEntry entry in dictionary)
{
IArrangedElement key = (IArrangedElement) entry.Key;
Rectangle bounds = (Rectangle) entry.Value;
key.SetBounds(bounds, BoundsSpecified.None);
}
ClearCachedBounds(container);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:DefaultLayout.cs
示例20: GetGrowthBounds
// Gets the bounds of the element after growing to newSize (note that depending on
// anchoring the element may grow to the left/updwards rather than to the
// right/downwards. i.e., it may be translated.)
private static Rectangle GetGrowthBounds(IArrangedElement element, Size newSize) {
GrowthDirection direction = GetGrowthDirection(element);
Rectangle oldBounds = GetCachedBounds(element);
Point location = oldBounds.Location;
Debug.Assert((CommonProperties.GetAutoSizeMode(element) == AutoSizeMode.GrowAndShrink || newSize.Height >= oldBounds.Height && newSize.Width >= oldBounds.Width),
"newSize expected to be >= current size.");
if((direction & GrowthDirection.Left) != GrowthDirection.None) {
// We are growing towards the left, translate X
location.X -= newSize.Width - oldBounds.Width;
}
if((direction & GrowthDirection.Upward) != GrowthDirection.None) {
// We are growing towards the top, translate Y
location.Y -= newSize.Height - oldBounds.Height;
}
Rectangle newBounds = new Rectangle(location, newSize);
Debug.Assert((CommonProperties.GetAutoSizeMode(element) == AutoSizeMode.GrowAndShrink || newBounds.Contains(oldBounds)), "How did we resize in such a way we no longer contain our old bounds?");
return newBounds;
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:27,代码来源:DockAndAnchorLayout.cs
注:本文中的IArrangedElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论