Canvas
StackPanel
Load Image(String Name) { panel = new StackPanel(); panel.Orientation = Orientation.Vertical; path = "pack://siteoforigin:,,/cam.jpeg"; imgLoc = new Uri(path, UriKind.RelativeOrAbsolute); imgId = new BitmapImage(imgLoc); img = new Image(); img.Source = imgId; img.Width = 15; img.Height = 15; img.HorizontalAlignment = HorizontalAlignment.Left; panel.Children.Add(img); panel.ToolTip = Name; panel.DataContext = Name; double Xcoordinatee = (Convert.ToDouble(Xcoordinate) * ImageHolder.ActualWidth); double Ycoordinatee = (Convert.ToDouble(Ycoordinate) * ImageHolder.ActualHeight); //set camera's x-coordinate Canvas.SetLeft(panel, Xcoordinatee); //set camera's y-coordinate Canvas.SetTop(panel, Ycoordinatee); panel.Opacity = 0.85; panel.Width = img.Width; panel.Height = img.Height; //restrict dropped camera image to be in map image area if (Xcoordinatee + panel.Width > ImageHolder.Width) { Canvas.SetLeft(panel, ImageHolder.Width - panel.Width); } if (Ycoordinatee + panel.Height > ImageHolder.Height) { Canvas.SetTop(panel, ImageHolder.Height - panel.Height); } ImageHolder.Children.Add(panel);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)