本文整理汇总了C#中System.Windows.Controls.Canvas.SizeTo方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.SizeTo方法的具体用法?C# Canvas.SizeTo怎么用?C# Canvas.SizeTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Canvas
的用法示例。
在下文中一共展示了Canvas.SizeTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OrcasAvalonApplicationCanvas
//.........这里部分代码省略.........
))
{
InfoOverlayShadowOpacity.Opacity = 0.8;
InfoOverlayText.Text = "You won!\n\n:)";
ResetOverlay.AttachTo(TouchOverlay);
if (AtWin != null)
AtWin();
return;
}
t.TouchOverlay.Hide();
100.AtDelay(
delegate
{
AI();
t.TouchOverlay.Show();
if (Tiles.Any(
k =>
{
if (k.Value != -1)
return false;
return k.IsUnderAttack(-1, 4);
}
))
{
InfoOverlayShadowOpacity.Opacity = 0.8;
InfoOverlayText.Text = "You lost!\n\n:(";
ResetOverlay.AttachTo(TouchOverlay);
if (AtLoss != null)
AtLoss();
return;
}
}
);
};
};
var TileContainer = new Canvas().AttachTo(this);
#region build board
for (int x = 0; x < Intersections; x++)
for (int y = 0; y < Intersections; y++)
{
var t = new Tile(x, y);
t.Container.AttachTo(TileContainer);
t.TouchOverlay.AttachTo(TouchOverlay);
Tiles[x + y * Intersections] = t;
Tiles_WithEvents(t);
}
#endregion
#region add logo
var img = new com.abstractatech.gomoku.Avalon.Images.jsc
{
}.MoveTo(DefaultWidth - 96, DefaultHeight - 96).AttachTo(TileContainer);
#endregion
ResetOverlay.AttachTo(TouchOverlay);
InfoOverlay.AttachTo(this);
TouchOverlay.AttachTo(this);
this.SizeChanged +=
delegate
{
TileContainer.MoveTo(
(this.Width - DefaultWidth) /2,
(this.Height - DefaultHeight) /2
);
TouchOverlay.MoveTo(
(this.Width - DefaultWidth) / 2,
(this.Height - DefaultHeight) / 2
);
ResetOverlay.SizeTo(this.Width, this.Height);
InfoOverlay.SizeTo(this.Width, this.Height);
InfoOverlayShadow.SizeTo(this.Width, this.Height);
//TouchOverlay.SizeTo(this.Width, this.Height);
InfoOverlayText.MoveTo(0, (this.Height - 180) / 2);
InfoOverlayText.SizeTo(this.Width, 180);
};
}
示例2: CreateWindow
public void CreateWindow(Position WindowLocation, Action<WindowInfo> Yield = null)
{
var GlassArea = new Canvas();
GlassArea.AttachTo(this);
GlassArea.MoveTo(WindowLocation.Left, WindowLocation.Top);
GlassArea.SizeTo(WindowLocation.Width, WindowLocation.Height);
GlassArea.ClipToBounds = true;
for (int i = 0; i < WindowLocation.Width; i += 456)
for (int j = 0; j < WindowLocation.Height; j += 696)
{
var i2 = new Avalon.Images.s_bg().SizeTo(456, 696);
i2.MoveTo(i, j);
i2.Opacity = 0.8;
i2.AttachTo(GlassArea);
}
var GlassOpacity = GlassArea.ToAnimatedOpacity();
GlassOpacity.Opacity = 1;
var w = new WindowInfo { GlassArea = GlassArea, GlassOpacity = GlassOpacity, WindowLocation = WindowLocation };
var Left = new Avalon.Images.s_l
{
Stretch = Stretch.Fill
}
.AttachTo(this);
var Top = new Avalon.Images.s_t
{
Stretch = Stretch.Fill
}
.AttachTo(this);
var Right = new Avalon.Images.s_r
{
Stretch = Stretch.Fill
}.AttachTo(this);
var Bottom = new Avalon.Images.s_b
{
Stretch = Stretch.Fill
}
.AttachTo(this);
var TopLeft = new Avalon.Images.s_tl
{
Stretch = Stretch.Fill
}
.AttachTo(this);
var BottomRight = new Avalon.Images.s_br
{
Stretch = Stretch.Fill
}
.AttachTo(this);
var TopRight = new Avalon.Images.s_tr
{
Stretch = Stretch.Fill
}
.AttachTo(this);
var BottomLeft = new Avalon.Images.s_bl
{
Stretch = Stretch.Fill
}
.AttachTo(this);
w.WindowLocationChanged +=
delegate
{
Left.MoveTo(WindowLocation.Left - 16, WindowLocation.Top + 6)
.SizeTo(16, WindowLocation.Height - 6 - 4);
Top.MoveTo(WindowLocation.Left + 6, WindowLocation.Top - 16)
.SizeTo(WindowLocation.Width - 6 - 4, 22);
Right.MoveTo(WindowLocation.Left + WindowLocation.Width, WindowLocation.Top + 6)
.SizeTo(20, WindowLocation.Height - 4 - 6);
Bottom.MoveTo(WindowLocation.Left + 5, WindowLocation.Top + WindowLocation.Height)
//.........这里部分代码省略.........
示例3: XInitialize
//.........这里部分代码省略.........
Background = Brushes.Black
}.AttachTo(this);
var bg_black_opacity = bg_black.ToAnimatedOpacity();
bg_black_opacity.Opacity = 0;
var w = new JSCSolutionsNETWhiteCarouselCanvas();
w.CloseOnClick = false;
w.Container.AttachTo(bg_black);
bool OtherView = false;
//new { b.step }.With(
// x =>
// {
// var counter = 0;
// (1000 / 60).AtIntervalWithTimer(
// speedboost =>
// {
// counter++;
// b.step = x.step * (1 + counter * 0.1);
// if (counter == 60 * 2)
// speedboost.Stop();
// }
// );
// }
//);
Action ChooseView =
delegate
{
//V:\web\AvalonBrowserLogos\ApplicationCanvas___c__DisplayClass5.as(35): col: 36 Error: Implicit coercion of a value of type Boolean to an unrelated type Number.
// if (!(((this.__4__this.Width > this.__4__this.Height) ^ this.OtherView) == 0))
// ^
//V:\web\AvalonBrowserLogos\ApplicationCanvas___c__DisplayClass5.as(35): col: 74 Error: Implicit coercion of a value of type Boolean to an unrelated type Number.
// if (!(((this.__4__this.Width > this.__4__this.Height) ^ this.OtherView) == 0))
// ^
// X:\jsc.svn\examples\actionscript\Test\TestBooleanXor\TestBooleanXor\Class1.cs
// actionscript thinks this operator results in int?
//var flag = (Width > Height) ^ OtherView;
var flag = (Width > Height);
if (OtherView)
flag = !flag;
if (flag)
bg_black_opacity.Opacity = 0;
else
bg_black_opacity.Opacity = 1;
};
w.AtLogoClick +=
delegate
{
OtherView = !OtherView;
ChooseView();
};
b.AtLogoClick +=
delegate
{
OtherView = !OtherView;
ChooseView();
};
this.SizeChanged += (s, e) =>
{
ChooseView();
w.Container.MoveTo(
(this.Width - 400) / 2, (this.Height - 400) / 2
);
b.Container.MoveTo(
(this.Width - 400) / 2, (this.Height - 400) / 2
);
bg_black.SizeTo(this.Width, this.Height);
};
}
示例4: ApplicationCanvas
public ApplicationCanvas()
{
var c = new CheckBox
{
Content = new TextBlock { Text = "Print to Console " }
}.MoveTo(8, 96);
var t = new TextBlock { Text = "?" }.AttachTo(this);
var redblockcontainer = new Canvas();
redblockcontainer.Opacity = 0.8;
redblockcontainer.Background = Brushes.Red;
redblockcontainer.AttachTo(this);
redblockcontainer.MoveTo(8, 8);
this.SizeChanged += (s, e) => redblockcontainer.MoveTo(64 - 16, this.Height / 3 - 16).SizeTo(this.Width - 96, this.Height / 3 - 8);
var redblockoverlay = new Canvas();
redblockoverlay.Opacity = 0.1;
redblockoverlay.Background = Brushes.Red;
redblockoverlay.AttachTo(this);
redblockoverlay.MoveTo(8, 8);
this.SizeChanged += (s, e) => redblockoverlay.MoveTo(64 + 64, this.Height / 3).SizeTo(this.Width - 96 - 64, this.Height / 3 - 8);
var yellowblock = new Canvas();
yellowblock.Opacity = 0.7;
yellowblock.Background = Brushes.Yellow;
yellowblock.AttachTo(this);
yellowblock.SizeTo(400, 200);
var a_case1 = Enumerable.Range(0, 64).Select(
i =>
{
var rr = new Rectangle();
rr.Fill = Brushes.Blue;
rr.AttachTo(yellowblock);
rr.SizeTo(32, 32);
rr.MoveTo(-32, -32);
return rr;
}
).ToArray();
var a_case2 = Enumerable.Range(0, 64).Select(
i =>
{
var rr = new Rectangle();
rr.Fill = Brushes.Green;
rr.AttachTo(this);
rr.SizeTo(32, 32);
rr.MoveTo(-32, -32);
return rr;
}
).ToArray();
var greenblock = new Canvas();
greenblock.Opacity = 0.5;
greenblock.Background = Brushes.Green;
greenblock.AttachTo(this);
greenblock.SizeTo(400, 200);
greenblock.MoveTo(200 - 12, 12);
var a_case3 = Enumerable.Range(0, 64).Select(
i =>
{
var rr = new Rectangle();
rr.Fill = Brushes.Black;
rr.AttachTo(redblockcontainer);
rr.SizeTo(32, 32);
rr.MoveTo(-32, -32);
return rr;
}
).ToArray();
var case1 = yellowblock;
var case2 = greenblock;
var case3 = redblockoverlay;
#region case1
case1.TouchDown +=
(s, e) =>
{
e.Handled = true;
// is called implicitly on Android Chrome
e.TouchDevice.Capture(case1);
Console.WriteLine("TouchDown");
};
case1.MouseMove +=
(s, e) =>
{
// case 1
var p = e.GetPosition(case1);
//.........这里部分代码省略.........