Esempio n. 1
0
        //Image mainBackGroundImage;
        public frmMainForm()
        {
            byte i = 0;
            PrivateDataEncode pde = new PrivateDataEncode();

            myConn = new OleDbConnection();
            myCom  = new OleDbCommand();

            myCom.CommandText       = "Select M_ID, M_Name, M_Type, M_Description From tblMasterInfor ORDER BY M_Type";
            myCom.Connection        = myConn;
            myConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Data.mdb;Jet OLEDB:Database Password=whatthehellisgoingon";
            try{
                myConn.Open();
            }catch (Exception e)
            {
                MessageBox.Show(ERROR_WHILE_LOADING_DATABASE + e.Message.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Dispose();
                Application.Exit();
            }
            myReader = myCom.ExecuteReader();
            System.ComponentModel.ComponentResourceManager resources1 = new System.ComponentModel.ComponentResourceManager(typeof(frmMainForm));
            InitializeComponent();
            if (myReader.HasRows)
            {
                while (myReader.Read())
                {
                    this.tbTmp4LoadDynamic          = new System.Windows.Forms.ToolStripButton();
                    this.tbTmp4LoadDynamic.Overflow = ToolStripItemOverflow.Never;
                    if (myReader.GetByte(2) == frmAddNewMasterItem.ENUM_INTEGER_CATOGERY_DIAGNOSIS)
                    {
                        try{
                            this.tbTmp4LoadDynamic.Image = Image.FromFile(Application.StartupPath + @"\image\diagnosis.bmp");
                        }catch (System.IO.FileNotFoundException) {}
                    }
                    else if (myReader.GetByte(2) == frmAddNewMasterItem.ENUM_INTEGER_CATOGERY_TREATMENT)
                    {                                                                                                         //treatment
                        try{
                            this.tbTmp4LoadDynamic.Image = Image.FromFile(Application.StartupPath + @"\image\treatment.bmp"); //career.bmp
                        }catch (System.IO.FileNotFoundException) {}
                    }
                    else
                    {
                        try{
                            this.tbTmp4LoadDynamic.Image = Image.FromFile(Application.StartupPath + @"\image\career.bmp");
                        }catch (System.IO.FileNotFoundException) {}
                    }
                    //this.tbTmp4LoadDynamic.Image = ((System.Drawing.Image)(resources.GetObject("mnuBtnPatientRecord.Image")));
                    this.tbTmp4LoadDynamic.ImageAlign            = System.Drawing.ContentAlignment.MiddleLeft;
                    this.tbTmp4LoadDynamic.ImageScaling          = System.Windows.Forms.ToolStripItemImageScaling.None;
                    this.tbTmp4LoadDynamic.ImageTransparentColor = System.Drawing.Color.Magenta;
                    this.tbTmp4LoadDynamic.Name                  = "tb" + myReader.GetValue(0).ToString();
                    this.tbTmp4LoadDynamic.Size                  = new System.Drawing.Size(90, 40);
                    this.tbTmp4LoadDynamic.TextAlign             = System.Drawing.ContentAlignment.MiddleRight;
                    this.tbTmp4LoadDynamic.Click                += new System.EventHandler(this.DynamicToolBarClick);
                    this.tbTmp4LoadDynamic.ImageTransparentColor = System.Drawing.Color.Magenta;
                    this.tbTmp4LoadDynamic.DisplayStyle          = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText;
                    this.tbTmp4LoadDynamic.Text                  = myReader.GetString(1);
                    this.tbTmp4LoadDynamic.TextImageRelation     = System.Windows.Forms.TextImageRelation.ImageBeforeText;
                    this.tbTmp4LoadDynamic.DoubleClick          += new EventHandler(DynamicToolBarClick);
                    sepTmp      = new ToolStripSeparator();
                    sepTmp.Name = "auto" + i++.ToString();
                    sepTmp.Size = new System.Drawing.Size(6, 1);
                    this.tbMainToolBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { sepTmp, tbTmp4LoadDynamic });
                }        //	myReader.Read()
            }            //myReader.HasRows
            myReader.Close();

            this.frmMainForm_SizeChanged(null, null);
        }
