private void add_anchor_window(System.Windows.Forms.Form form)
        {
            var application = this.Application;
            var parent_window = application.ActiveWindow;
            if (parent_window == null)
            {
                return;
            }
            if (application.ActiveDocument == null)
            {
                return;
            }

            object window_states = IVisio.VisWindowStates.visWSFloating | IVisio.VisWindowStates.visWSVisible;
            object window_types = IVisio.VisWinTypes.visAnchorBarAddon;

            var displacement = new System.Drawing.Point(50, 100);
            var window_rect = new System.Drawing.Rectangle(displacement, form.Size);
            string window_caption = form.Text;

            var the_anchor_window = VA.Application.UserInterfaceHelper.AddAnchorWindow(parent_window,
                                                                                       window_caption,
                                                                                       window_states,
                                                                                       window_types,
                                                                                       window_rect);

            if (the_anchor_window != null)
            {
                VA.Application.UserInterfaceHelper.AttachWindowsForm(the_anchor_window, form);
                form.Refresh();
            }
        }
        /*
         * Histogramm in die PictureBox des Fensters zeichnen auf Grundlage der Histogramm daten
         */
        public void draw_histogram(System.Windows.Forms.PictureBox statistik_pic, Config.histogram_canal canal)
        {
            const int width = 256;
            const int height = 100;

            Bitmap bb = new Bitmap(width, height);
            Graphics objGraphic = Graphics.FromImage(bb);
            Pen pen = new Pen(Color.Black);
            pen.Width = 5;

            objGraphic.DrawLine(pen, 0, height, width -1, height);

            int peak = 0;
            int c = (int)canal;
            int value = 0;
            for (int x = 1; x < width; x++)
            {
                value = histo[c, x];
                    // Höchstwert des Kanal Wertes berechnen <- normalisiert
                peak = (value == 0) ? 0 : (value * height) / this.peak[(int)canal];
                objGraphic.DrawLine(pen, x, height, x, height - peak);

                System.Drawing.Drawing2D.GraphicsState graph = objGraphic.Save();
                objGraphic.Restore(graph);
            }

            statistik_pic.Image = bb;
            statistik_pic.Refresh();
        }
Ejemplo n.º 3
0
 /*
 SendMessage( .Handle, WM_SETREDRAW, IntPtr(CInt(False)), IntPtr.Zero)
 */
 public static void enableRedraw(System.Windows.Forms.Control control, bool bEnable)
 {
     IntPtr hwnd = control.Handle;
     SendMessage(hwnd, WM_SETREDRAW, Convert.ToInt32(bEnable), 0);
     if (bEnable)
         control.Refresh();
 }
Ejemplo n.º 4
0
 public static void FadeForm(System.Windows.Forms.Form f, byte NumberOfSteps)
 {
     float StepVal = (float)(100f / NumberOfSteps);
     float fOpacity = 100f;
     for (byte b = 0; b < NumberOfSteps; b++)
     {
         f.Opacity = fOpacity / 100;
         f.Refresh();
         fOpacity -= StepVal;
     }
 }
