コード例 #1
0
 private void GraphViewer_Load(object sender, EventArgs e)
 {
     tb_TimeRange.Text    = TimeRange.ToString();
     tb_Xmin.Text         = Xmin.ToString();
     tb_Xmax.Text         = Xmax.ToString();
     tb_Ymin.Text         = Ymin.ToString();
     tb_Ymax.Text         = Ymax.ToString();
     chbox_swapXY.Checked = SwapXY;
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: SergeuG1/-11
 public Form1()
 {
     InitializeComponent();
     Xmin          = 0.2; Xmax = 8.2; Ymin = 0.5; Ymax = 6.5;
     textBox1.Text = Xmin.ToString();
     textBox2.Text = Ymin.ToString();
     textBox3.Text = Xmax.ToString();
     textBox4.Text = Ymax.ToString();
     dc            = pictureBox1.CreateGraphics();
     p             = new Pen(Brushes.Black, 1);
 }
コード例 #3
0
 public Form1()
 {
     InitializeComponent();
     flag          = false;
     graphics      = pictureBox1.CreateGraphics();
     Xmin          = 0.2; Xmax = 8.2; Ymin = 0.5; Ymax = 6.5;
     textBox1.Text = Xmin.ToString();
     textBox2.Text = Xmax.ToString();
     textBox3.Text = Ymin.ToString();
     textBox4.Text = Ymax.ToString();
 }
コード例 #4
0
 public Form1()
 {
     InitializeComponent();
     /* Задание границ области вывода по умолчанию */
     Xmin          = 0.2; Xmax = 8.2; Ymin = 0.5; Ymax = 6.5;
     textBox1.Text = Xmin.ToString();
     textBox2.Text = Ymin.ToString();
     textBox3.Text = Xmax.ToString();
     textBox4.Text = Ymax.ToString();
     dc            = pictureBox1.CreateGraphics();
     p             = new Pen(Brushes.Black, 1);
 }
コード例 #5
0
 private void button_Reset_Click(object sender, EventArgs e)
 {
     Xmin              = -10;
     Xmax              = 10;
     Ymin              = -10;
     Ymax              = 10;
     Xstep             = 1;
     Ystep             = 2;
     textBox_Xmin.Text = Xmin.ToString();
     textBox_Xmax.Text = Xmax.ToString();
     textBox_Ymin.Text = Ymin.ToString();
     textBox_Ymax.Text = Ymax.ToString();
     pictureBox_Surface.Refresh();
 }
コード例 #6
0
        private void button_ToCentre_Click(object sender, EventArgs e)
        {
            float aux = Xmax - Xmin;

            Xmax = aux / 2;
            Xmin = -aux / 2;
            aux  = Ymax - Ymin;
            Ymax = aux / 2;
            Ymin = -aux / 2;
            textBox_Xmin.Text = Xmin.ToString();
            textBox_Xmax.Text = Xmax.ToString();
            textBox_Ymin.Text = Ymin.ToString();
            textBox_Ymax.Text = Ymax.ToString();
            pictureBox_Surface.Refresh();
        }
コード例 #7
0
        private void button6_Click(object sender, EventArgs e)
        {
            float aux = (Xmax - Xmin);

            Xmax          = aux / 2;
            Xmin          = -aux / 2;
            aux           = (Ymax - Ymin);
            Ymax          = aux / 2;
            Ymin          = -aux / 2;
            textBox1.Text = Xmin.ToString();
            textBox3.Text = Xmax.ToString();
            textBox2.Text = Ymin.ToString();
            textBox4.Text = Ymax.ToString();
            this.Refresh();
        }
コード例 #8
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            float X = Xcursor - Cursor.Position.X;
            float Y = Ycursor - Cursor.Position.Y;
            Xmax = Xmax_aux + X/Xdim;
            Xmin = Xmin_aux + X/Xdim;
            Ymax = Ymax_aux - Y/Ydim;
            Ymin = Ymin_aux - Y/Ydim;

            label11.Text = X.ToString();
            label12.Text = Y.ToString();   
            textBox1.Text = Xmin.ToString();
            textBox3.Text = Xmax.ToString();
            textBox2.Text = Ymin.ToString();
            textBox4.Text = Ymax.ToString();
            this.Refresh();
        }
