示例#1
0
        public ControlCritere(List <CritereGenerique> listC)
        {
            this.Dock = DockStyle.Fill;



            Signe inferieur = new Signe("≤", -1);
            Signe egal      = new Signe("=", 0);
            Signe superieur = new Signe("≥", 1);

            this.listSigne = new List <Signe>();
            this.listSigne.Add(inferieur);
            this.listSigne.Add(egal);
            this.listSigne.Add(superieur);



            //Constrution du tableLayout main
            this.tableLayoutPanelMain             = new TableLayoutPanel();
            this.tableLayoutPanelMain.ColumnCount = 2;
            this.tableLayoutPanelMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F));
            this.tableLayoutPanelMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));

            this.tableLayoutPanelMain.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.tableLayoutPanelMain.Location = new System.Drawing.Point(5, 5);
            this.tableLayoutPanelMain.Margin   = new System.Windows.Forms.Padding(5);
            this.tableLayoutPanelMain.Name     = "tableLayoutPanelCrit1";
            this.tableLayoutPanelMain.RowCount = 1;
            this.tableLayoutPanelMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tableLayoutPanelMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 41F));
            this.tableLayoutPanelMain.Size     = new System.Drawing.Size(302, 41);
            this.tableLayoutPanelMain.TabIndex = 0;


            //Construction du bouton ajouter ou supprimer
            this.button                            = new Button();
            this.button.Anchor                     = AnchorStyles.Left;
            this.button.BackColor                  = System.Drawing.SystemColors.Menu;
            this.button.BackgroundImage            = global::IHM.Properties.Resources.delete;
            this.button.BackgroundImageLayout      = System.Windows.Forms.ImageLayout.Zoom;
            this.button.Cursor                     = System.Windows.Forms.Cursors.Hand;
            this.button.FlatAppearance.BorderColor = System.Drawing.Color.White;
            this.button.FlatAppearance.BorderSize  = 0;
            this.button.FlatStyle                  = System.Windows.Forms.FlatStyle.Flat;
            this.button.Location                   = new System.Drawing.Point(8, 0);
            this.button.Margin                     = new System.Windows.Forms.Padding(8, 0, 0, 0);
            this.button.Size                       = new System.Drawing.Size(25, 25);
            this.button.UseVisualStyleBackColor    = false;
            this.button.Click                     += new System.EventHandler(this.button_Click);

            //Construction du premier panel
            this.panelCrit           = new Panel();
            this.panelCrit.BackColor = System.Drawing.SystemColors.ControlLight;
            this.panelCrit.Dock      = System.Windows.Forms.DockStyle.Fill;
            this.panelCrit.Location  = new System.Drawing.Point(43, 3);
            this.panelCrit.Name      = "panelCrit1";
            this.panelCrit.Size      = new System.Drawing.Size(256, 35);

            // Ajouter panel et le boutton au tlpanelmain
            this.tableLayoutPanelMain.Controls.Add(this.button, 0, 0);
            this.tableLayoutPanelMain.Controls.Add(this.panelCrit, 1, 0);

            //Contruction du tableLayoutPanelCrit
            this.tableLayoutPanelCrit             = new TableLayoutPanel();
            this.tableLayoutPanelCrit.ColumnCount = 3;
            this.tableLayoutPanelCrit.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 65F));
            this.tableLayoutPanelCrit.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 35F));
            this.tableLayoutPanelCrit.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35F));
            this.tableLayoutPanelCrit.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.tableLayoutPanelCrit.Location = new System.Drawing.Point(0, 0);
            this.tableLayoutPanelCrit.RowCount = 1;
            this.tableLayoutPanelCrit.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tableLayoutPanelCrit.Size     = new System.Drawing.Size(256, 35);
            this.tableLayoutPanelCrit.TabIndex = 0;

            //Combobox crit
            this.comboBoxCrit                   = new ComboBox();
            this.comboBoxCrit.Anchor            = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.comboBoxCrit.DropDownStyle     = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxCrit.FormattingEnabled = true;
            this.comboBoxCrit.Location          = new System.Drawing.Point(3, 7);
            this.comboBoxCrit.Size              = new System.Drawing.Size(137, 21);
            this.comboBoxCrit.TabIndex          = 0;
            this.comboBoxCrit.DataSource        = listC;

            //Combobox signe
            this.comboBoxSign                   = new ComboBox();
            this.comboBoxSign.Anchor            = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.comboBoxSign.DropDownStyle     = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxSign.FormattingEnabled = true;
            this.comboBoxSign.Location          = new System.Drawing.Point(143, 7);
            this.comboBoxSign.Margin            = new System.Windows.Forms.Padding(0);
            this.comboBoxSign.Size              = new System.Drawing.Size(35, 21);
            this.comboBoxSign.DataSource        = this.listSigne;

            //Textbox crit
            this.texBoxCrit          = new TextBox();
            this.texBoxCrit.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.texBoxCrit.Location = new System.Drawing.Point(181, 7);
            this.texBoxCrit.Size     = new System.Drawing.Size(72, 20);

            //Ajouter les tb et cb dans le tb
            this.tableLayoutPanelCrit.Controls.Add(this.comboBoxCrit, 0, 0);
            this.tableLayoutPanelCrit.Controls.Add(this.comboBoxSign, 1, 0);
            this.tableLayoutPanelCrit.Controls.Add(this.texBoxCrit, 2, 0);

            this.panelCrit.Controls.Add(this.tableLayoutPanelCrit);
            this.Controls.Add(this.tableLayoutPanelMain);
        }
