Exemplo n.º 1
0
        public void UpdateLayout(int total, int finish, int nofinish, int width1, int height1, bool delay = false)
        {
            this.Width  = width1;
            this.Height = height1;

            lbltotalkmqty.Text  = total.ToString();
            lblfinishkmqty.Text = finish.ToString();
            lblnofinkmqty.Text  = nofinish.ToString();

            //设置各控件的大小
            int titleH   = Convert.ToInt16(height1 * 1 / 6);
            int templayH = Convert.ToInt16(height1 * 5 / 6 / 3);
            int tempW    = width1 * 5 / 8;
            int tempR    = width1 * 3 / 8;

            Vendorlab.Height = titleH;

            lbltotalkm.Top    = titleH;
            lbltotalkm.Height = templayH;
            lbltotalkm.Width  = tempW;

            lbltotalkmqty.Top    = titleH;
            lbltotalkmqty.Left   = tempW;
            lbltotalkmqty.Height = templayH;
            lbltotalkmqty.Width  = tempR;

            lblfinishkm.Top    = titleH + templayH;
            lblfinishkm.Height = templayH;
            lblfinishkm.Width  = tempW;

            lblfinishkmqty.Top    = titleH + templayH;
            lblfinishkmqty.Left   = tempW;
            lblfinishkmqty.Height = templayH;
            lblfinishkmqty.Width  = tempR;

            lblnofinkm.Top    = titleH + templayH * 2;
            lblnofinkm.Height = templayH;
            lblnofinkm.Width  = tempW;

            lblnofinkmqty.Top    = titleH + templayH * 2;
            lblnofinkmqty.Left   = tempW;
            lblnofinkmqty.Height = templayH;
            lblnofinkmqty.Width  = tempR;

            float fontsize = CoolFont.FitStringRect("0" + Venodrstr + "0", Vendorlab.Font, Vendorlab.CreateGraphics(), new Rectangle(0, 0, width1, titleH));

            Vendorlab.Font = new Font("微软雅黑", fontsize, FontStyle.Bold, GraphicsUnit.Point);

            fontsize         = CoolFont.FitStringRect("KM种类数量_总数总数", this.lbltotalkm.Font, this.lbltotalkm.CreateGraphics(), new Rectangle(0, 0, tempW, templayH));
            lbltotalkm.Font  = new Font("微软雅黑", fontsize, FontStyle.Bold, GraphicsUnit.Point);
            lblfinishkm.Font = new Font("微软雅黑", fontsize, FontStyle.Bold, GraphicsUnit.Point);
            lblnofinkm.Font  = new Font("微软雅黑", fontsize, FontStyle.Bold, GraphicsUnit.Point);

            fontsize            = CoolFont.FitStringRect("99", this.lbltotalkmqty.Font, this.lbltotalkmqty.CreateGraphics(), new Rectangle(0, 0, tempR, templayH));
            lbltotalkmqty.Font  = new Font("微软雅黑", fontsize, FontStyle.Bold, GraphicsUnit.Point);
            lblfinishkmqty.Font = new Font("微软雅黑", fontsize, FontStyle.Bold, GraphicsUnit.Point);
            lblnofinkmqty.Font  = new Font("微软雅黑", fontsize, FontStyle.Bold, GraphicsUnit.Point);

            Setbackcolor(total, finish, nofinish, delay);
        }