コード例 #9
0
 public override string ToString()
 {
     System.Text.StringBuilder sb = new System.Text.StringBuilder(200);
     sb.AppendFormat("[Table2D @ {0:X6} | Selected={1} Count={2} Type={3} | RangeX={4}, RangeY={5} | xMin={6} xMax={7} | yMin={8} yMax={9} yAvg={10}",
                     location, selected, CountX, TableType.ToStr(),
                     rangeX.ToString(), rangeY.ToString(),
                     Xmin.ToString(), Xmax.ToString(),
                     Ymin.ToString(), Ymax.ToString(), Yavg.ToString());
     if (hasMAC)
     {
         sb.AppendFormat(" | Multiplier={0}, Offset={1}]", Multiplier, Offset);
     }
     else
     {
         sb.Append("]");
     }
     return(sb.ToString());
 }
コード例 #10
0
        private void pictureBox_Surface_MouseMove(object sender, MouseEventArgs e)
        {
            if (pressed)
            {
                //
                float x = cursorX_initial - e.X;
                float y = cursorY_initial - e.Y;
                Xmax = Xmax_initial + x / Xdim;
                Xmin = Xmin_initial + x / Xdim;
                Ymax = Ymax_initial - y / Ydim;
                Ymin = Ymin_initial - y / Ydim;

                textBox_Xmin.Text = Xmin.ToString();
                textBox_Xmax.Text = Xmax.ToString();
                textBox_Ymin.Text = Ymin.ToString();
                textBox_Ymax.Text = Ymax.ToString();
                pictureBox_Surface.Refresh();
            }
        }
コード例 #11
0
ファイル: Carte.cs プロジェクト: CaniculeGame/rpg
    public void SavegarderFichierCarte(string pth)
    {
        if (carte == null)
        {
            return;
        }

        if (name == null && pth == null && path == null)
        {
            path = Application.dataPath + "/Resources/Cartes/Carte" + DateTime.Now.ToString();
        }
        else if (pth != null)
        {
            path = pth;
        }
        else
        {
            path = name;
            File.Create(path);
        }

        string        strEntete = Xmax.ToString() + "\n" + Ymax.ToString() + "\n";
        List <string> lines     = new List <string>();

        for (int i = 0; i < Xmax; i++)
        {
            for (int j = 0; j < Ymax; j++)
            {
                if (carte[i, j] != null && carte[i, j].EstOccupe)
                {
                    string str = i.ToString() + ":" + j.ToString() + ":" + carte[i, j].Hauteur.ToString() + ":" + carte[i, j].Element() + "\n";
                    lines.Add(str);
                }
            }
        }

        File.AppendAllLines(path, lines.ToArray());
    }
コード例 #12
0
        private void pictureBox_Surface__MouseWheel(object sender, MouseEventArgs e)
        {
            float Xval = 0, Yval = 0;
            int   sign = 0;

            if (radioButton_Horizontal.Checked == false)
            {
                Yval = (Ymax - Ymin) * 0.025F;
            }
            if (radioButton_Vertical.Checked == false)
            {
                Xval = (Xmax - Xmin) * 0.025F;
            }
            if (e.Delta < 0)
            {
                sign = -1;
            }
            else if (Xstep > 0.01F)
            {
                sign = 1;
            }
            if (sign != 0)
            {
                Xmax -= sign * Xval;
                Xmin += sign * Xval;
                Ymax -= sign * Yval;
                Ymin += sign * Yval;

                UpdateSteps();
                textBox_Xmin.Text = Xmin.ToString("F3");
                textBox_Xmax.Text = Xmax.ToString("F3");
                textBox_Ymin.Text = Ymin.ToString("F3");
                textBox_Ymax.Text = Ymax.ToString("F3");
                pictureBox_Surface.Refresh();
            }
        }
コード例 #13
0
 private void pictureBox2_MouseWheel(object sender, MouseEventArgs e)
 {
     if (ok)
     {
         const int proc = 4;
         float     Xval = 0;
         float     Yval = 0;
         if (hor)
         {
             Xval = (float)(Xmax - Xmin) * proc / 100;
         }
         if (vert)
         {
             Yval = (float)(Ymax - Ymin) * proc / 100;
         }
         if (e.Delta < 0)
         {
             Xmax += Xval;
             Xmin -= Xval;
             Ymax += Yval;
             Ymin -= Yval;
         }
         else if (((Xmax - Xmin) > 0.1) && (Ymax - Ymin) > 0.1)
         {
             Xmax -= Xval;
             Xmin += Xval;
             Ymax -= Yval;
             Ymin += Yval;
         }
         textBox1.Text = Xmin.ToString();
         textBox3.Text = Xmax.ToString();
         textBox2.Text = Ymin.ToString();
         textBox4.Text = Ymax.ToString();
         this.Refresh();
     }
 }
