private void UserControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     //点的设定
     if (edit_able == true)
     {
         try
         {
             Point_Set_View.rukou = int.Parse(label_left.Content.ToString());
             //Point_Set_View view = new Point_Set_View();
         }
         catch { Point_Set_View.rukou = 0; }
         try
         {
             Point_Set_View.chukou = int.Parse(label_right.Content.ToString());
         }
         catch { Point_Set_View.chukou = 0; }
         Point_Set_View.myname = label_center.Content.ToString();
         Point_Set_View view   = new Point_Set_View();
         bool?          result = view.ShowDialog();
         if (result == true)
         {
             MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "enable", "true");
             MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "rukou", Point_Set_View.rukou.ToString());
             MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "chukou", Point_Set_View.chukou.ToString());
             MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "X", pos_x.ToString());
             MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "Y", pos_y.ToString());
             Set_Left(Point_Set_View.rukou);
             Set_Right(Point_Set_View.chukou);
             Set_Center(Point_Set_View.myname);
         }
     }
     if (edit_able == false)
     {
     }
 }
Exemplo n.º 2
0
        private void myimage_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (ready_parse == true)
            {
                ready_parse = false;
                this.Cursor = Cursors.Arrow;
                if (e.ChangedButton == MouseButton.Left)
                {
                    //int b = 0;
                    // 添加地桩
                    if (e.GetPosition(Imageborder).X >= 0 && e.GetPosition(Imageborder).X < Imageborder.Width && e.GetPosition(Imageborder).Y >= 0 && e.GetPosition(Imageborder).Y <= Imageborder.Height)
                    {
                        //int a = 0;
                        // 加入地桩
                        DiZhuang_Item item = new DiZhuang_Item();
                        maingrid.Children.Add(item);
                        item.Margin = new Thickness(e.GetPosition(Imageborder).X + Imageborder.Margin.Left, e.GetPosition(Imageborder).Y + Imageborder.Margin.Top, 0, 0);

                        double pos_x = e.GetPosition(Imageborder).X;
                        double pos_y = e.GetPosition(Imageborder).Y;

                        item.pos_x = (pos_x - myimage.Margin.Left - Imageborder.Margin.Left + item.Width / 2) / suofang;
                        item.pos_y = (pos_y - myimage.Margin.Top - Imageborder.Margin.Top + item.Height / 2) / suofang;

                        all_dizhuang_list.Add(item);

                        // 在配置文件中加入地桩


                        Point_Set_View view  = new Point_Set_View();
                        bool?          ok_is = view.ShowDialog();
                        if (ok_is == true)
                        {
                            MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "enable", "true");
                            MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "rukou", Point_Set_View.rukou.ToString());
                            MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "chukou", Point_Set_View.chukou.ToString());
                            MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "X", item.pos_x.ToString());
                            MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "Y", item.pos_y.ToString());
                            item.Set_Left(Point_Set_View.rukou);
                            item.Set_Right(Point_Set_View.chukou);
                            item.Set_Center(Point_Set_View.myname);
                        }
                    }
                    //DiZhuang_Item item = new DiZhuang_Item();



                    //maingrid.Children.Add(item);
                }
            }
            else
            {
                move_enable = true;
                pre_pos_x   = e.GetPosition(Imageborder).X;
                pre_pos_y   = e.GetPosition(Imageborder).Y;
            }
        }
Exemplo n.º 3
0
        private void UserControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            //点的设定
            if (edit_able == true)
            {
                try
                {
                    Point_Set_View.rukou = int.Parse(label_left.Content.ToString());
                    //Point_Set_View view = new Point_Set_View();
                }
                catch { Point_Set_View.rukou = 0; }
                try
                {
                    Point_Set_View.chukou = int.Parse(label_right.Content.ToString());
                }
                catch { Point_Set_View.chukou = 0; }
                Point_Set_View.myname = label_center.Content.ToString();
                Point_Set_View view   = new Point_Set_View();
                bool?          result = view.ShowDialog();
                if (result == true)
                {
                    MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "enable", "true");
                    MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "rukou", Point_Set_View.rukou.ToString());
                    MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "chukou", Point_Set_View.chukou.ToString());
                    MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "X", pos_x.ToString());
                    MainWindow.Point_ini.IniWriteValue(Point_Set_View.myname, "Y", pos_y.ToString());
                    Set_Left(Point_Set_View.rukou);
                    Set_Right(Point_Set_View.chukou);
                    Set_Center(Point_Set_View.myname);
                }
            }
            if (edit_able == false)
            {
                //try{
                //    rukou = int.Parse(MainWindow.Point_ini.IniReadValue(Key, "rukou"));
                //    chukou = int.Parse(MainWindow.Point_ini.IniReadValue(Key, "chukou"));

                //    ArrayList all_warn_list = new ArrayList();

                //    foreach(DataList.Data_Struct data_struct in MainWindow.Real_Data_List)
                //    {
                //        if(data_struct.位置>=rukou && data_struct.位置<=chukou)
                //        {
                //            all_warn_list.Add(data_struct);
                //        }
                //    }



                //    WarnInfo view = new WarnInfo(all_warn_list);
                //    view.ShowDialog();

                //}
                //    catch{}
            }
        }