Esempio n. 2
0
        //Image mainBackGroundImage;
        public frmMainForm()
        {
            byte i =0;
            PrivateDataEncode pde = new PrivateDataEncode();
            myConn = new OleDbConnection();
            myCom = new OleDbCommand();

            myCom.CommandText="Select M_ID, M_Name, M_Type, M_Description From tblMasterInfor ORDER BY M_Type";
            myCom.Connection = myConn;
            myConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Data.mdb;Jet OLEDB:Database Password=whatthehellisgoingon";
            try{
                myConn.Open();
            }catch(Exception e)
            {
                MessageBox.Show(ERROR_WHILE_LOADING_DATABASE + e.Message.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Dispose();
                Application.Exit();
            }
            myReader = myCom.ExecuteReader();
            System.ComponentModel.ComponentResourceManager resources1 = new System.ComponentModel.ComponentResourceManager(typeof(frmMainForm));
            InitializeComponent();
            if (myReader.HasRows)
            {
                while (myReader.Read())
                {
                    this.tbTmp4LoadDynamic = new System.Windows.Forms.ToolStripButton();
                    this.tbTmp4LoadDynamic.Overflow = ToolStripItemOverflow.Never;
                    if (myReader.GetByte(2) ==frmAddNewMasterItem.ENUM_INTEGER_CATOGERY_DIAGNOSIS)
                    {
                        try{
                            this.tbTmp4LoadDynamic.Image = Image.FromFile(Application.StartupPath + @"\image\diagnosis.bmp");
                        }catch(System.IO.FileNotFoundException){}
                    }else if (myReader.GetByte(2) ==frmAddNewMasterItem.ENUM_INTEGER_CATOGERY_TREATMENT)
                    {//treatment
                        try{
                            this.tbTmp4LoadDynamic.Image = Image.FromFile(Application.StartupPath + @"\image\treatment.bmp");//career.bmp
                        }catch(System.IO.FileNotFoundException){}
                    }else
                    {
                        try{
                            this.tbTmp4LoadDynamic.Image = Image.FromFile(Application.StartupPath + @"\image\career.bmp");
                        }catch(System.IO.FileNotFoundException){}
                    }
                    //this.tbTmp4LoadDynamic.Image = ((System.Drawing.Image)(resources.GetObject("mnuBtnPatientRecord.Image")));
                    this.tbTmp4LoadDynamic.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
                    this.tbTmp4LoadDynamic.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
                    this.tbTmp4LoadDynamic.ImageTransparentColor = System.Drawing.Color.Magenta;
                    this.tbTmp4LoadDynamic.Name = "tb" +myReader.GetValue(0).ToString();
                    this.tbTmp4LoadDynamic.Size = new System.Drawing.Size(90, 40);
                    this.tbTmp4LoadDynamic.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
                    this.tbTmp4LoadDynamic.Click += new System.EventHandler(this.DynamicToolBarClick);
                    this.tbTmp4LoadDynamic.ImageTransparentColor = System.Drawing.Color.Magenta;
                    this.tbTmp4LoadDynamic.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText;
                    this.tbTmp4LoadDynamic.Text = myReader.GetString(1);
                    this.tbTmp4LoadDynamic.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
                    this.tbTmp4LoadDynamic.DoubleClick += new EventHandler(DynamicToolBarClick);
                    sepTmp = new ToolStripSeparator();
                    sepTmp.Name = "auto" + i++.ToString();
                    sepTmp.Size = new System.Drawing.Size(6, 1);
                    this.tbMainToolBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[]{sepTmp, tbTmp4LoadDynamic});
                }//	myReader.Read()
            }//myReader.HasRows
            myReader.Close();

            this.frmMainForm_SizeChanged(null, null);
        }