コード例 #14
0
        private void Btn_load_path_Click(object sender, EventArgs e)
        {
            String DllPath = tBox_DllPath.Text.ToString();

            IntPtr pDll = NativeMethods.LoadLibrary(@DllPath);

            if (pDll != IntPtr.Zero)
            {
                btn_Run.Enabled           = true;
                btn_set_optimizer.Enabled = true;
                SetImportingDllPath(DllPath, DllPath.Length);

                label5.Text      = "Loading status: loaded";
                label5.BackColor = Color.LightGreen;
                TaskLoaded       = true;

                IntPtr pAddressOfFunctionToCall1 =
                    NativeMethods.GetProcAddress(pDll, "GetTaskArea");
                IntPtr pAddressOfFunctionToCall2 =
                    NativeMethods.GetProcAddress(pDll, "GetTaskLinesCalcParams");
                IntPtr pAddressOfFunctionToCall3 =
                    NativeMethods.GetProcAddress(pDll, "GetDensity");

                GetTaskArea getTaskArea =
                    (GetTaskArea)Marshal.GetDelegateForFunctionPointer(
                        pAddressOfFunctionToCall1,
                        typeof(GetTaskArea));

                GetTaskLinesCalcParams getTaskLinesCalcParams =
                    (GetTaskLinesCalcParams)Marshal.GetDelegateForFunctionPointer(
                        pAddressOfFunctionToCall2,
                        typeof(GetTaskLinesCalcParams));

                GetDensity getDensity =
                    (GetDensity)Marshal.GetDelegateForFunctionPointer(
                        pAddressOfFunctionToCall3,
                        typeof(GetDensity));

                Xmin = getTaskArea(0);
                Xmax = getTaskArea(1);
                Ymin = getTaskArea(2);
                Ymax = getTaskArea(3);

                int N  = getTaskLinesCalcParams(0);
                int M1 = getTaskLinesCalcParams(1);
                int M2 = getTaskLinesCalcParams(2);
                int M3 = getTaskLinesCalcParams(3);

                int Density = getDensity();

                tBox_Xmin.Text = Xmin.ToString();
                tBox_Xmax.Text = Xmax.ToString();
                tBox_Ymin.Text = Ymin.ToString();
                tBox_Ymax.Text = Ymax.ToString();

                tBox_N.Text  = N.ToString();
                tBox_M1.Text = M1.ToString();
                tBox_M2.Text = M2.ToString();
                tBox_M3.Text = M3.ToString();

                dataGridView1.Rows.Add(0, 1, 0, Color.Black,
                                       Xmin, Xmax, Ymin, Ymax, N, M1, M2, M3);

                dataGridView1.Rows.Add(0, 2, Density, Color.Red,
                                       Xmin, Xmax, Ymin, Ymax, N, M1, M2, M3);

                dataGridView1.Rows.Add(0, 3, 0, Color.Red,
                                       Xmin, Xmax, Ymin, Ymax, N, M1, M2, M3);

                //bool result = NativeMethods.FreeLibrary(pDll);
            }

            //double Xmin = -6;
            //double Xmax = -0.1;
            //double Ymin = 0;
            //double Ymax = 3.05;

            //int N = 100;
            //int M1 = 80;
            //int M2 = 40;
            //int M3 = 20;

            ////int Density = getDensity();

            //tBox_Xmin.Text = Xmin.ToString();
            //tBox_Xmax.Text = Xmax.ToString();
            //tBox_Ymin.Text = Ymin.ToString();
            //tBox_Ymax.Text = Ymax.ToString();

            //tBox_N.Text = N.ToString();
            //tBox_M1.Text = M1.ToString();
            //tBox_M2.Text = M2.ToString();
            //tBox_M3.Text = M3.ToString();

            //dataGridView1.Rows.Add(0, 1, 0, Color.Black,
            //Xmin, Xmax, Ymin, Ymax, N, M1, M2, M3);
        }