Ejemplo n.º 5
0
 void AppendRichText(System.Windows.Forms.RichTextBox ctl, String str)
 {
     if (ctl.InvokeRequired)
     {
         this.Invoke(new Action<string>(ctl.AppendText), new object[] { str });
     }
     else
     {
         ctl.AppendText(str);
         ctl.ScrollToCaret();  //Scrolls the contents of the control to the current caret position
         ctl.Refresh();
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Function used to fade out a form using a user defined number
 /// of steps
 /// </summary>
 /// <param name="f">The Windows form to fade out</param>
 /// <param name="NumberOfSteps">The number of steps used to fade the
 /// form</param>
 public static void FadeForm(System.Windows.Forms.Form f, byte NumberOfSteps)
 {
     DateTime start = DateTime.Now;
     float StepVal = (float)(100f / NumberOfSteps);
     float fOpacity = 100f;
     for (byte b = 0; b < NumberOfSteps; b++)
     {
         f.Opacity = fOpacity / 100;
         f.Refresh();
         fOpacity -= StepVal;
         if ((DateTime.Now - start) > TimeSpan.FromMilliseconds(800))
         {
             f.Opacity = 0;
             b = NumberOfSteps;
         }
     }
 }
Ejemplo n.º 7
0
        public static void setStyle(System.Windows.Forms.Form frm)
        {
            uint oldStyle = getStyle(frm);
            uint newStyle = (uint)(
                            WINSTYLES.WS_OVERLAPPED | WINSTYLES.WS_POPUP | WINSTYLES.WS_VISIBLE | 
                            //WINSTYLES.WS_SYSMENU |  // add if you need a X to close
                            WINSTYLES.WS_CAPTION | WINSTYLES.WS_BORDER | //WINSTYLES.WS_DLGFRAME | WINSTYLES.WS_MAXIMIZEBOX |
                            WINSTYLES.WS_POPUPWINDOW);
            int iRet = SetWindowLong(frm.Handle, (int)GWL.GWL_STYLE, (int)newStyle);
            //if returned iRet is zero we got an error

            int newExStyle = GetWindowLong(frm.Handle, (int)GWL.GWL_EXSTYLE);
            newExStyle = (int)((uint)newExStyle - (uint) WINEXSTYLES.WS_EX_CAPTIONOKBTN); //remove OK button
            iRet = SetWindowLong(frm.Handle, (int)GWL.GWL_EXSTYLE, (int)newExStyle);
            moveWindow(frm);
            frm.Refresh();
        }
Ejemplo n.º 8
0
		public static void InitialiseWindow(System.Windows.Forms.Form window)
		{
			if(RecentWindowSettings.Rows.Contains(window.Text))
			{
				DataRow windowRow = RecentWindowSettings.Rows.Find(window.Text);
				// this is for people who quit the first time they run the game while maxmised
				try
				{
					window.Height = int.Parse(windowRow["windowheight"].ToString());
					window.Width = int.Parse(windowRow["windowwidth"].ToString());
					window.Top = int.Parse(windowRow["windowtop"].ToString());
					window.Left = int.Parse(windowRow["windowleft"].ToString());
				}
				catch(Exception e)
				{
					Log.Error( e );
				}

				window.WindowState = (System.Windows.Forms.FormWindowState)Enum.Parse(typeof(System.Windows.Forms.FormWindowState), windowRow["windowstate"].ToString(), true);
				window.Refresh();
			}
		}
Ejemplo n.º 9
0
        //
        //**********************************************************************************************
        //
        public void ShowMoistureContents(System.Windows.Forms.PictureBox aBox)
        {
            String FileName;
              Double[] Theta;
              Int32 Rows = MoistureContent.GetLength(0);

              Int32 FirstRow = 0;
              for (Int32 TheRow = 1; TheRow < Rows; TheRow++)
              {
            DateTime MyDate = Convert.ToDateTime(MoistureContent[TheRow, 0]);
            if (MyDate >= FirstDay)
            {
              FirstRow = TheRow;
              break;
            }
              }

              Int32 LastRow = Rows;
              for (Int32 Row = Rows - 1; Row > 0; Row--)
              {
            DateTime MyDate = Convert.ToDateTime(MoistureContent[Row, 0]);
            if (MyDate <= LastDay)
            {
              LastRow = Row;
              break;
            }
              }

              Int32 ImageCounter = 0;
              brTimes.Minimum = FirstRow;
              brTimes.Maximum = LastRow;

              Int32 j = FirstRow - 1;
              while ((j < LastRow) & (Running))
              {
            CreatingPicture = true;
            j = j + 1;
            brTimes.Value = j;

            DateTime MyDate = Convert.ToDateTime(MoistureContent[j, 0]);
            if ((MyDate >= FirstDay) & (MyDate <= LastDay))
            {
              ImageCounter++;
              chrtPrec2.Header.Text = MoistureContent[j, 0];
              chrtPrec2.Series[2].Clear();
              chrtPrec2.Series[2].Add(MyDate.ToOADate(), 0.0, Color.Red);
              chrtPrec2.Series[2].Add(MyDate.ToOADate(), 1.0, Color.Red);

              Int32 NVirtual = 0;
              foreach (TPlotToShow MyPlotToShow in PlotToShow)
              {
            TPlot MyPlot = Plot[MyPlotToShow.PlotId];
            Theta = new Double[MyPlot.Node.Count];
            for (Int32 i = 0; i < MyPlot.Node.Count; i++)
            {
              if (MyPlot.Node[i].Virtual)
              {
                NVirtual++;
                Theta[i] = 0.0;
              }
              else
              {
                Theta[i] = Convert.ToDouble(MoistureContent[j, i + 1 - NVirtual + MyPlot.FirstNode]);
              }
            }
            MyPlot.ProcessTheta(Theta, brPoints, MoistureClass, DerivedClass, MyPlotToShow.ItemToVisualize);
              }

              CreateTotalBitmap(false);

              FileName = SaveGraph(OutputDir, ImageCounter);
              if (PPTRequired)
              {
            PPT.AddPictureToSlide(FileName);
              }
              aBox.Image = null;
              aBox.Image = TotalBitmap;
              aBox.Refresh();
            }
            CreatingPicture = false;
              }
        }
Ejemplo n.º 10
0
 public System.Drawing.Image DrawTileBox(int N, System.Windows.Forms.PictureBox TileBox)
 {
     Bitmap TileBMP = new Bitmap(128, 512);
     TileBox.Invalidate();
     Graphics g = Graphics.FromImage(TileBMP);
     int x = 0;
     int y = 0;
     while (y <= 15)
     {
         while (x <= 3)
         {
             Bitmap Piece = new Bitmap(File.ReadLines(@"DATA/tiles.txt").Skip((N - 1) * 64 + (y * 4 + x)).Take(1).First());
             g.DrawImageUnscaled(Piece, x * 32, y * 32);
             x++;
         }
         x = 0;
         y++;
     }
     TileBox.Image = TileBMP;
     TileBox.Refresh();
     return TileBox.Image;
 }
Ejemplo n.º 11
0
 public System.Drawing.Image DrawMap(int N, System.Windows.Forms.PictureBox MapBox)
 {
     Bitmap MapBMP = new Bitmap (512, 512);
     MapBox.Invalidate();
     Graphics g = Graphics.FromImage(MapBMP);
     int x = 0;
     int y = 0;
     while (y <= 15)
     {
         while (x <= 15)
         {
             Bitmap Piece = new Bitmap(MapLines[(N - 1) * 261 + (y * 16 + x) + 6]);
             g.DrawImageUnscaled(Piece, x * 32, y * 32);
             x++;
         }
         x = 0;
         y++;
     }
     MapBox.Image = MapBMP;
     MapBox.Refresh();
     return MapBox.Image;
 }
Ejemplo n.º 12
0
        /// <summary>
        /// 生成路径点集合的哈希表 
        /// </summary>
        /// <param name="stationlist"></param>
        /// <param name="form"></param>
        /// <param name="pgb"></param>
        /// <param name="fileid"></param>
        /// <returns></returns>
        public Hashtable CzltGetRouteTable(List<ZzhaStation> stationlist, System.Windows.Forms.Form form, System.Windows.Forms.ProgressBar pgb, string fileid)
        {
            Hashtable nowRoulentable = new Hashtable();
            Hashtable roulentable = new Hashtable();
            Hashtable stationmap = new ZzhaStationDAL().GetStationAddress();
            List<RouteModel> routelist = this.GetAllRoute(fileid);
            float value = 0;
            float step = 100 / (float)stationlist.Count;
            for (int i = 0; i < stationlist.Count - 1; i++)
            {
                form.Refresh();
                CzltSerachRoute(roulentable, routelist, stationlist[i].Position, 0, stationlist[i].Position, stationlist[i].Position, stationmap);
                value += step;
                pgb.Value = Convert.ToInt32(value);
            }


            if (roulentable.Count > 0)
            {
                nowRoulentable = GetHashStation(roulentable, stationlist, form, pgb, step);

            }

            return nowRoulentable;
        }
Ejemplo n.º 13
0
        public void ProduceSubclassCodeFiles(System.Windows.Forms.ProgressBar bar)
        {
            bar.Minimum = 0;
            bar.Maximum = Overridables.Count;
            bar.Step = 1;
            bar.Value = 0;

            foreach (DefClass type in Overridables)
            {
                string wrapFile = "Subclass" + type.Name;
                string incFile = _includePath + "\\" + wrapFile + ".h";
                string cppFile = _sourcePath + "\\" + wrapFile + ".cpp";

                using (StreamWriter write = new StreamWriter(new MemoryStream()))
                {
                    write.Write(Copyright);
                    write.Write(CreateIncludeCodeForOverridable(type));
                    write.Flush();
                    WriteToFile(write.BaseStream as MemoryStream, incFile);
                }

                using (StreamWriter write = new StreamWriter(new MemoryStream()))
                {
                    write.Write(Copyright);
                    write.Write(CreateCppCodeForOverridable(type));
                    write.Flush();
                    WriteToFile(write.BaseStream as MemoryStream, cppFile);
                }

                bar.Value++;
                bar.Refresh();
            }
        }
Ejemplo n.º 14
0
        public void ProduceCodeFiles(System.Windows.Forms.ProgressBar bar)
        {
            bar.Minimum = 0;
            bar.Maximum = IncludeFiles.Count;
            bar.Step = 1;
            bar.Value = 0;

            PreDeclarations.Clear();
            PragmaMakePublicTypes.Clear();

            foreach (string include in IncludeFiles.Keys)
            {
                string wrapFile = include.Replace(".h", "");
                wrapFile = GetManagedIncludeFileName(wrapFile);

                string incFile = _includePath + "\\" + wrapFile + ".h";
                string cppFile = _sourcePath + "\\" + wrapFile + ".cpp";

                using (StreamWriter write = new StreamWriter(new MemoryStream()))
                {
                    write.Write(Copyright);
                    write.Write(CreateIncludeCodeForIncludeFile(include));
                    write.Flush();
                    WriteToFile(write.BaseStream as MemoryStream, incFile);
                }

                bool hasContent;
                string txt = CreateCppCodeForIncludeFile(include, out hasContent);
                if (hasContent)
                {
                    using (StreamWriter write = new StreamWriter(new MemoryStream()))
                    {
                        write.Write(Copyright);
                        write.Write(txt);
                        write.Flush();
                        WriteToFile(write.BaseStream as MemoryStream, cppFile);
                    }
                }

                bar.Value++;
                bar.Refresh();
            }

            //Create PreDeclarations.h

            using (StreamWriter write = new StreamWriter(new MemoryStream()))
            {
                foreach (string decl in PreDeclarations)
                {
                    write.WriteLine(decl);
                }

                write.Flush();
                WriteToFile(write.BaseStream as MemoryStream, _includePath + "\\PreDeclarations.h");
            }

            //Create MakePublicDeclarations.h

            using (StreamWriter write = new StreamWriter(new MemoryStream()))
            {
                List<DefType> typesForMakePublic = new List<DefType>();
                List<string> includesForTypes = new List<string>();

                foreach (DefType t in PragmaMakePublicTypes)
                {
                    if (t is DefClass && !t.IsNested)
                    {
                        DefType type = t.FindType<DefType>(t.Name);

                        if (type.FullNativeName.StartsWith(NativeNamespace + "::")
                            && type is DefClass && !type.IsTemplate)
                        {
                            if (!typesForMakePublic.Contains(type))
                            {
                                typesForMakePublic.Add(type);
                                if (!includesForTypes.Contains(type.IncludeFile))
                                    includesForTypes.Add(type.IncludeFile);
                            }
                        }
                    }
                }

                write.WriteLine("#pragma once");
                write.WriteLine();

                foreach (string inc in includesForTypes)
                {
                    write.WriteLine("#include \"" + inc + "\"");
                }
                write.WriteLine();

                foreach (DefType type in typesForMakePublic)
                {
                    write.WriteLine("#pragma make_public( " + type.FullNativeName + " )");
                }

                write.Flush();
                WriteToFile(write.BaseStream as MemoryStream, _includePath + "\\MakePublicDeclarations.h");
            }
        }
Ejemplo n.º 15
0
        public static bool Import(String filePath, IEstado estado, System.Windows.Forms.ProgressBar progress = null, System.Windows.Forms.Label lblprogress = null, bool raiseErrorFileAlreadyImp = true)
        {
            // verifica se arquivo já foi importado
            string md5 = Cryptography.Files.MD5.GetMD5Hash(filePath);
            IList<ILogIBPT> log = new LogIBPT()
                                            .Find<ILogIBPT>(new Where()
                                            {
                                                {
                                                    "sis_logibpt.md5", md5
                                                }
                                            });
            if (log.Count != 0 && raiseErrorFileAlreadyImp)
                throw new ArquivoJaImportado();

            // verifica se arquivo é do mesmo estado da empresa
            String stateEmp = estado.UF.Sigla;
            String stateFile = filePath.Split('\\')
                                        .Last().Substring(12, 2);
            if (!stateEmp.Equals(stateFile))
                throw new EstadoInvalido();

            Connection connection = null;
            int linhas = 0;
            try
            {
                connection = DbContext.CreateConnection();
                connection.BeginTransaction();

                // Abre arquivo para importação
                INCM ncm = null;
                IList<INCM> ncms = new NCM().Find<INCM>();
                String line = null;
                if (progress != null &&
                    lblprogress != null)
                {
                    progress.Maximum = File.ReadAllLines(filePath).Length;
                    progress.Step = 1;
                    lblprogress.Visible = true;
                    lblprogress.Text = string.Format("{0}% Concluído", (100 * progress.Value) / progress.Maximum);
                    lblprogress.Refresh();
                }
                using (StreamReader str = new StreamReader(filePath, Encoding.Default))
                {

                    while ((line = str.ReadLine()) != null)
                    {
                        string[] sections = line.Split(';');

                        if (linhas == 0 || !String.IsNullOrEmpty(sections[1]))
                        {
                            linhas++;
                            if (progress != null &&
                                lblprogress != null)
                            {
                                progress.Increment(1);
                                lblprogress.Text = string.Format("{0}% Concluído", (100 * progress.Value) / progress.Maximum);
                                lblprogress.Refresh();
                            }
                            continue;
                        }
                        ncm = ncms.FirstOrDefault(w => w.NCM.Trim() == sections[0]);
                        if (ncm == null) ncm = new NCM();

                        ncm.NCM = sections[0];
                        ncm.IPI = 0;
                        ncm.II = 0;
                        ncm.Descricao = sections[3];
                        ncm.ImpostoAproxEstadual = Unimake.Convert.ToDouble(sections[6]);
                        ncm.ImpostoAproximado = Unimake.Convert.ToDouble(sections[6]);
                        ncm.ImpostoAproxImport = Unimake.Convert.ToDouble(sections[5]);
                        ncm.ImpostoAproxMunicip = Unimake.Convert.ToDouble(sections[7]);
                        ncm.ChaveIBPT = sections[10];
                        ncm.Save();
                        linhas++;
                        if (progress != null &&
                            lblprogress != null)
                        {
                            progress.Increment(1);
                            progress.Refresh();
                            lblprogress.Text = string.Format("{0}% Concluído", (100 * progress.Value) / progress.Maximum);
                            lblprogress.Refresh();
                        }
                    }
                }

                if (progress != null &&
                            lblprogress != null)
                {
                    lblprogress.Text = "Arquivo importado com sucesso!";
                    lblprogress.Refresh();

                }
                LogIBPT.Save(new LogIBPT()
                {
                    Evento = "Importação de arquivos de NCM",
                    TipoEvento = Enuns.TipoEvento.Import,
                    Caminho = filePath,
                    MD5 = md5
                });
                connection.CommitTransaction();
            }
            catch
            {
                if (connection != null)
                    connection.RollbackTransaction();

                if (progress != null &&
                           lblprogress != null)
                {
                    lblprogress.Text = "Ocorreu algum erro durante a importação!";
                    lblprogress.Refresh();
                }

                throw;
            }
            finally
            {
                if (connection != null)
                    connection.Close();
            }
            return true;
        }
Ejemplo n.º 16
0
    /// <summary>
    /// Dessiner l'automate dans un Panel.
    /// </summary>
    /// <param name="DrawPanel">Le panel ou on va dessiner l'automate</param>
    /// <param name="fix">La methode de deplacement des etats dans le dessin
    /// true pour des emplacements fixes</param>
    public void Draw(System.Windows.Forms.Panel DrawPanel, bool fix)
    {
        Random Ran = new Random();

        Dessin = DrawPanel.CreateGraphics();
        AutoImage = new Bitmap(DrawPanel.Width, DrawPanel.Height);
        grImage = Graphics.FromImage(AutoImage);

        SolidBrush pinceau = new SolidBrush(Color.Blue);
        Pen myPen = new Pen(Color.Blue, 2);
        Font myfont = new Font("Verdana", 8, FontStyle.Bold);

        DrawPanel.Refresh();
        //Dessin.PixelOffsetMode = PixelOffsetMode.HighQuality;
        Dessin.SmoothingMode = SmoothingMode.AntiAlias;
        grImage.SmoothingMode = SmoothingMode.AntiAlias;

        Pen inipen = new Pen(Color.Coral, 5);
        inipen.CustomEndCap = new AdjustableArrowCap(3, 3, false);

        if (!DessinChanged)
            if (fix)
            {
                myPointArray = new Point[10];
                int[] TabX = new int[8];
                for (int i = 0; i < 8; i++)
                {
                    TabX[i] = (int)i * ((DrawPanel.Width - 40) / 7);
                }
                int[] TabY = new int[5];
                for (int i = 0; i < 5; i++)
                {
                    TabY[i] = (int)i * ((DrawPanel.Height - 28) / 4);
                }

                #region myPointArray
                myPointArray[0] = new Point(TabX[4], TabY[0]);
                myPointArray[1] = new Point(TabX[0], TabY[2]);
                myPointArray[2] = new Point(TabX[7], TabY[2]);
                myPointArray[3] = new Point(TabX[5], TabY[3]);
                myPointArray[4] = new Point(TabX[5], TabY[1]);
                myPointArray[5] = new Point(TabX[2], TabY[3]);
                myPointArray[6] = new Point(TabX[3], TabY[0]);
                myPointArray[7] = new Point(TabX[4], TabY[4]);
                myPointArray[8] = new Point(TabX[2], TabY[1]);
                myPointArray[9] = new Point(TabX[3], TabY[4]);
                #endregion

            }
            else
            {
                myPointArray = new Point[this.S];
                //les restes sont calculés
                double alpha = (Math.PI * 2) / this.S;
                for (int i = 0; i < this.S; i++)
                {
                    myPointArray[i] = new Point((int)((Math.Cos((i - 1) * alpha) * (DrawPanel.Width / 2.75)) + DrawPanel.Width / 2.2), (int)((Math.Sin((i - 1) * alpha) * 90) + 100));

                }

            }

        if (this.S > 10)
            DrawPanel.BackColor = Color.Red;
        for (int i = 0; (i < this.S); i++)
        {
            Point p = myPointArray[i];
            Dessin.DrawEllipse(myPen, p.X, p.Y, 30, 30);
            grImage.DrawEllipse(myPen, p.X, p.Y, 30, 30);

            if (this.S0 == i) //etat ititial
            {

                Dessin.DrawLine(inipen, p.X - 40, p.Y + 5, p.X - 10, p.Y + 10);
                grImage.DrawLine(inipen, p.X - 40, p.Y + 5, p.X - 10, p.Y + 10);
            }
            if (this.F.Contains(i)) //etat final
            {
                grImage.DrawEllipse(myPen, p.X + 2, p.Y + 2, 30 - 4, 30 - 4);
                Dessin.DrawEllipse(myPen, p.X + 2, p.Y + 2, 30 - 4, 30 - 4);
            }

            for (int j = 0; (j < this.S) & (j < 10); j++)
            {

                String CsTran = "";
                if (this.getType() != TYPE.Gfa)
                    foreach (char car in this.X)
                    {
                        if (this.getType() == TYPE.Dfa)
                        {
                            if (((Dfa)this).getInstruction(i, car) == j)
                            {
                                CsTran += ((CsTran.Length == 0) ? (car.ToString()) : ("/" + car.ToString()));
                            }
                        }
                        else
                        {
                            if (((Automata)this).getInstruction(i, car).Contains(j))
                            {
                                CsTran += ((CsTran.Length == 0) ? (car.ToString()) : ("/" + car.ToString()));
                            }

                        }

                    }
                else
                    foreach (Object MotObj in ((Gfa)this).Read)
                    {
                        string Mot = MotObj.ToString();
                        if (((Gfa)this).getInstruction(i, Mot).Contains(j))
                        {
                            CsTran += ((CsTran.Length == 0) ? (Mot.ToString()) : ("/" + Mot));
                        }

                    }

                #region //DrawTransition(i, j, CsTran);
                AdjustableArrowCap Fleche = new AdjustableArrowCap(5, 5, true);
                Pen FlechePen = new Pen(Color.Red, 2);
                FlechePen.CustomEndCap = Fleche;
                if (CsTran.Length != 0)       // il existe une transition de Si vers Sj
                {
                    Point p1 = myPointArray[i];
                    Point p2 = myPointArray[j];

                    Point t1 = new Point();
                    Point t2 = new Point();
                    Point t3 = new Point();
                    Point t4 = new Point();

                    /*if (p2.X < p1.X)
                    {
                        t2.X = p1.X;
                        t1.X = p2.X + 30;
                        t3.X = t4.X = ((t1.X + t2.X) / 2) - (20 * i);
                    }
                    else {
                        t2.X = p1.X + 30;
                        t1.X = p2.X;
                        t3.X = t4.X = ((t1.X + t2.X) / 2) + (20 * i);

                    }

                    if (p2.Y < p1.Y)
                    {
                        t2.Y = p1.Y + 15;
                        t1.Y = p2.Y + 15;
                        t3.Y = t4.Y = ((t1.Y + t2.Y) / 2) - (20 * i);
                    }
                    else
                    {
                        t2.Y = p1.Y + 15;
                        t1.Y = p2.Y + 15;
                        t3.Y = t4.Y = ((t1.Y + t2.Y) / 2) + (20 * i);
                    }

                    Dessin.DrawBezier(FlechePen,t1,t3 ,t4,t2);
                     */

                    if (p2 != p1)
                    {

                        Dessin.DrawBezier(FlechePen, p1.X + ((p1.X > p2.X) ? (0) : (30)), p1.Y + 10 + (2 * i), ((p2.X + p1.X) / 2), ((6 * p1.Y + p2.Y) / 7) - 40 + Ran.Next(80), (p2.X + p1.X) / 2, ((6 * p1.Y + p2.Y) / 7) - 40 + Ran.Next(80), p2.X + ((p1.X > p2.X) ? (30) : (0)), p2.Y + 10 + +(2 * i));
                        Dessin.DrawString(CsTran, myfont, pinceau, ((p2.X + p1.X) / 2), (4 * p1.Y + p2.Y) / 5);
                        grImage.DrawBezier(FlechePen, p1.X + ((p1.X > p2.X) ? (0) : (30)), p1.Y + 10 + (2 * i), ((p2.X + p1.X) / 2), ((6 * p1.Y + p2.Y) / 7) - 40 + Ran.Next(80), (p2.X + p1.X) / 2, ((6 * p1.Y + p2.Y) / 7) - 40 + Ran.Next(80), p2.X + ((p1.X > p2.X) ? (30) : (0)), p2.Y + 10 + +(2 * i));
                        grImage.DrawString(CsTran, myfont, pinceau, ((p2.X + p1.X) / 2), (4 * p1.Y + p2.Y) / 5);

                    }
                    else //Si -> Si
                    {

                        Dessin.DrawBezier(FlechePen, p1.X, p1.Y + 15, p1.X + 2, p1.Y + 60, p1.X + 25, p1.Y + 60, p1.X + 30, p1.Y + 15);
                        Dessin.DrawString(CsTran, myfont, pinceau, p1.X + 15, p1.Y + 30);

                        grImage.DrawBezier(FlechePen, p1.X, p1.Y + 15, p1.X + 2, p1.Y + 60, p1.X + 25, p1.Y + 60, p1.X + 30, p1.Y + 15);
                        grImage.DrawString(CsTran, myfont, pinceau, p1.X + 15, p1.Y + 30);
                    }

                }
                SolidBrush Fill = new SolidBrush(Color.White);
                Dessin.FillEllipse(Fill, p.X + 3, p.Y + 3, 30 - 6, 30 - 6);
                Dessin.DrawString("S" + i, myfont, pinceau, (p.X + 5), (p.Y + 8));

                grImage.FillEllipse(Fill, p.X + 3, p.Y + 3, 30 - 6, 30 - 6);
                grImage.DrawString("S" + i, myfont, pinceau, (p.X + 5), (p.Y + 8));

                #endregion
            }

        }

        //DrawPanel.Refresh();
    }
 private void setTextAndRefresh(System.Windows.Forms.Control ctrl, string txt)
 {
     ctrl.Text = txt;
     ctrl.Refresh();
 }