Exemplo n.º 2
0
        public void setLayout(string name, int mywidth, int myheight, bool IsShowName = true)
        {
            //考虑的货架标签的高度
            //if(IsShowName == true)
            {
                myheight += lblname.Height / 2;
            }

            //把datagridview每行的误差把整个控件的高度改变
            int yushu = (myheight - lblname.Height) % rowcount;

            myheight -= yushu;

            layout(name, mywidth, myheight, IsShowName);

            //数据行高度
            rowh = (int)((myheight - lblname.Height) / rowcount);
            this.dgv.RowTemplate.Height = rowh;

            //网格线颜色
            this.dgv.GridColor = Color.LightGray;

            dgv.DataSource      = null; //加快数据绑定的速度
            this.dgv.DataSource = rackdt.DefaultView;

            //列宽
            colw = (int)((mywidth - 1) / colcount);
            for (int i = 0; i < colcount; i++)
            {
                this.dgv.Columns[i].Width = colw;
            }
            //最后一列的宽度
            this.dgv.Columns[colcount - 1].Width = mywidth - (colcount - 1) * colw - 1;

            float fontsize = 10;

            //设定字体的大小
            if (IsShowRawName == false)
            {
                fontsize = CoolFont.FitStringRect("Q2-10-9", dgv.DefaultCellStyle.Font, dgv.CreateGraphics(), new Rectangle(0, 0, colw, rowh));
            }
            else
            {
                fontsize = CoolFont.FitStringRect("KM500094471", dgv.DefaultCellStyle.Font, dgv.CreateGraphics(), new Rectangle(0, 0, colw, rowh));
            }
            dgv.DefaultCellStyle.Font = new Font("微软雅黑", fontsize, FontStyle.Bold, GraphicsUnit.Point);

            //标注已有原材料库位
            MarkSelectRack();
        }
Exemplo n.º 3
0
        //为单显设置datagridview的字体大小
        private void SetSingleShowFormatforDataGridView()
        {
            if (this.chkbigfont.Checked)
            {
                int panelw = 0;
                int f1w    = 0;
                int f2w    = 0;
                int f3w    = 0;
                int fh     = dgv.Height - 32;
                int ffcw   = 1000;
                fh = (int)(fh / maxrow);      //单显时控制最大行数为10

                dgv.SetDataGridViewTheme2(false, false, "No", false, false, 32, fh, false, true, false);

                int fontsize = (int)CoolFont.FitStringRect("KM500094471", dgv.DefaultCellStyle.Font, dgv.CreateGraphics(), new Rectangle(0, 0, ffcw, fh));
                DataCellStyle2.Font  = new Font("微软雅黑", fontsize, FontStyle.Bold, GraphicsUnit.Point);
                dgv.DefaultCellStyle = DataCellStyle2;

                SizeF sf = CoolFont.GetStringSize("KM500094479", dgv.DefaultCellStyle.Font, dgv.CreateGraphics());
                f1w = (int)sf.Width + 5;
                sf  = CoolFont.GetStringSize("YL-18-2", dgv.DefaultCellStyle.Font, dgv.CreateGraphics());
                f2w = (int)sf.Width + 5;
                sf  = CoolFont.GetStringSize("500", dgv.DefaultCellStyle.Font, dgv.CreateGraphics());
                f3w = (int)sf.Width + 5;

                panelw = f1w + f2w + f3w;
                this.splitContainer1.SplitterDistance = panelw + 20;
                this.panel3.Width = panelw + 18;
                dgv.Width         = panelw + 17;

                SetDataGridViewBase(this.dgv);
                ShowInfoInDataGridView();
            }
            else
            {
                this.splitContainer1.SplitterDistance = 284;
                this.dgv.SetDataGridViewTheme2(false, false, "No", false, false, 32, 25, false, true, false);
                this.dgv.DefaultCellStyle = DataCellStyle1;
                SetDataGridViewBase(this.dgv);
                ShowInfoInDataGridView();
            }
        }
Exemplo n.º 4
0
        //显示所有的货架
        public void ShowRacks()
        {
            try
            {
                lblLayoutname.Left = (int)(this.Width * titlex);
                lblLayoutname.Top  = (int)(this.Height * titley);
                float lblfontsize = CoolFont.FitStringRect(lblLayoutname.Text, lblLayoutname.Font, this.CreateGraphics(), new Rectangle(0, 0, (int)(this.Width * titlewidth), (int)(this.Height * titleheight)));
                lblLayoutname.Font = new Font(lblLayoutname.Font.Name, lblfontsize, FontStyle.Bold, GraphicsUnit.Point);

                foreach (string rackname in racknamelist)
                {
                    ShowRack(rackname);
                }

                foreach (string name in walllist)
                {
                    ShowWall(name);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }