本文整理汇总了C#中System.Windows.Media.ScaleTransform类的典型用法代码示例。如果您正苦于以下问题:C# ScaleTransform类的具体用法?C# ScaleTransform怎么用?C# ScaleTransform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScaleTransform类属于System.Windows.Media命名空间,在下文中一共展示了ScaleTransform类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateSubMagic
void CreateSubMagic(RoleBase caster, Space space, MagicArgs args, int index)
{
AnimationBase animation = new AnimationBase() { Code = args.ResCode, Z = targets[index].Z + 1, Effect = shiftHue };
double offsetStartY = (caster.State == States.Riding ? (caster.Profession == Professions.Taoist ? 130 : 110) : 60) * caster.Scale;
double offsetEndY = (targets[index].State == States.Riding ? 100 : 50) * caster.Scale;
Point from = index == 0 ? new Point(args.Position.X, args.Position.Y - offsetStartY) : temp;
Point to = new Point(targets[index].Position.X, targets[index].Position.Y - offsetEndY);
temp = to;
RotateTransform rotateTransform = new RotateTransform() {
CenterX = animation.Center.X,
CenterY = animation.Center.Y,
Angle = GlobalMethod.GetAngle(to.Y - from.Y, to.X - from.X)
};
ScaleTransform scaleTransform = new ScaleTransform() {
CenterX = animation.Center.X,
CenterY = animation.Center.Y,
ScaleX = (GlobalMethod.GetDistance(index == 0 ? args.Position : targets[index - 1].Position, targets[index].Position) / 440), //440为其实体宽度,这里用了硬编码
ScaleY = caster.Scale
};
TransformGroup transformGroup = new TransformGroup();
transformGroup.Children.Add(scaleTransform);
transformGroup.Children.Add(rotateTransform);
animation.RenderTransform = transformGroup;
animation.Position = from;
space.AddUIElement(animation);
EventHandler handler = null;
animation.End += handler = delegate {
animation.End -= handler;
space.RemoveAnimation(animation);
if (index == targets.Count) { targets.Clear(); }
};
animation.HeartStart();
}
开发者ID:Gallardot,项目名称:GallardotStorage,代码行数:33,代码来源:ContinuousMagic.cs
示例2: Wall
public Wall(Canvas container, Point position, double width, double height) {
this.container = container;
this.position = position;
this.width = width;
this.height = height;
this.image = new ImageBrush();
Debug.WriteLine("IMG width: " + imageSource.PixelWidth + ", height: " + imageSource.PixelHeight);
this.image.ImageSource = imageSource;
this.image.Stretch = Stretch.None;
transform = new TranslateTransform();
transform.X = -this.position.X;
transform.Y = -this.position.Y;
st = new ScaleTransform();
st.ScaleX = 1.55;
st.ScaleY = 2;
this.image.RelativeTransform = st;
this.image.Transform = transform;
this.imageContainer = new Canvas();
this.imageContainer.Width = width;
this.imageContainer.Height = height;
this.imageContainer.Background = this.image;
this.container.Children.Add(this.imageContainer);
Canvas.SetLeft(this.imageContainer, this.position.X);
Canvas.SetTop(this.imageContainer, this.position.Y);
Canvas.SetZIndex(this.imageContainer, 2);
}
开发者ID:serioja90,项目名称:labirynth,代码行数:26,代码来源:Wall.cs
示例3: Page_SizeChanged
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
{
// Compare the current window to the ideal dimensions.
double heightRatio = this.ActualHeight / idealPageSize.Height;
double widthRatio = this.ActualWidth / idealPageSize.Width;
// Create the transform.
ScaleTransform scale = new ScaleTransform();
// Determine the smallest dimension.
// This preserves the aspect ratio.
if (heightRatio < widthRatio)
{
scale.ScaleX = heightRatio;
scale.ScaleY = heightRatio;
}
else
{
scale.ScaleX = widthRatio;
scale.ScaleY = widthRatio;
}
// Apply the transform.
this.RenderTransform = scale;
}
开发者ID:lengocluyen,项目名称:pesproject,代码行数:25,代码来源:MainPage.xaml.cs
示例4: CreateSubMagic
void CreateSubMagic(RoleBase caster,RoleBase startTarget, RoleBase endTarget, Space space, MagicArgs args)
{
AnimationBase animation = new AnimationBase() { Code = args.ResCode, Z = startTarget.Z + 1 };
double offsetStartY = (startTarget.State == States.Riding ? (startTarget.Profession == Professions.Taoist ? 130 : 110) : 60) * args.Scale;
double offsetEndY = (endTarget.State == States.Riding ? 100 : 50) * args.Scale;
Point from = new Point(startTarget.Position.X, startTarget.Position.Y - offsetStartY);
Point to = new Point(endTarget.Position.X, endTarget.Position.Y - offsetEndY);
RotateTransform rotateTransform = new RotateTransform() {
CenterX = animation.Center.X,
CenterY = animation.Center.Y,
Angle = GlobalMethod.GetAngle(to.Y - from.Y, to.X - from.X)
};
ScaleTransform scaleTransform = new ScaleTransform() {
CenterX = animation.Center.X,
CenterY = animation.Center.Y,
ScaleX = (GlobalMethod.GetDistance(startTarget.Position, endTarget.Position) / Convert.ToInt32(args.Tag)),
ScaleY = args.Scale
};
TransformGroup transformGroup = new TransformGroup();
transformGroup.Children.Add(scaleTransform);
transformGroup.Children.Add(rotateTransform);
animation.RenderTransform = transformGroup;
animation.Position = from;
space.AddUIElement(animation);
EventHandler handler = null;
animation.End += handler = delegate {
animation.End -= handler;
space.RemoveAnimation(animation);
};
animation.HeartStart();
}
开发者ID:Gallardot,项目名称:GallardotStorage,代码行数:31,代码来源:RadiateMagic.cs
示例5: Initialize
public void Initialize(UIElement element)
{
this.child = element;
if (child != null)
{
TransformGroup group = new TransformGroup();
ScaleTransform st = new ScaleTransform();
group.Children.Add(st);
TranslateTransform tt = new TranslateTransform();
group.Children.Add(tt);
child.RenderTransform = group;
child.RenderTransformOrigin = new Point(0.0, 0.0);
child.MouseWheel += child_MouseWheel;
child.MouseLeftButtonDown += child_MouseLeftButtonDown;
child.MouseLeftButtonUp += child_MouseLeftButtonUp;
child.MouseMove += child_MouseMove;
child.PreviewMouseRightButtonDown += new MouseButtonEventHandler(child_PreviewMouseRightButtonDown);
}
}
开发者ID:Slowhobo,项目名称:path-of-exile-skilltree-planer,代码行数:25,代码来源:ZoomBorder.cs
示例6: Sprite
public Sprite(FrameworkElement content)
{
Content = content;
Width = (float)content.Width;
Height = (float)content.Height;
TranslateTransform = new TranslateTransform();
TranslateTransform.X = 0;
TranslateTransform.Y = 0;
RotateTransform = new RotateTransform();
RotateTransform.CenterX = Origin.X;
RotateTransform.CenterY = Origin.Y;
RotateTransform.Angle = 0;
ScaleTransform = new ScaleTransform();
ScaleTransform.ScaleX = 1;
ScaleTransform.ScaleY = 1;
_transformGroup = new TransformGroup();
_transformGroup.Children.Add(RotateTransform);
_transformGroup.Children.Add(TranslateTransform);
_transformGroup.Children.Add(ScaleTransform);
RenderTransform = _transformGroup;
}
开发者ID:rbrother,项目名称:seikkailulaakso,代码行数:25,代码来源:Sprite.cs
示例7: SkalerNed
private void SkalerNed(object sender, RoutedEventArgs e)
{
scaleX -= 0.20;
scaleY -= 0.20;
Transform tf = new ScaleTransform(scaleX, scaleY);
stPnlMain.LayoutTransform = tf;
}
开发者ID:KasperFlye,项目名称:CsharpAndDotNet,代码行数:7,代码来源:MainWindow.xaml.cs
示例8: setWindowSize
//Changes the window size to make the content authoring tool fit in any size of screen
public void setWindowSize()
{
Double width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
Double height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
Double ratio = height / width;
ScaleTransform tran = new ScaleTransform();
if (width < 1024 || height < 850)
{
if (width / 1024 > height / 800)
{
this.Height = height - 60;
this.Width = this.Height / 800 * 1024;
tran.ScaleY = this.Height / 800;
tran.ScaleX = this.Width / 1024;
}
else
{
this.Width = width - 60;
this.Height = this.Width / 1024 * 800;
tran.ScaleX = this.Width / 1024;
tran.ScaleY = this.Height / 800;
}
mainCanvas.RenderTransform = tran;
}
}
开发者ID:huylu,项目名称:brownuniversitylads,代码行数:31,代码来源:AddImageWindow.xaml.cs
示例9: MainWindow
public MainWindow()
{
view = new ViewParams();
InitializeComponent();
scale = new ScaleTransform(1, 1, 0, 0);
pan = new TranslateTransform(0, plot.Height);
signals = new SignalCollection(this);
signals.scaleSignalStrokes(scale);
signals.updateLabels();
resetTransform();
ports = SerialPort.GetPortNames();
Console.WriteLine("ports:");
foreach(string port in ports){
comportList.Items.Add(port.ToString());
Console.WriteLine(port);
}
arduinoPort = new SerialPort();
arduinoPort.Parity = Parity.None;
arduinoPort.StopBits = StopBits.One;
arduinoPort.DataBits = 8;
arduinoPort.BaudRate = 9600;
arduinoPort.ReadTimeout = 200;
if (comportList.Items.Count > 0)
{
arduinoPort.PortName = comportList.Items[0].ToString();
}
else
{
Console.WriteLine("No ports available");
connectButton.IsEnabled = false;
}
}
开发者ID:DiLRandI,项目名称:ArduinoMonitor,代码行数:35,代码来源:MainWindow.xaml.cs
示例10: FilterCellFactory
static FilterCellFactory()
{
_bmpActiveFilter = LoadImage(".ActiveFilter.png");
_bmpInactiveFilter = LoadImage(".InactiveFilter.png");
_sortGlyphTransform = new ScaleTransform();
_sortGlyphTransform.ScaleY = 0.7;
}
开发者ID:mdjabirov,项目名称:C1Decompiled,代码行数:7,代码来源:FilterCellFactory.cs
示例11: CreateTransitionAnimation
/// <internalonly />
protected override ProceduralAnimation CreateTransitionAnimation(Panel container, EffectDirection direction)
{
if (_scaleTransform == null) {
_scaleTransform = new ScaleTransform();
container.RenderTransform = _scaleTransform;
container.RenderTransformOrigin = new Point(0.5, 0.5);
}
TweenInterpolation interpolation = GetEffectiveInterpolation();
TimeSpan shortDuration = TimeSpan.FromMilliseconds(Duration.TotalMilliseconds / 3);
FlipScaleAnimation scaleAnimation =
new FlipScaleAnimation(Duration, _scaleTransform,
(direction == EffectDirection.Forward ? 180 : -180));
scaleAnimation.Interpolation = interpolation;
DoubleAnimation frontAnimation =
new DoubleAnimation(container.Children[1], UIElement.OpacityProperty, shortDuration,
(direction == EffectDirection.Forward ? 0 : 1));
frontAnimation.Interpolation = interpolation;
frontAnimation.StartDelay = shortDuration;
DoubleAnimation backAnimation =
new DoubleAnimation(container.Children[0], UIElement.OpacityProperty, shortDuration,
(direction == EffectDirection.Forward ? 1 : 0));
backAnimation.Interpolation = interpolation;
backAnimation.StartDelay = shortDuration;
return new ProceduralAnimationSet(scaleAnimation, frontAnimation, backAnimation);
}
开发者ID:ssssyin,项目名称:silverlightfx,代码行数:32,代码来源:Flip.cs
示例12: loadBubbles
private void loadBubbles()
{
PART_bubbles.Children.Clear();
var animationSkew = 0;
foreach (var theme in themeSource)
{
var scaleTransfrom = new ScaleTransform(0, 0, .5, .5);
var bubbles = new Ellipse
{
Width = 50,
Height = 50,
Tag = theme,
Fill = theme.P500,
Effect = MaterialPalette.Shadows.ShadowDelta2,
RenderTransformOrigin = new Point(.5, .5),
RenderTransform = scaleTransfrom
};
bubbles.MouseUp += bubbleClicked;
PART_bubbles.Children.Add(bubbles);
scaleTransfrom.animate(ScaleTransform.ScaleXProperty, 400, 1, animationSkew, new BackEase
{ EasingMode = EasingMode.EaseOut, Amplitude = .6 });
scaleTransfrom.animate(ScaleTransform.ScaleYProperty, 400, 1, animationSkew, new BackEase
{ EasingMode = EasingMode.EaseOut, Amplitude = .6 });
animationSkew += 10;
//new SineEase {EasingMode = EasingMode.EaseIn});
//scaleTransfrom.BeginAnimation(ScaleTransform.ScaleXProperty, new DoubleAnimation())
}
}
开发者ID:JackWangCUMT,项目名称:FlexCharts,代码行数:29,代码来源:SelectThemePopup.xaml.cs
示例13: GetTransformFromChild
private static ScaleTransform GetTransformFromChild(UIElement child)
{
ScaleTransform scaleTransform = null;
if (child.RenderTransform == null || child.RenderTransform == MatrixTransform.Identity)
{
scaleTransform = new ScaleTransform();
child.RenderTransform = scaleTransform;
}
else
{
if (child.RenderTransform is ScaleTransform)
{
scaleTransform = child.RenderTransform as ScaleTransform;
}
else if (child.RenderTransform is TransformGroup)
{
foreach (Transform transfrom in (child.RenderTransform as TransformGroup).Children)
{
if (transfrom is ScaleTransform)
{
scaleTransform = transfrom as ScaleTransform;
break;
}
}
}
else
{
throw new InvalidOperationException();
}
}
return scaleTransform;
}
开发者ID:nankezhishi,项目名称:ClearMine,代码行数:33,代码来源:AutoTransformPanel.cs
示例14: ParkHotelExplorer
public static void ParkHotelExplorer(bool restore, double width, Canvas canvas, double top, double left, double scale, double rotate)
{
_canvas = canvas;
var hotelExplorer = HotelExplorer.GetInstance();
hotelExplorer.IsFloating = !restore;
hotelExplorer.HightLight(!restore);
var ypos = restore ? top : Canvas.GetTop(hotelExplorer);
var xpos = restore ? width - left - (hotelExplorer.ActualWidth * scale) : Canvas.GetLeft(hotelExplorer);
var yTo = restore ? 55 : top;
var xTo = restore ? 55 : width - left - (hotelExplorer.ActualWidth / scale);
var zoomFrom = restore ? scale : 1;
var zoomTo = restore ? 1 : scale;
var rotateFrom = restore ? rotate : 0;
var rotateTo = restore ? 0 : rotate;
var yAnimation = new DoubleAnimation
{
From = ypos,
To = yTo,
Duration = new Duration(TimeSpan.FromMilliseconds(500))
};
var xAnimation = new DoubleAnimation
{
From = xpos,
To = xTo,
Duration = new Duration(TimeSpan.FromMilliseconds(1000))
};
hotelExplorer.BeginAnimation(Canvas.TopProperty, yAnimation);
hotelExplorer.BeginAnimation(Canvas.LeftProperty, xAnimation);
var zoom = new DoubleAnimation
{
From = zoomFrom,
To = zoomTo,
BeginTime = TimeSpan.FromMilliseconds(0),
Duration = new Duration(TimeSpan.FromMilliseconds(1000))
};
var rotateAnimation = new DoubleAnimation
{
From = rotateFrom,
To = rotateTo,
BeginTime = TimeSpan.FromMilliseconds(0),
Duration = new Duration(TimeSpan.FromMilliseconds(1000))
};
zoom.Completed += HotelZoomCompleted;
var st = new ScaleTransform();
var rt = new RotateTransform(rotateTo, 0, 0);
var group = new TransformGroup();
group.Children.Add(st);
group.Children.Add(rt);
hotelExplorer.Container.WorkingObject.RenderTransform = group;
st.BeginAnimation(ScaleTransform.ScaleXProperty, zoom);
st.BeginAnimation(ScaleTransform.ScaleYProperty, zoom);
st.BeginAnimation(RotateTransform.AngleProperty, rotateAnimation);
}
开发者ID:realsaraf,项目名称:eConcierge,代码行数:60,代码来源:AnimationHelper.cs
示例15: MatchFinished
public void MatchFinished(bool isAccepted)
{
if (!isAccepted)
{
ColorAnimation opacityOut = new ColorAnimation(Colors.Transparent, new Duration(TimeSpan.FromSeconds(0.5)));
card1.BeginAnimation(Rectangle.FillProperty, opacityOut, HandoffBehavior.SnapshotAndReplace);
card2.BeginAnimation(Rectangle.FillProperty, opacityOut, HandoffBehavior.SnapshotAndReplace);
card3.BeginAnimation(Rectangle.FillProperty, opacityOut, HandoffBehavior.SnapshotAndReplace);
}
else
{
ScaleTransform scale = new ScaleTransform(1.0, 1.0, card1.Width / 2, card1.Height / 2);
DoubleAnimation scaleOutAnim = new DoubleAnimation(1.0, 10.0, new Duration(TimeSpan.FromSeconds(0.5)));
card1.RenderTransform = scale;
card2.RenderTransform = scale;
card3.RenderTransform = scale;
scale.BeginAnimation(ScaleTransform.ScaleXProperty, scaleOutAnim, HandoffBehavior.SnapshotAndReplace);
scale.BeginAnimation(ScaleTransform.ScaleYProperty, scaleOutAnim, HandoffBehavior.SnapshotAndReplace);
scaleOutAnim.Completed += new EventHandler(scaleOutAnim_Completed);
DoubleAnimation opacityOutAnim = new DoubleAnimation(1.0, 0.0, new Duration(TimeSpan.FromSeconds(0.5)));
card1.BeginAnimation(Rectangle.OpacityProperty, opacityOutAnim, HandoffBehavior.SnapshotAndReplace);
card2.BeginAnimation(Rectangle.OpacityProperty, opacityOutAnim, HandoffBehavior.SnapshotAndReplace);
card3.BeginAnimation(Rectangle.OpacityProperty, opacityOutAnim, HandoffBehavior.SnapshotAndReplace);
}
}
开发者ID:UCSD-HCI,项目名称:RiskBoardGameApp,代码行数:26,代码来源:CardHolder.xaml.cs
示例16: Manager
//Editor Ed = new Editor(Edit);
public Manager(TabControl tabs, StackPanel Background, StackPanel Edit)
{
// TODO: Complete member initialization
this.tabs = tabs;
this.Background = Background;
this.Edit = Edit;
trSkw = new SkewTransform(0, 0);
trRot = new RotateTransform(0);
trTns = new TranslateTransform(0, 0);
trScl = new ScaleTransform(1, 1);
trSkw2 = new SkewTransform(0, 0);
trRot2 = new RotateTransform(0);
trTns2 = new TranslateTransform(0, 0);
trScl2 = new ScaleTransform(1, 1);
trGrp2 = new TransformGroup();
trGrp2.Children.Add(trSkw2);
trGrp2.Children.Add(trRot2);
trGrp2.Children.Add(trTns2);
trGrp2.Children.Add(trScl2);
trGrp = new TransformGroup();
trGrp.Children.Add(trSkw);
trGrp.Children.Add(trRot);
trGrp.Children.Add(trTns);
trGrp.Children.Add(trScl);
}
开发者ID:DenysGranevych,项目名称:Development-of-welcoming-Cards,代码行数:27,代码来源:manager.cs
示例17: ScaleDown
private void ScaleDown()
{
Storyboard storyboard = new Storyboard();
ScaleTransform scaleTranform = new ScaleTransform(1.0, 1.0);
this.RenderTransformOrigin = new Point(0.5, 0.5);
this.RenderTransform = scaleTranform;
DoubleAnimation animationX = new DoubleAnimation();
animationX.Duration = TimeSpan.FromMilliseconds(HoldThreshold);
animationX.From = 1.0;
animationX.To = ScaleFactor;
storyboard.Children.Add(animationX);
Storyboard.SetTargetProperty(animationX, new PropertyPath("RenderTransform.ScaleX"));
Storyboard.SetTarget(animationX, this);
DoubleAnimation animationY = new DoubleAnimation();
animationY.Duration = TimeSpan.FromMilliseconds(HoldThreshold);
animationY.From = 1.0;
animationY.To = ScaleFactor;
storyboard.Children.Add(animationY);
Storyboard.SetTargetProperty(animationY, new PropertyPath("RenderTransform.ScaleY"));
Storyboard.SetTarget(animationY, this);
storyboard.Begin();
}
开发者ID:smalice,项目名称:SurfaceGlobus,代码行数:25,代码来源:MotionButton.cs
示例18: OnVisualChildrenChanged
protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved)
{
base.OnVisualChildrenChanged(visualAdded, visualRemoved);
if (visualAdded != null)
{
var child = (ContentPresenter)visualAdded;
if (((Card)child.DataContext).Controller != Player.LocalPlayer)
{
var scale = new ScaleTransform();
child.RenderTransformOrigin = new Point(0.5, 0.5);
child.RenderTransform = scale;
var anim = new DoubleAnimation()
{
Duration = new Duration(TimeSpan.FromMilliseconds(400)),
AutoReverse = true,
RepeatBehavior = new RepeatBehavior(2.166),
AccelerationRatio = 0.2,
DecelerationRatio = 0.7,
To = 1.2, From = 0.9,
FillBehavior = FillBehavior.Stop
};
scale.BeginAnimation(ScaleTransform.ScaleXProperty, anim);
scale.BeginAnimation(ScaleTransform.ScaleYProperty, anim);
}
}
}
开发者ID:kellyelton,项目名称:octgnwlobby,代码行数:26,代码来源:TableCanvas.cs
示例19: PanelMoveAdorner
public PanelMoveAdorner(DesignItem item)
{
this.item = item;
scaleTransform = new ScaleTransform(1.0, 1.0);
this.LayoutTransform = scaleTransform;
}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:7,代码来源:PanelMoveAdorner.cs
示例20: ImageControls
/// <summary>
/// ImageControls constructor
/// </summary>
/// <param name="uiImage">User's Image</param>
/// <param name="uiImageCanvas">Canvas the image is displayed on</param>
/// <param name="uiProcImage">Processed Image</param>
/// <param name="uiProcImageCanvas">Canvas that the processed image is displayed on</param>
public ImageControls(Image uiImage, Canvas uiImageCanvas, Image uiProcImage, Canvas uiProcImageCanvas)
{
image = uiImage;
imageCanvas = uiImageCanvas;
procImage = uiProcImage;
procImageCanvas = uiProcImageCanvas;
//Create transform group that includes ScaleTransform (zooming) and TranslateTransform (panning)
TransformGroup group = new TransformGroup();
ScaleTransform xform = new ScaleTransform();
group.Children.Add(xform);
TranslateTransform tt = new TranslateTransform();
TranslateTransform ttp = new TranslateTransform();
group.Children.Add(tt);
group.Children.Add(ttp);
//Add transform group to both images. Cant add to canvas because there is no boundry for the canvas, thus the images will expand outside the GUI
image.RenderTransform = group;
image.MouseWheel += image_MouseWheel;
image.MouseLeftButtonDown += image_MouseLeftButtonDown;
image.MouseLeftButtonUp += image_MouseLeftButtonUp;
image.MouseMove += image_MouseMove;
procImage.RenderTransform = group;
procImage.MouseWheel += procImage_MouseWheel;
procImage.MouseLeftButtonDown += procImage_MouseLeftButtonDown;
procImage.MouseLeftButtonUp += procImage_MouseLeftButtonUp;
procImage.MouseMove += procImage_MouseMove;
}
开发者ID:jniehus,项目名称:ProcView,代码行数:37,代码来源:ImageControls.cs
注:本文中的System.Windows.Media.ScaleTransform类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论