コード例 #15
0
        public void AddChartStyle(TextBlock tbTitle, TextBlock tbXLabel, TextBlock tbYLabel, DataSeries ds)
        {
            Point     pt = new Point();
            Line      tick = new Line();
            double    offset = 0;
            double    dx, dy;
            TextBlock tb = new TextBlock();

            //  determine right offset:
            tb.Text = Ymax.ToString();
            tb.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
            Size size = tb.DesiredSize;

            rightOffset = size.Width / 2 + 2;

            // Determine left offset:
            for (dy = Ymin; dy <= Ymax; dy += YTick)
            {
                pt               = NormalizePoint(new Point(Xmin, dy));
                tb               = new TextBlock();
                tb.Text          = dy.ToString();
                tb.TextAlignment = TextAlignment.Right;
                tb.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
                size = tb.DesiredSize;
                if (offset < size.Width)
                {
                    offset = size.Width;
                }
            }
            leftOffset = offset + 5;

            Canvas.SetLeft(ChartCanvas, leftOffset);
            Canvas.SetBottom(ChartCanvas, bottomOffset);
            ChartCanvas.Width  = TextCanvas.Width - leftOffset - rightOffset;
            ChartCanvas.Height = TextCanvas.Height - bottomOffset - size.Height / 1.5;
            Rectangle chartRect = new Rectangle();

            chartRect.Stroke = Brushes.Black;
            chartRect.Width  = ChartCanvas.Width;
            chartRect.Height = ChartCanvas.Height;
            ChartCanvas.Children.Add(chartRect);

            // Create vertical gridlines:
            if (IsYGrid == true)
            {
                for (dx = Xmin + XTick; dx < Xmax; dx += XTick)
                {
                    gridline = new Line();
                    AddLinePattern();
                    gridline.X1 = NormalizePoint(new Point(dx, Ymin)).X;
                    gridline.Y1 = NormalizePoint(new Point(dx, Ymin)).Y;
                    gridline.X2 = NormalizePoint(new Point(dx, Ymax)).X;
                    gridline.Y2 = NormalizePoint(new Point(dx, Ymax)).Y;
                    ChartCanvas.Children.Add(gridline);
                }
            }

            // Create horizontal gridlines:
            if (IsXGrid == true)
            {
                for (dy = Ymin + YTick; dy < Ymax; dy += YTick)
                {
                    gridline = new Line();
                    AddLinePattern();
                    gridline.X1 = NormalizePoint(new Point(Xmin, dy)).X;
                    gridline.Y1 = NormalizePoint(new Point(Xmin, dy)).Y;
                    gridline.X2 = NormalizePoint(new Point(Xmax, dy)).X;
                    gridline.Y2 = NormalizePoint(new Point(Xmax, dy)).Y;
                    ChartCanvas.Children.Add(gridline);
                }
            }

            // Create x-axis tick marks:
            for (dx = Xmin; dx < Xmax; dx += xTick)
            {
                pt          = NormalizePoint(new Point(dx, Ymin));
                tick        = new Line();
                tick.Stroke = Brushes.Black;
                tick.X1     = pt.X;
                tick.Y1     = pt.Y;
                tick.X2     = pt.X;
                tick.Y2     = pt.Y - 5;
                ChartCanvas.Children.Add(tick);

                if (dx >= 0 && dx < ds.DataString.GetLength(1))
                {
                    tb = new TextBlock();
                    double d0 = DateToDouble(ds.DataString[0, 0]);
                    double d1 = DateToDouble(ds.DataString[0, 1]);
                    double d  = DateToDouble(ds.DataString[0, (int)dx]);
                    if (d0 > d1)
                    {
                        d = DateToDouble(ds.DataString[0, ds.DataString.GetLength(1) - 1 - (int)dx]);
                    }
                    tb.Text = DoubleToDate(d).ToString("m");
                    tb.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
                    size = tb.DesiredSize;
                    TextCanvas.Children.Add(tb);
                    Canvas.SetLeft(tb, leftOffset + pt.X - size.Width / 2);
                    Canvas.SetTop(tb, pt.Y + 2 + size.Height / 2);
                }
            }

            // Create y-axis tick marks:
            for (dy = Ymin; dy <= Ymax; dy += YTick)
            {
                pt          = NormalizePoint(new Point(Xmin, dy));
                tick        = new Line();
                tick.Stroke = Brushes.Black;
                tick.X1     = pt.X;
                tick.Y1     = pt.Y;
                tick.X2     = pt.X + 5;
                tick.Y2     = pt.Y;
                ChartCanvas.Children.Add(tick);

                tb      = new TextBlock();
                tb.Text = dy.ToString();
                tb.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
                size = tb.DesiredSize;
                TextCanvas.Children.Add(tb);
                Canvas.SetRight(tb, ChartCanvas.Width + 10);
                Canvas.SetTop(tb, pt.Y);
            }

            // Add title and labels:
            tbTitle.Text    = Title;
            tbXLabel.Text   = XLabel;
            tbYLabel.Text   = YLabel;
            tbXLabel.Margin = new Thickness(leftOffset + 2, 2, 2, 2);
            tbTitle.Margin  = new Thickness(leftOffset + 2, 2, 2, 2);
        }
コード例 #16
0
 public override string ToString()
 {
     return(Xmin.ToString("F2") + " ~ " + Xmax.ToString("F2") + ", " + Ymin.ToString("F2") + " ~ " + Ymax.ToString("F2"));
 }