本文整理汇总了C#中System.Windows.Media.TranslateTransform类的典型用法代码示例。如果您正苦于以下问题:C# TranslateTransform类的具体用法?C# TranslateTransform怎么用?C# TranslateTransform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TranslateTransform类属于System.Windows.Media命名空间,在下文中一共展示了TranslateTransform类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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
示例2: OnRender
protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
{
TranslateTransform translation = this.RenderTransform as TranslateTransform;
if( translation == null)
{
translation = new TranslateTransform();
this.RenderTransform = translation;
}
double width = this.Width;
double height = this.Height;
if (double.IsNaN(width))
{
width = this.ActualWidth;
}
if (double.IsNaN(height))
{
height = this.ActualHeight;
}
translation.X = -width * 0.5;
translation.Y = -height * 0.5;
base.OnRender(drawingContext);
}
开发者ID:duckmaestro,项目名称:F-AI,代码行数:26,代码来源:CenteredGrid.cs
示例3: SetTransform
public void SetTransform()
{
if (pageHolder == null)
return;
TranslateTransform t = new TranslateTransform(pageHolder.HeadersSizeActive.Width + 3, 3);
gr.Transform = t;
}
开发者ID:Deiwos3,项目名称:IMS,代码行数:7,代码来源:DarkLayer.xaml.cs
示例4: CountDownWpf
public CountDownWpf()
{
InitializeComponent();
countdownTimer = new Timer {Interval = 1000};
countdownTimer.Elapsed += countdownTimer_Elapsed;
RenderTransform = new TranslateTransform() {X = 900, Y=300};
}
开发者ID:yong-ja,项目名称:starodyssey,代码行数:7,代码来源:CountDownWpf.xaml.cs
示例5: OnRender
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
if (AdornedElement.RenderSize.Width < 20)
return;
TranslateTransform transform = new TranslateTransform
(
AdornedElement.RenderSize.Width - 15,
(AdornedElement.RenderSize.Height - 5) / 2
);
transform = new TranslateTransform
(
AdornedElement.RenderSize.Width / 2 - 3.5,
AdornedElement.RenderSize.Height / 2 - 10
);
drawingContext.PushTransform(transform);
Geometry geometry = ascGeometry;
if (this.Direction == ListSortDirection.Descending)
geometry = descGeometry;
drawingContext.DrawGeometry(Brushes.LightGray, null, geometry);
drawingContext.Pop();
}
开发者ID:RomanHodulak,项目名称:WPFClient,代码行数:26,代码来源:SortAdorner.cs
示例6: OnMouseMove
protected override void OnMouseMove(MouseEventArgs e)
{
Window wnd = Window.GetWindow(this);
Point currentLocation = e.MouseDevice.GetPosition(wnd);
var move = new TranslateTransform(
currentLocation.X - _previousLocation.X, currentLocation.Y - _previousLocation.Y);
if (e.LeftButton == MouseButtonState.Pressed)
{
var group = new TransformGroup();
if (_previousTransform != null)
{
group.Children.Add(_previousTransform);
}
group.Children.Add(move);
RenderTransform = group;
}
else
{
Cursor = Cursors.Hand;
}
_previousLocation = currentLocation;
_previousTransform = RenderTransform;
MainWindow.Instance.CalculatePositions();
base.OnMouseMove(e);
}
开发者ID:taesiri,项目名称:electric-field,代码行数:30,代码来源:NegativeCharge.xaml.cs
示例7: 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
示例8: PerformTranstition
public override void PerformTranstition(UserControl newPage, UserControl oldPage)
{
this.newPage = newPage;
this.oldPage = oldPage;
Duration duration = new Duration(TimeSpan.FromSeconds(1));
DoubleAnimation animation = new DoubleAnimation();
animation.Duration = duration;
switch (direction)
{
case WipeDirection.LeftToRight:
animation.To = oldPage.ActualWidth;
break;
case WipeDirection.RightToLeft:
animation.To = -oldPage.ActualWidth;
break;
}
Storyboard sb = new Storyboard();
sb.Duration = duration;
sb.Children.Add(animation);
sb.Completed += sb_Completed;
TranslateTransform sc = new TranslateTransform();
oldPage.RenderTransform = sc;
Storyboard.SetTarget(animation, sc);
Storyboard.SetTargetProperty(animation, new PropertyPath("X"));
//oldPage.Resources.Add(sb);
sb.Begin();
}
开发者ID:kuki89,项目名称:IP_Lab,代码行数:34,代码来源:WipeTransition.cs
示例9: LayoutRoot_MouseLeftButtonUp
private void LayoutRoot_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
PointCollection points = new PointCollection();
foreach (Point p in poly.Points)
points.Add(p);
Point newPoint = e.GetPosition(poly);
points.Add(newPoint);
poly.Points = points;
// placeholder
Ellipse ph = new Ellipse
{
Fill = new SolidColorBrush(Colors.Black),
Width = 4D,
Height = 4D
};
TranslateTransform t = new TranslateTransform { X = newPoint.X - 2D, Y = newPoint.Y - 2D };
ph.RenderTransform = t;
cnv.Children.Add(ph);
//
TextBlock tb = new TextBlock
{
Foreground = new SolidColorBrush(Colors.Gray),
FontSize = 8
};
tb.Text = newPoint.ToString();
tb.RenderTransform = t;
cnv.Children.Add(tb);
}
开发者ID:dsummerfield,项目名称:ctaggart-hg.examples100,代码行数:28,代码来源:Euclidean.xaml.cs
示例10: 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
示例11: sp_MouseMove
void sp_MouseMove(object sender, MouseEventArgs e)
{
if (dragging_ && !firstDown_) {
Point currentPosition = e.GetPosition(dragTarget_);
var transform = dragTarget_.RenderTransform as TranslateTransform;
if (transform == null) {
transform = new TranslateTransform();
dragTarget_.RenderTransform = transform;
}
transform.X += currentPosition.X - clickPosition.X;
transform.Y += currentPosition.Y - clickPosition.Y;
clickPosition = e.GetPosition(dragTarget_);
//transform.X = currentPosition.X - clickPosition.X;
//transform.Y = currentPosition.Y - clickPosition.Y;
if (transform.X + dragTarget_.ActualWidth > canvas.MinWidth) {
canvas.MinWidth = canvas.Width = transform.X + dragTarget_.ActualWidth * 2;
canvas.InvalidateMeasure();
scroller.InvalidateMeasure();
scroller.InvalidateScrollInfo();
}
} else if (firstDown_)
firstDown_ = false;
}
开发者ID:nonconforme,项目名称:UrContent,代码行数:25,代码来源:GraphCanvas.xaml.cs
示例12: gdValues_MouseMove
void gdValues_MouseMove(object sender, MouseEventArgs e)
{
if (inFocus)
{
TranslateTransform rt = new TranslateTransform();
rt.Y = e.GetPosition(this).Y - 400;
gdValues.RenderTransform = rt;
start = rt.Y;
foreach (var c in gdValues.Children)
{
double lblTop = lblSelectedValue.PointToScreen(new Point(0, 0)).Y;
if ((c as UIElement).PointToScreen(new Point(0, 0)).Y >= lblTop - 20 && (c as UIElement).PointToScreen(new Point(0, 0)).Y <= lblTop + 20)
{
(c as Label).Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF005DFF"));
selectedText = (c as Label).Content.ToString();
(c as Label).BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF005DFF"));
element = (c as UIElement);
}
else
{
(c as Label).BorderBrush = new SolidColorBrush(Colors.White);
(c as Label).Background = new SolidColorBrush(Colors.Transparent);
}
}
}
}
开发者ID:voxPopuli92,项目名称:ViserInformator,代码行数:27,代码来源:ctrIzborSmera.xaml.cs
示例13: Bounce
/// <summary>
/// Bounces the specified element.
/// </summary>
/// <param name="element">The element.</param>
/// <param name="direction">The direction.</param>
/// <param name="whenDone">The when done.</param>
public static void Bounce(UIElement element, Direction direction, EventHandler whenDone = null)
{
var translateTransform = new TranslateTransform();
element.RenderTransform = translateTransform;
switch (direction)
{
case Direction.Up:
translateTransform.BeginAnimation(
TranslateTransform.YProperty,
CreateDoubleAnimation(
0,
-15,
0.2,
(o, e) => translateTransform.BeginAnimation(TranslateTransform.YProperty, CreateDoubleAnimationWithEasing(-15, 0, 0.8, new BounceEase { Bounces = 3, EasingMode = EasingMode.EaseOut })),
whenDone));
break;
case Direction.Down:
translateTransform.BeginAnimation(
TranslateTransform.YProperty,
CreateDoubleAnimation(
0,
15,
0.2,
(o, e) => translateTransform.BeginAnimation(TranslateTransform.YProperty, CreateDoubleAnimationWithEasing(15, 0, 0.8, new BounceEase { Bounces = 3, EasingMode = EasingMode.EaseOut })),
whenDone));
break;
}
}
开发者ID:quitrk,项目名称:MiniDeskTube,代码行数:35,代码来源:Animate.cs
示例14: 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
示例15: ArrangeOverride
/// <summary>
/// Provides the behavior for the Arrange pass of Silverlight layout. Classes can override this method to define their own Arrange pass behavior.
/// </summary>
/// <param name="finalSize">The final area within the parent that this object should use to arrange itself and its children.</param>
/// <returns>
/// The actual size that is used after the element is arranged in layout.
/// </returns>
protected override Size ArrangeOverride(Size finalSize)
{
if (Symbol is ESRI.ArcGIS.Client.Symbols.MarkerSymbol)
{
UIElement child = GetChild();
Transform childTransform = child == null ? null : child.RenderTransform;
if (childTransform != null)
{
// Arrange the symbol following it's desired size, the final size which is taking care of the transform is not the good one
Size size = child.DesiredSize.Height == 0 && child.DesiredSize.Width == 0 ? finalSize : child.DesiredSize;
child.Arrange(new Rect(new Point(0, 0), size));
// Now we need to translate the symbol in order that the visual part of the symbol be in the snapshot
Rect rect = childTransform.TransformBounds(new Rect(new Point(0, 0), child.DesiredSize)); // visual position of the symbol after transformation
child.RenderTransformOrigin = new Point(0, 0); // for the swatch, the transform origin must be (0,0) whatever the transform origin used in the map
if (rect.X != 0 || rect.Y != 0)
RenderTransform = new TranslateTransform { X = -rect.X, Y = -rect.Y }; // Center the symbol
return finalSize;
}
}
return base.ArrangeOverride(finalSize);
}
开发者ID:Esri,项目名称:arcgis-toolkit-sl-wpf,代码行数:32,代码来源:SymbolPresenter.cs
示例16: DrawArray
public void DrawArray(int* array, int size, int y, string name)
{
TranslateTransform infots = new TranslateTransform((-260) % 300, y);
TextBlock infoText = new TextBlock();
infoText.RenderTransform = infots;
infoText.Text = name;
infoText.Height = 30;
infoText.Width = 50;
animationContainer.Children.Add(infoText);
for (int i = 0; i < size; i++)
{
Rectangle rect = new Rectangle();
TextBlock text = new TextBlock();
text.Text = array[i].ToString();
text.Height = 30;
text.Width = 50;
rect.Height = array[i] ;
rect.Width = 30;
rect.Fill = new SolidColorBrush(Colors.LightBlue);
TranslateTransform textts = new TranslateTransform((-200 + 50 * i) % 300, y);
TranslateTransform backts = new TranslateTransform((-215 + 50 * i) % 300, y);
text.RenderTransform = textts;
rect.RenderTransform = backts;
animationContainer.Children.Add(rect);
animationContainer.Children.Add(text);
}
}
开发者ID:g4idrijs,项目名称:UltraDemo,代码行数:33,代码来源:ArrayAnimation.cs
示例17: 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
示例18: RectangleEditor
public RectangleEditor() {
InitializeComponent();
ScaleFactor = 1.0f;
group = new TransformGroup();
trans = new TranslateTransform();
group.Children.Add(trans);
marker.RenderTransform = group;
pointerUp.RenderTransform = group;
pointerDown.RenderTransform = group;
pointerUp.Cursor = Cursors.SizeNWSE;
pointerDown.Cursor = Cursors.SizeNWSE;
marker.Cursor = Cursors.SizeAll;
marker.MouseDown += new MouseButtonEventHandler(marker_MouseDown);
marker.MouseMove += new MouseEventHandler(marker_MouseMove);
marker.MouseUp += new MouseButtonEventHandler(MouseUpHandler);
pointerUp.MouseDown += new MouseButtonEventHandler(pointerUp_MouseDown);
pointerUp.MouseMove += new MouseEventHandler(pointerUp_MouseMove);
pointerUp.MouseUp += new MouseButtonEventHandler(MouseUpHandler);
pointerDown.MouseDown += new MouseButtonEventHandler(pointerDown_MouseDown);
pointerDown.MouseMove += new MouseEventHandler(pointerDown_MouseMove);
pointerDown.MouseUp += new MouseButtonEventHandler(MouseUpHandler);
viewBox.SizeChanged += new SizeChangedEventHandler(viewBox_SizeChanged);
Loaded += new RoutedEventHandler(RectangleEditor_Loaded);
}
开发者ID:zzilla,项目名称:ONVIF-Device-Manager,代码行数:32,代码来源:RectangleEditor.xaml.cs
示例19: 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
示例20: AnimateItem
public void AnimateItem(FrameworkElement item)
{
var translate = new TranslateTransform(0, 300);
item.RenderTransform = translate;
item.Opacity = 0;
Animate.The(TranslateTransform.YProperty)
.From(300)
.To(0)
.Delay(_delay)
.For(300.MilliSeconds())
.Create()
.AnimateOn(translate);
Animate.The(UIElement.OpacityProperty)
.From(0)
.To(100)
.Delay(_delay)
.For(300.MilliSeconds())
.Create()
.AnimateOn(item);
_delay += Amount_To_Increase_Delay;
}
开发者ID:RookieOne,项目名称:JBsWpfExamples,代码行数:25,代码来源:SlideUpAnimationStrategy.cs
注:本文中的System.Windows.Media.TranslateTransform类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论