private void OnPageCanvas_PointerPressed(object sender, PointerRoutedEventArgs e) { string tp = "ms-appx:///Assets/"; var x = e.GetCurrentPoint(onPageCanvas).Position.X; var y = e.GetCurrentPoint(onPageCanvas).Position.Y; var a = (sender as Canvas); double imH, imW; ManO mn; SchoolO sc; StudentO st; ZaochO zc; switch (typeOutput) { case "man": tp += "man.png"; imH = 120; imW = 120; mn = new ManO(tp, x, y); mn.Print(ref a, imH, imW); break; case "school": tp += "school.jpg"; sc = new SchoolO(tp, x, y); sc.Print(ref a, 120, 120); break; case "student": tp += "idiot.gif"; imH = 120; imW = 1.77 * imH; st = new StudentO(tp, x, y); st.Print(ref a, imH, imW); break; case "zaoch": tp += "zaoch.gif"; zc = new ZaochO(tp, x, y); imH = 120; imW = 1.33 * imH; zc.Print(ref a, imH, imW); break; default: tp += "test.png"; mn = new ManO(tp, x, y); mn.Print(ref a, 50, 50); break; } }
public void Print(ref Canvas onPageCanvas, double imHeight, double imWidth) { st.Print(ref onPageCanvas, imHeight, imWidth); Image newImage = new Image(); Image newChImg = new Image(); BitmapImage image = new BitmapImage(new Uri(Link)); BitmapImage chImg = new BitmapImage(new Uri("ms-appx:///Assets/chain.png")); newImage.Source = image; newChImg.Source = chImg; newImage.Height = imHeight; newImage.Width = imWidth; newChImg.Height = 15; newChImg.Width = 90; newImage.Margin = new Thickness(X, Y, 0, 0); newChImg.Margin = new Thickness((X - (imWidth / 3.1)), (Y + (imHeight / 2)), 0, 0); onPageCanvas.Children.Add(newImage); onPageCanvas.Children.Add(newChImg); }