示例#2
0
        /// <summary>
        /// Convertit un Float32 IEEE 754 en double
        /// </summary>
        /// <param name="FloatValue">(string) Float32 a convertir</param>
        /// <returns>(double) nombre convertit</returns>
        public static double Float322Double(string FloatValue)
        {
            string BinVal;
            string Signe;
            string Expo;
            string Mant;

            double DecExpo;

            double j;

            string EntPart;
            string FracPart;
            double ValEntPart;
            double ValFracPart;
            double FinalValue;

            if (FloatValue.Equals("80000000") | FloatValue.Equals("00000000"))
            {
                return(0);
            }

            //Conversion en binaire
            BinVal = Hex2Bin(FloatValue);

            //Verfication 32 bits présent
            if (BinVal.Length < 32)
            {
                while (BinVal.Length < 32)
                {
                    BinVal = "0" + BinVal;
                }
            }

            //Lecture du signe, de l'exposant et de la mantisse
            Signe = BinVal.Substring(0, 1);
            Expo  = BinVal.Substring(1, 8);
            Mant  = BinVal.Substring(9, 23);

            //Calcul de l'exposant
            DecExpo = Bin2Dec(Expo) - 127;

            //Calcul de la valeur decimale
            if (DecExpo > 1) //Valeur finale supérieure à 1
            {
                EntPart  = "1" + Mant.Substring(0, (int)DecExpo);
                FracPart = Mant.Substring((int)DecExpo, (int)(23 - DecExpo));

                //Partie entière
                ValEntPart = Bin2Dec(EntPart);

                //Partie decimale
                ValFracPart = 0;
                j           = 0.5;
                for (int i = 0; i < FracPart.Length; i++)
                {
                    ValFracPart = ValFracPart + Convert.ToDouble(FracPart.Substring(i, 1)) * j;
                    j           = j / 2;
                }
            }
            else //Valeur finale inférieure à 1
            {
                ValEntPart  = 0;
                ValFracPart = 0;
                FracPart    = "1" + Mant;

                j = 1;
                for (int i = 0; i < FracPart.Length; i++)
                {
                    ValFracPart = ValFracPart + Convert.ToDouble(FracPart.Substring(i, 1)) * j;
                    j           = j / 2;
                }

                ValFracPart = ValFracPart * Math.Pow(2, DecExpo);
            }

            FinalValue = ValEntPart + ValFracPart;

            //Affectation du signe
            if (Signe.Equals("1"))
            {
                FinalValue = FinalValue * -1;
            }

            return(FinalValue);
        }