Ejemplo n.º 1
0
 private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     //var childpart = sender as Grid;
     IsEdit = false;
     if (e.ClickCount == 2)
     {
         dialog = new UserDialog()
         {
             DataContext = this,
             Height      = 180,
             Width       = 400,
             MaxHeight   = 180,
             MaxWidth    = 400
         };
         //c1 = Canvas.GetLeft(sender as Grid);
         //c2 = Canvas.GetTop(sender as Grid);
         c1 = e.GetPosition(sender as Grid).X;
         c2 = e.GetPosition(sender as Grid).Y;
         dialog.ShowDialog();
     }
     else
     {
         (sender as Grid).Focus();
         shapetoDelete = new Grid();
         shapetoDelete = sender as Grid;
     }
 }
Ejemplo n.º 2
0
 private void btnEdit_Click(object sender, RoutedEventArgs e)
 {
     IsEdit = true;
     if (shapetoDelete == null)
     {
         MessageBox.Show("Please select a shape");
         return;
     }
     else
     {
         var tbl = FindChild <TextBlock>(shapetoDelete, "tblMessage");
         if (tbl != null)
         {
             Text = tbl.Text;
             //shapetoDelete.Children.Remove(tbl);
         }
         dialog = new UserDialog()
         {
             DataContext = this,
             Height      = 180,
             Width       = 400,
             MaxHeight   = 180,
             MaxWidth    = 400
         };
         dialog.ShowDialog();
     }
     //var tbtext = FindChild<TextBlock>(shapetoDelete, "tblMessage");
     //if (tbtext != null)
     //{
     //    shapetoDelete.Children.Remove(tbtext);
     //}
 }
Ejemplo n.º 3
0
        private void Sp_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            grid   = sender as Grid;
            IsEdit = false;
            var height = grid.Height;
            var width  = grid.Width;

            Panel.SetZIndex(grid, 20);
            if (e.ClickCount == 2)
            {
                c1 = 0;
                c2 = 0;
                var rectangle = FindChild <Rectangle>(grid, "rct");
                if (rectangle != null)
                {
                    rectangleDialog = new RectangleFunctions()
                    {
                        DataContext = this,
                        Height      = 280,
                        Width       = 300,
                        MaxHeight   = 280,
                        MaxWidth    = 300
                    };
                    rectangleDialog.ShowDialog();
                    return;
                }
                dialog = new UserDialog()
                {
                    DataContext = this,
                    Height      = 180,
                    Width       = 400,
                    MaxHeight   = 180,
                    MaxWidth    = 400
                };
                dialog.ShowDialog();
            }
            else
            {
                grid.Focus();
                x1 = e.GetPosition(this.cvsSurface).X;
                y1 = e.GetPosition(this.cvsSurface).Y;

                shapetoDelete = new Grid();
                shapetoDelete = sender as Grid;
            }
        }