Example #1
0
        private void lbProductTypes_SelectedIndexChanged(object sender, EventArgs e)
        {
            int selectedIndex = this.lbProductTypes.SelectedIndex;

            if (selectedIndex < 0)
            {
                return;
            }
            string  type = (string)this.lbProductTypes.Items[selectedIndex];
            DataRow dr   = MemoryTable.getSpecifiedProductConfigInfo(type);

            if (dr != null)
            {
                this.txtProductType.Text = type;
                //DataRow dr = dt.Rows[0];
                string productName = (string)dr["productName"];
                string width       = dr["width"].ToString();
                string height      = dr["height"].ToString();
                string mincount    = dr["minCount"].ToString();
                this.txtProductName.Text = productName;
                this.numHeight.Value     = int.Parse(height);
                this.numWidth.Value      = int.Parse(width);
                this.txtMinCount.Text    = mincount;
                this.txtDescription.Text = (string)dr["description"];
                try
                {
                    productWidth  = int.Parse(width);
                    productHeight = int.Parse(height);
                    minCount      = int.Parse(mincount);

                    red   = int.Parse(dr["red"].ToString());
                    green = int.Parse(dr["green"].ToString());
                    blue  = int.Parse(dr["blue"].ToString());
                    Color color = Color.FromArgb(red, green, blue);
                    this.btnShowColor.BackColor = color;

                    this.picName = dr["picname"].ToString();
                    string path     = PublicConfig.staticClass.PicturePath + picName;
                    Image  newImage = null;
                    try
                    {
                        Stream s = File.Open(path, FileMode.Open);
                        pictureBox1.Image = Image.FromStream(s);
                        s.Close();
                        //newImage = Image.FromFile(path);
                        //newImage = (Image)newImage.Clone();
                    }
                    catch
                    {
                    }
                    //this.pictureBox1.Image = newImage;
                    this.pictureBox1.Width  = (int)this.numWidth.Value;
                    this.pictureBox1.Height = (int)this.numHeight.Value;
                }
                catch
                {
                }
            }
        }
        private void lbProductTypes_SelectedIndexChanged(object sender, EventArgs e)
        {
            int selectedIndex = this.lbProductTypes.SelectedIndex;

            if (selectedIndex < 0)
            {
                return;
            }
            string    type = (string)this.lbProductTypes.Items[selectedIndex];
            DataTable dt   = MemoryTable.getSpecifiedProductConfigInfo(type);

            if (dt != null && dt.Rows.Count > 0)
            {
                this.txtProductType.Text = type;
                DataRow dr          = dt.Rows[0];
                string  productName = (string)dr["PRODUCTNAME"];
                string  width       = dr["WIDTH"].ToString();
                string  height      = dr["HEIGHT"].ToString();
                string  mincount    = dr["MINCOUNT"].ToString();
                this.txtProductName.Text = productName;
                this.txtWidth.Text       = width;
                this.txtHeight.Text      = height;
                this.txtMinCount.Text    = mincount;
                try
                {
                    productWidth  = int.Parse(width);
                    productHeight = int.Parse(height);
                    minCount      = int.Parse(mincount);

                    red   = int.Parse(dr["RED"].ToString());
                    green = int.Parse(dr["GREEN"].ToString());
                    blue  = int.Parse(dr["BLUE"].ToString());
                    Color color = Color.FromArgb(red, green, blue);
                    this.btnShowColor.BackColor = color;

                    this.picName = dr["PICNAME"].ToString();
                    string path     = PublicConfig.staticClass.PicturePath + picName;
                    Image  newImage = null;
                    try
                    {
                        newImage = Image.FromFile(path);
                    }
                    catch
                    {
                    }
                    this.pictureBox1.Image = newImage;
                }
                catch
                {
                }
            }
        }