本文整理汇总了C#中Frame.GetPaddedRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Frame.GetPaddedRectangle方法的具体用法?C# Frame.GetPaddedRectangle怎么用?C# Frame.GetPaddedRectangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frame
的用法示例。
在下文中一共展示了Frame.GetPaddedRectangle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunLayout
/// <summary>
///
/// </summary>
/// <param name="targetFrame"></param>
/// <param name="forceTransitions"></param>
public override void RunLayout( Frame targetFrame, bool forceTransitions = false )
{
int offset = Offset;
var gp = targetFrame.GetPaddedRectangle(false);
foreach ( var child in targetFrame.Children ) {
child.X = gp.X;
child.Y = gp.Y + offset;
offset += child.Height;
offset += Interval;
}
}
示例2: RunLayout
/// <summary>
///
/// </summary>
/// <param name="targetFrame"></param>
public override void RunLayout( Frame targetFrame, bool forceTransitions = false )
{
var gp = targetFrame.GetPaddedRectangle();
int w1 = ( gp.Width - gapW ) / 2;
int h1 = ( gp.Height - gapH ) / 2;
int w2 = w1 + ( MathUtil.IsOdd( gp.Width - gapW ) ? 1 : 0 );
int h2 = h1 + ( MathUtil.IsOdd( gp.Height - gapH ) ? 1 : 0 );
bool useTransitions = !forceTransitions & UseTransitions;
//targetFrame.ForEachChildren( f => f.Visible = false );
if ( LayoutStyle==QuadLayoutStyle.SinglePanel ) {
MoveAndResizeLogical( targetFrame, useTransitions, 0, 0, 0, 2, 2 );
HideFrame( targetFrame, useTransitions, 1 );
HideFrame( targetFrame, useTransitions, 2 );
HideFrame( targetFrame, useTransitions, 3 );
return;
}
if ( LayoutStyle==QuadLayoutStyle.TwoPanelsSideBySide ) {
MoveAndResizeLogical( targetFrame, useTransitions, 0, 0, 0, 1, 2 );
MoveAndResizeLogical( targetFrame, useTransitions, 1, 1, 0, 1, 2 );
HideFrame( targetFrame, useTransitions, 2 );
HideFrame( targetFrame, useTransitions, 3 );
return;
}
if ( LayoutStyle==QuadLayoutStyle.TwoPanelsStacked ) {
MoveAndResizeLogical( targetFrame, useTransitions, 0, 0, 0, 2, 1 );
MoveAndResizeLogical( targetFrame, useTransitions, 1, 0, 1, 2, 1 );
HideFrame( targetFrame, useTransitions, 2 );
HideFrame( targetFrame, useTransitions, 3 );
return;
}
if ( LayoutStyle==QuadLayoutStyle.ThreePanelsSplitLeft ) {
MoveAndResizeLogical( targetFrame, useTransitions, 0, 0, 0, 1, 1 );
MoveAndResizeLogical( targetFrame, useTransitions, 1, 0, 1, 1, 1 );
MoveAndResizeLogical( targetFrame, useTransitions, 2, 1, 0, 1, 2 );
HideFrame( targetFrame, useTransitions, 3 );
return;
}
if ( LayoutStyle==QuadLayoutStyle.ThreePanelsSplitRight ) {
MoveAndResizeLogical( targetFrame, useTransitions, 0, 0, 0, 1, 2 );
MoveAndResizeLogical( targetFrame, useTransitions, 1, 1, 0, 1, 1 );
MoveAndResizeLogical( targetFrame, useTransitions, 2, 1, 1, 1, 1 );
HideFrame( targetFrame, useTransitions, 3 );
return;
}
if ( LayoutStyle==QuadLayoutStyle.ThreePanelsSplitTop ) {
MoveAndResizeLogical( targetFrame, useTransitions, 0, 0, 0, 1, 1 );
MoveAndResizeLogical( targetFrame, useTransitions, 1, 1, 0, 1, 1 );
MoveAndResizeLogical( targetFrame, useTransitions, 2, 0, 1, 2, 1 );
HideFrame( targetFrame, useTransitions, 3 );
return;
}
if ( LayoutStyle==QuadLayoutStyle.ThreePanelsSplitBottom ) {
MoveAndResizeLogical( targetFrame, useTransitions, 0, 0, 0, 2, 1 );
MoveAndResizeLogical( targetFrame, useTransitions, 1, 0, 1, 1, 1 );
MoveAndResizeLogical( targetFrame, useTransitions, 2, 1, 1, 1, 1 );
HideFrame( targetFrame, useTransitions, 3 );
return;
}
if ( LayoutStyle==QuadLayoutStyle.FourPanels ) {
MoveAndResizeLogical( targetFrame, useTransitions, 0, 0, 0, 1, 1 );
MoveAndResizeLogical( targetFrame, useTransitions, 1, 0, 1, 1, 1 );
MoveAndResizeLogical( targetFrame, useTransitions, 2, 1, 0, 1, 1 );
MoveAndResizeLogical( targetFrame, useTransitions, 3, 1, 1, 1, 1 );
return;
}
}
示例3: MoveAndResizeLogical
/// <summary>
///
/// </summary>
/// <param name="targetFrame"></param>
/// <param name="childIndex"></param>
/// <param name="logicalX"></param>
/// <param name="logicalY"></param>
/// <param name="logicalWidth"></param>
/// <param name="logicalHeight"></param>
void MoveAndResizeLogical( Frame targetFrame, bool useTransitions, int childIndex, int logicalX, int logicalY, int logicalWidth, int logicalHeight )
{
int offsetX = 0;
int offsetY = 0;
if ( LayoutStyle==QuadLayoutStyle.ThreePanelsSplitRight) {
offsetX = (int)((targetFrame.Width - gapW)/2 * 0.2f);
offsetY = (int)((targetFrame.Width - gapW)/2 * 0.1f);
}
if (logicalWidth==2) offsetX = 0;
if (logicalHeight==2) offsetY = 0;
var gp = targetFrame.GetPaddedRectangle(false);
int w1 = ( gp.Width - gapW ) / 2;
int h1 = ( gp.Height - gapH ) / 2;
int x = gp.X + logicalX * ( w1 + gapW ) + ( offsetX * ((logicalX==0) ? 0 : 1) );
int y = gp.Y + logicalY * ( h1 + gapH ) + ( offsetY * ((logicalY==0) ? 0 : 1) );
int w = w1 * logicalWidth + gapW * (logicalWidth - 1) + ( offsetX * ((logicalX==0) ? 1 : -1) );
int h = h1 * logicalHeight + gapH * (logicalHeight - 1) + ( offsetY * ((logicalY==0) ? 1 : -1) );
MoveAndResize( targetFrame, useTransitions, childIndex, x, y, w, h );
}
示例4: HideFrame
/// <summary>
///
/// </summary>
/// <param name="targetFrame"></param>
/// <param name="useTransitions"></param>
/// <param name="childIndex"></param>
void HideFrame( Frame targetFrame, bool useTransitions, int childIndex )
{
var child = targetFrame.Children.ElementAtOrDefault( childIndex );
if (child==null) {
return;
}
var color = new Color(255,255,255,0);
var gp = targetFrame.GetPaddedRectangle(false);
int w = ( gp.Width - gapW ) / 2;
int h = ( gp.Height - gapH ) / 2;
int x = w / 2;
int y = h / 2;
if (useTransitions) {
child.RunTransition("OverallColor", color, 0*(childIndex+1) * TransitionDelay, TransitionPeriod );
//child.RunTransition("X", x, 0*(childIndex+1) * TransitionDelay, TransitionPeriod );
//child.RunTransition("Y", y, 0*(childIndex+1) * TransitionDelay, TransitionPeriod );
//child.RunTransition("Width", w, 0*(childIndex+1) * TransitionDelay, TransitionPeriod );
//child.RunTransition("Height", h, 0*(childIndex+1) * TransitionDelay, TransitionPeriod );
} else {
child.OverallColor = color;
//child.X = x;
//child.Y = y;
//child.Width = w;
//child.Height = h;
}
}