Ejemplo n.º 1
0
        /// <summary>
        /// 显示所有
        /// </summary>
        private void DoButtonClick()
        {
            this.splashScreenManager.ShowWaitForm();
            this.splashScreenManager.SetWaitFormCaption("请稍后,正在加载中....");        // 标题
            this.splashScreenManager.SetWaitFormDescription("正在初始化.....");       // 信息
            MianLiaochoose.page = 1;
            DataTable dt        = ImpService.GetMianLiao(this.textBox1.Text, MianLiaochoose.page);

            this.panel1.Controls.Clear();
            height = 0;
            width  = 0;
            int i = 0;

            panelLocition = new PanelLocition(this.panel1.Width, this.panel1.Height, dt.Rows.Count);
            foreach (DataRow dr in dt.Rows)
            {
                MianLiaoCard oc = new MianLiaoCard(this);
                //oc.label1.Text = ImpService.SqritBySymbol(dr["mianliao"].ToString(), 14, "\n");
                oc.label1.Text = dr["mianliao"].ToString();
                oc.mianliao    = dr["mianliao"].ToString();
                oc.mianliaoid  = dr["id"].ToString();
                oc.mianliaocd  = dr["materialCode"].ToString();
                oc.picurl      = dr["picurl"].ToString();
                try
                {
                    //string url = string.Format(@cd.picture, 5, 123456);
                    //string url = string.Format(@"https://sshirtmtmbucket.oss-cn-zhangjiakou.aliyuncs.com/sshirtmtm/ZSF-1-320.jpg?size={0}&content={1}", 5, 123456);

                    /*
                     * System.Net.WebRequest webreq = System.Net.WebRequest.Create(oc.picurl);
                     * System.Net.WebResponse webres = webreq.GetResponse();
                     * using (System.IO.Stream stream = webres.GetResponseStream())
                     * {
                     *  oc.pictureBox1.Image = Image.FromStream(stream);
                     * }*/
                    oc.pictureBox1.Image = Image.FromFile(@"pic\" + dr["picn"].ToString().Trim());
                }
                catch
                {
                }
                this.generateUserControl(oc, i);
                this.panel1.Controls.Add(oc);//将控件加入panel
                //oc.pictureBox1.Click += new EventHandler(this.picture_Click);
                i++;
            }
            this.splashScreenManager.CloseWaitForm();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 下一页
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void xiaye_Button(object sender, EventArgs e)
        {
            this.splashScreenManager.ShowWaitForm();
            this.splashScreenManager.SetWaitFormCaption("请稍后,正在加载中....");        // 标题
            this.splashScreenManager.SetWaitFormDescription("正在初始化.....");       // 信息
            MianLiaochoose.page++;
            DataTable dt = ImpService.GetMianLiao(this.textBox1.Text, MianLiaochoose.page);

            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("已经是最后一页");
                MianLiaochoose.page--;
                dt = ImpService.GetMianLiao(this.textBox1.Text, MianLiaochoose.page);
            }
            this.panel1.Controls.Clear();
            height = 0;
            width  = 0;
            int i = 0;

            panelLocition = new PanelLocition(this.panel1.Width, this.panel1.Height, dt.Rows.Count);
            foreach (DataRow dr in dt.Rows)
            {
                MianLiaoCard oc = new MianLiaoCard(this);
                oc.label1.Text = dr["mianliao"].ToString();
                oc.mianliao    = dr["mianliao"].ToString();
                oc.mianliaoid  = dr["id"].ToString();
                oc.mianliaocd  = dr["materialCode"].ToString();
                oc.picurl      = dr["picurl"].ToString();
                try
                {
                    oc.pictureBox1.Image = Image.FromFile(@"pic\" + dr["picn"].ToString().Trim());
                }
                catch
                {
                }
                this.generateUserControl(oc, i);
                this.panel1.Controls.Add(oc);//将控件加入panel
                //oc.pictureBox1.Click += new EventHandler(this.picture_Click);
                i++;
            }
            this.fenYeLan1.label1.Text = MianLiaochoose.page.ToString();
            this.splashScreenManager.CloseWaitForm();
        }