void BlankPage_Loaded(object sender, RoutedEventArgs e) { PointerMoved += BlankPage_PointerMoved; for (var i = 0; i < Items.Length; i++) { var g = new Grid { Width = 30, Height = 30 }; var ball = new Ellipse { Fill = new SolidColorBrush(Colors.Red), Opacity = .2 }; var tb = new TextBlock { Text = "" + i, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; Canvas.SetLeft(g, 0D); Canvas.SetTop(g, 0D); Items[i] = g; g.Children.Add(ball); g.Children.Add(tb); g.RenderTransformOrigin = new Point(.5, .5); //g.Effect = new DropShadowEffect(); LayoutRoot.Children.Add(g); } CompositionTarget.Rendering += (s, args) => { //countTxt.Text = "EaseObjects in memory = " + EaseObject.EaseObjectRunningCount; }; }
public static UIElement StarControlFactory(double scale) { // Draw star shape Array starShapes = Enum.GetValues(typeof(StarShape)); StarShape randomShape = (StarShape)starShapes.GetValue(_random.Next(0, starShapes.Length)); UIElement starControl; //ISSUE: Is this type good? switch (randomShape) { case StarShape.Rectangle: starControl = new Rectangle() {Fill = new SolidColorBrush(RandomColor()) }; break; case StarShape.Ellipse: starControl = new Ellipse() { Fill = new SolidColorBrush(RandomColor()) }; break; case StarShape.Star: starControl = new Star() { Fill = new SolidColorBrush(RandomColor()) }; break; default: starControl = new Star() { Fill = new SolidColorBrush(RandomColor()) }; break; } return starControl; }
private async void MainPage_Loaded(object sender, RoutedEventArgs e) { var width = this.ActualWidth; var height = this.ActualHeight; var min = Math.Min(width, height); var cwidth = min/8; for (var r = 0; r < 8; r++) { for (var c = 0; c < 8; c++) { var ellipse = new Ellipse() {Width = cwidth, Height = cwidth}; grid.Children.Add(ellipse); ellipse.Tag = r*8 + c; ellipse.Stroke = new SolidColorBrush(Colors.White); ellipse.Fill = _offBrush; ellipse.PointerPressed += Ellipse_PointerPressed; ellipse.SetValue(Grid.RowProperty, r); ellipse.SetValue(Grid.ColumnProperty, c); } } _backpack = new Adafrut8x8LEDBackpack(); await _backpack.initializeAsync(); }
public void UpdateStations() { double minlon = 12.18; double minlat = 48.50; double maxlon = 18.93; double maxlat = 51.02; //lat - zespodu - nahoru //lon - zleva - doprava double lonC = overlay.Width / (maxlon - minlon); double latC = overlay.Height / (maxlat - minlat); double y; ColorQualityConverter ccq = new ColorQualityConverter(); overlay.Children.Clear(); foreach (Station s in App.ViewModel.Stations) { Ellipse el = new Ellipse(); el.Width = 32; el.Height = 32; el.Fill = (Brush)ccq.Convert(s.Quality, typeof(Brush), null, null); if (s.Quality >= 7) el.Opacity = 0.5; Canvas.SetLeft(el, (s.Position.Longitude - minlon) * lonC); Canvas.SetTop(el, overlay.Height - ((s.Position.Latitude - minlat) * latC)); overlay.Children.Add(el); } }
private void ItemContainerGenerator_ItemsChanged(object sender, ItemsChangedEventArgs e) { if (e.Action == 1) { Position item = lstPositions.Items.Last() as Position; layers = new MapLayer(); image = new BitmapImage(); image.UriSource = (new Uri(SelectedFriend.Picture, UriKind.Absolute)); grid = new Grid(); grid.DataContext = item; grid.RightTapped += grid_RightTapped; textBlock = new TextBlock(); textBlock.Text = item.Counter.ToString(); textBlock.VerticalAlignment = VerticalAlignment.Bottom; textBlock.HorizontalAlignment = HorizontalAlignment.Center; brush = new ImageBrush(); brush.ImageSource = image; ellipse = new Ellipse(); ellipse.Height = 100; ellipse.Width = 100; ellipse.Fill = brush; grid.Children.Add(ellipse); grid.Children.Add(textBlock); layers.Children.Add(grid); MapLayer.SetPosition(grid, new Location(item.Latitude, item.Longitude)); myMap.Children.Add(layers); } }
private void Activate(Point2D item) { if (Map == null || Map.Layers == null) { return; } ellipse = new Ellipse(); #region 所有风格的控制 ellipse.Stroke = Stroke; ellipse.StrokeThickness = StrokeThickness; ellipse.Fill = Fill; ellipse.StrokeMiterLimit = StrokeMiterLimit; ellipse.StrokeDashOffset = StrokeDashOffset; ellipse.StrokeDashArray = StrokeDashArray; ellipse.StrokeDashCap = StrokeDashCap; ellipse.StrokeEndLineCap = StrokeEndLineCap; ellipse.StrokeLineJoin = StrokeLineJoin; ellipse.StrokeStartLineCap = StrokeStartLineCap; ellipse.Opacity = Opacity; #endregion DrawLayer = new ElementsLayer(); Map.Layers.Add(DrawLayer); ellipse.SetValue(ElementsLayer.BBoxProperty, new Rectangle2D(item, item)); DrawLayer.Children.Add(ellipse); isActivated = true; isDrawing = true; }
public MainPage() { Debug.WriteLine("Phone MainPage"); this.InitializeComponent(); this.NavigationCacheMode = NavigationCacheMode.Required; client = new Client(username, address, port); client.Connected += Client_Connected; client.Error += Client_Error; client.MessageReceived += Client_MessageReceived; MeasureButton.Click += MeasureButton_Click; MeasureButton_Hx.Click += MeasureButton_Hx_Click; GoToHxButton.Click += GoToHxButton_Click; // manual rfid button ScanText.PointerReleased += ScanText_PointerReleased; touchPoint = new Ellipse() { Width = 25, Height = 25, Fill = new SolidColorBrush(Windows.UI.Colors.Red), RenderTransform = new CompositeTransform() }; touchPoint.Visibility = Visibility.Collapsed; Container.Children.Add(touchPoint); Container.PointerReleased += Container_PointerReleased; Debug.WriteLine("Phone MainPage End"); }
private UIElement CreateMarker() { Canvas marker = new Canvas(); Ellipse outer = new Ellipse() { Width = 25, Height = 25, }; outer.Fill = new SolidColorBrush(Color.FromArgb(255,240,240,240)); outer.Margin = new Thickness(-12.5, -12.5, 0, 0); Ellipse inner = new Ellipse() { Width = 20, Height = 20, }; inner.Fill = new SolidColorBrush(Colors.Black); inner.Margin = new Thickness(-10, -10, 0, 0); Ellipse core = new Ellipse() { Width = 10, Height = 10, }; core.Fill = new SolidColorBrush(Colors.White); core.Margin = new Thickness(-5, -5, 0, 0); marker.Children.Add(outer); marker.Children.Add(inner); marker.Children.Add(core); return marker; }
protected override void OnTapped(TappedRoutedEventArgs e) { Point pt = e.GetPosition(this); // Create dot Ellipse ellipse = new Ellipse { Width = 3, Height = 3, Fill = this.Foreground }; Canvas.SetLeft(ellipse, pt.X); Canvas.SetTop(ellipse, pt.Y); canvas.Children.Add(ellipse); // Create text TextBlock txtblk = new TextBlock { Text = String.Format("{0}", pt), FontSize = 24 }; Canvas.SetLeft(txtblk, pt.X); Canvas.SetTop(txtblk, pt.Y); canvas.Children.Add(txtblk); e.Handled = true; base.OnTapped(e); }
public MainPage() { this.InitializeComponent(); initLedMatrixDevice(); for (int i = 0; i < MATRIX_SIZE; i++) { TextBlock tb = new TextBlock(); tb.Text = "0x00"; tb.HorizontalAlignment = HorizontalAlignment.Center; tb.VerticalAlignment = VerticalAlignment.Center; tb.SetValue(Grid.RowProperty, i); tb.SetValue(Grid.ColumnProperty, MATRIX_SIZE); _matrix.Children.Add(tb); _matrixRowValue[i] = tb; for (int j = 0; j < MATRIX_SIZE; j++) { Ellipse led = new Ellipse(); led.Width = 40; led.Height = 40; led.HorizontalAlignment = HorizontalAlignment.Center; led.VerticalAlignment = VerticalAlignment.Center; led.Fill = _off; led.SetValue(Grid.RowProperty, i); led.SetValue(Grid.ColumnProperty, j); led.PointerPressed += Led_PointerPressed; _matrix.Children.Add(led); setMatrixData(i, j, 0); } } }
public NPCHitAnimation(int hitatX, int hitatY) { Animations = new List<Shape>(); Ellipse el = new Ellipse(); el.Width = hitatX; el.Height = hitatY; Animations.Add(el); }
public Block(Ellipse q1, Ellipse q2, Ellipse q3, Ellipse q4) { foo = new Ellipse[4]; foo[0] = q1; foo[1] = q2; foo[2] = q3; foo[3] = q4; }
private void canvas_PointerMoved(object sender, PointerRoutedEventArgs e) { nextPoint = e.GetCurrentPoint(canvas).Position; //Line l = new Line { X1 = prePoint.X, Y1 = prePoint.Y, X2 = nextPoint.X, Y2 = nextPoint.Y, StrokeThickness=5 // ,Stroke=new SolidColorBrush(Colors.Red )}; Ellipse ellipse = new Ellipse { Width = 100, StrokeThickness = 5, Stroke = new SolidColorBrush(Colors.Red),Fill=new SolidColorBrush(Colors.Yellow )}; canvas.Children.Add(ellipse); //prePoint = nextPoint; }
private static UIElement GetCircle() { Ellipse ellipse = new Ellipse(); ellipse.Fill = new SolidColorBrush(Colors.Red); ellipse.Stroke = new SolidColorBrush(Colors.Red); ellipse.Width = 50; ellipse.Height = 50; return ellipse; }
//draw a ellipse using windows store graphics protected override void DoDrawEllipse(Point topLeftPoint, Point bottomRightPoint) { Windows.UI.Xaml.Shapes.Ellipse ellipse = new Windows.UI.Xaml.Shapes.Ellipse(); ellipse.Fill = new SolidColorBrush(Colors.Blue); ellipse.Width = bottomRightPoint.X - topLeftPoint.X; ellipse.Height = bottomRightPoint.Y - topLeftPoint.Y; Canvas.SetLeft(ellipse, topLeftPoint.X); Canvas.SetTop(ellipse, topLeftPoint.Y); _canvas.Children.Add(ellipse); }
public CARD(card c) : base() { CardEllipse = new Ellipse(); gridDef(); EllipseDef(this.CardEllipse); base.Children.Add(this.CardEllipse); addImage(c.number, c); base.Tag = c; this.isHit = false; }
public void DrawCompass() { var circle = new Ellipse(); circle.Width = this.drawingSurface.Width - 10; circle.Height = circle.Width; circle.StrokeThickness = 2; circle.Stroke = new SolidColorBrush(Colors.Goldenrod); circle.Margin = new Thickness(5); this.drawingSurface.Children.Add(circle); }
private static Grid CreateBall(double width, double height) { var g = new Grid { Width = width, Height = height }; var ball = new Ellipse { Fill = new SolidColorBrush(Colors.Red), Opacity = .2 }; var tb = new TextBlock { Text = "0", HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; Canvas.SetLeft(g, 0D); Canvas.SetTop(g, 0D); g.Children.Add(ball); g.Children.Add(tb); g.RenderTransformOrigin = new Point(.5, .5); return g; }
public game() { this.InitializeComponent(); this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += this.NavigationHelper_LoadState; this.navigationHelper.SaveState += this.NavigationHelper_SaveState; StackPanel panel = new StackPanel(); int i, j; Box_size = 9; gameBoxes = new Box[Box_size, Box_size]; // init for (i = 0; i < Box_size; i++) { for (j = 0; j < Box_size; j++) { gameBoxes[i,j].left = false; gameBoxes[i,j].right = false; gameBoxes[i,j].down = false; gameBoxes[i, j].up = false; gameBoxes[i, j].coins = 1; gameBoxes[i, j].i = i; gameBoxes[i, j].j = j; gameBoxes[i,j].boundaries = 0; } } Ellipse rect; for (i = 0; i < ncols; i++) { for (j = 0; j < nrows; j++) { rect = new Ellipse(); rect.Stroke = new SolidColorBrush(Windows.UI.Colors.White); rect.Fill = new SolidColorBrush(Windows.UI.Colors.White); rect.Width = thick; rect.Height = thick; Canvas.SetLeft(rect, i * multiplier + offset); Canvas.SetTop(rect, j * multiplier + offset); rect.StrokeThickness = 2; can.Children.Add(rect); } } array = new int[nrows, ncols]; gamearea.Children.Add(panel); Start_timer(); }
public static void update(GamePlay page, World w) { Spaceship ship = w.getSpaceship(); ship.image.RenderTransform = new RotateTransform() { CenterX = ship.image.ActualWidth / 2, CenterY = ship.image.ActualHeight / 2, Angle = 180 * (Math.Atan2(ship.velocity.x, -ship.velocity.y)) / Math.PI }; Ellipse ellipse = new Ellipse(); ellipse.Width = 10; ellipse.Height = 10; ellipse.Margin = new Thickness(ship.getPosition().x, ship.getPosition().y, 0, 0); ellipse.StrokeThickness = 10.0; ellipse.Stroke = new SolidColorBrush(Colors.OrangeRed); page.ContentPanel1.Children.Add(ellipse); Vector mult = ship.velocity.times((float)ship.image.ActualHeight / (ship.velocity.getMagnitude())); ship.image.Margin = new Thickness(ship.getPosition().x + mult.x, ship.getPosition().y + mult.y, 0, 0); }
public PhysicsJoint() { this.Width = 8; this.Height = 8; _ellDesign = new Ellipse(); _ellDesign.Width = 8; _ellDesign.Height = 8; _ellDesign.Stroke = new SolidColorBrush(WinUI.Colors.White); this.Children.Add(_ellDesign); if (Utilities.IsDesignMode) return; this.Loaded += new RoutedEventHandler(PhysicsJoint_Loaded); }
private void RotateEllipse(Ellipse elli, Windows.UI.Input.ManipulationDelta delta) { //check if rotate transform var oldTransform = (elli.RenderTransform as RotateTransform); if (oldTransform == null) { oldTransform = new RotateTransform(); } var angle = oldTransform.Angle; angle += delta.Rotation; var rotateTransform = new RotateTransform(); rotateTransform.Angle = angle; rotateTransform.CenterX = 150; rotateTransform.CenterY = 150; elli.RenderTransform = rotateTransform; }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); el0 = GetTemplateChild("Ellipse0") as Ellipse; el1 = GetTemplateChild("Ellipse1") as Ellipse; el2 = GetTemplateChild("Ellipse2") as Ellipse; trans0 = GetTemplateChild("Trans0") as CompositeTransform; trans1 = GetTemplateChild("Trans1") as CompositeTransform; trans2 = GetTemplateChild("Trans2") as CompositeTransform; loading = GetTemplateChild("Loading") as Storyboard; finish = GetTemplateChild("Finish") as Storyboard; start = GetTemplateChild("Start") as Storyboard; root = GetTemplateChild("Root") as StackPanel; rootHeightOut = GetTemplateChild("RootHeightOut") as DiscreteDoubleKeyFrame; root.Loaded += El0_Loaded; }
public void Attach(DependencyObject associatedObject) { AssociatedObject = associatedObject; imgObj = associatedObject as Image; elipseObj = associatedObject as Ellipse; if ((imgObj == null) && (elipseObj == null)) { throw new ArgumentException("ImagePlaceholderBehavior can only be used with a Image or Ellipse."); } SetPlaceholderImgSource(); }
void IDraw.Draw(Canvas canvas) { if (this.circle != null) { canvas.Children.Remove(this.circle); } else { this.circle = new Ellipse(); } this.circle.Height = this.diameter; this.circle.Width = this.diameter; Canvas.SetTop(this.circle, this.locY); Canvas.SetLeft(this.circle, this.locX); canvas.Children.Add(this.circle); }
private void LoadPosition() { Location center = new Location(staticObjects.CurrentLatitude, staticObjects.CurrentLongitude); myMap.Center = center; myMap.ZoomLevel = 17; Ellipse pushpin= new Ellipse(); pushpin.Height = 50; pushpin.Width = 50; pushpin.Fill = new SolidColorBrush(Colors.Blue); MapLayer layer = new MapLayer(); layer.Children.Add(pushpin); MapLayer.SetPosition(pushpin, center); myMap.Children.Add(layer); }
private void TranslateEllipse(Ellipse elli, Windows.UI.Input.ManipulationDelta delta) { var translation = delta.Translation; var left = Canvas.GetLeft(elli) + translation.X; var top = Canvas.GetTop(elli) + translation.Y; var maxLeft = (elli.Parent as FrameworkElement).ActualWidth - elli.Width; var maxTop = (elli.Parent as FrameworkElement).ActualHeight - elli.Height; left = (left < maxLeft) ? left : maxLeft; left = (0 < left) ? left : 0; top = (top < maxTop) ? top : maxTop; top = (0 < top) ? top : 0; Canvas.SetLeft(elli, left); Canvas.SetTop(elli, top); }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); ellipse = (Ellipse)this.GetTemplateChild("Point"); this.Height = CircleRadius; this.Width = CircleRadius; Point = new Point(this.Height / 2, this.Height / 2); ellipse.StrokeThickness = this.StrockThickness; ellipse.Stroke = this.Palette; if (FillPoint) ellipse.Fill = this.Palette; else ellipse.Fill = null; }
private void ToggleWeek(Grid grid, Ellipse circle, Storyboard show, Storyboard hide) { if (grid.Visibility == Windows.UI.Xaml.Visibility.Collapsed) { HideAllGrids(); ResetCircleColors(); grid.Visibility = Windows.UI.Xaml.Visibility.Visible; circle.Fill = _circleHighlightColor; show.Begin(); } else { HideAllGrids(); ResetCircleColors(); circle.Fill = _circleDefaultColor; hide.Begin(); } }
private void Add(SolidColorBrush brush) { var ornament = new Ellipse { Height = 50, Width = 50, Fill = brush, RenderTransform = new CompositeTransform(), }; TreeContainer.Children.Add(ornament); ornament.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY; ornament.ManipulationDelta += (s, e) => { var t = ornament.RenderTransform as CompositeTransform; t.TranslateX += e.Delta.Translation.X; t.TranslateY += e.Delta.Translation.Y; }; }
Child GetChild(ChildType type) { while (nextChildIndex < children.Count && children[nextChildIndex].Type != type) { // TODO: This shape is out of order nextChildIndex++; } if (nextChildIndex >= children.Count) { FrameworkElement shape; switch (type) { case ChildType.Rectangle: shape = new Shapes.Rectangle(); break; case ChildType.Ellipse: shape = new Shapes.Ellipse(); break; case ChildType.Path: shape = new Shapes.Path(); break; case ChildType.Image: shape = new Image(); break; case ChildType.Text: shape = new TextBlock(); break; default: throw new NotSupportedException(type + " not supported"); } var ch = new Child { Type = type, Shape = shape, }; children.Add(ch); nextChildIndex = children.Count; return(ch); } else { var ch = children[nextChildIndex]; nextChildIndex++; return(ch); } }
public async void UpdateMap(bool userLocation = false) { map.Children.Clear(); if (userLocation) { var pin = new Grid() { Width = 25, Height = 25, Margin = new Windows.UI.Xaml.Thickness(-12) }; pin.Children.Add(new Ellipse() { Fill = new SolidColorBrush(Colors.Red), Width = 25, Height = 25 }); pin.Children.Add(new Ellipse() { Fill = new SolidColorBrush(Colors.Yellow), Width = 10, Height = 10 }); var basic = new BasicGeoposition(); basic.Longitude = navigation.x; basic.Latitude = navigation.y; Windows.UI.Xaml.Shapes.Ellipse fence = new Windows.UI.Xaml.Shapes.Ellipse(); map.Children.Add(pin); MapControl.SetLocation(pin, new Geopoint(basic)); MapControl.SetNormalizedAnchorPoint(pin, new Point(0.5, 0.5)); if (slowView) { await map.TrySetViewAsync(new Geopoint(basic), 19, 20, 20, MapAnimationKind.Bow); } } //await myAzure.GetData(); myAzure.startGetDataTask(); map.MapElements.Clear(); if (myAzure.items != null) { foreach (var item in myAzure.items) { if (!string.Equals(item.Id, navigation.guid)) { MapIcon mapIcon = new MapIcon(); ////mapIcon.Image = RandomAccessStreamReference.CreateFromUri( // //new Uri("ms-appx:///Assets/marker.png")); var basic = new BasicGeoposition(); basic.Longitude = item.X; basic.Latitude = item.Y; ////basic.Altitude = item.z; var point = new Geopoint(basic); mapIcon.NormalizedAnchorPoint = new Point(0.25, 0.9); mapIcon.Location = point; map.MapElements.Add(mapIcon); var pin = new Grid() { Width = 100, Height = 30, Margin = new Windows.UI.Xaml.Thickness(-12) }; pin.Children.Add(new TextBlock() { Text = item.Name, Foreground = new SolidColorBrush(Colors.Black), FontSize = 15, Width = 100, Height = 30 }); map.Children.Add(pin); MapControl.SetLocation(pin, new Geopoint(basic)); MapControl.SetNormalizedAnchorPoint(pin, new Point(0.5, 0.5)); } } } await myAzure.InsertData(new TableItem(navigation.guid, navigation.name, navigation.x, navigation.y, DateTime.Now)); }