Пример #1
0
        IList <byte[]> IBarcodeGeneratorService.GetBarcodesBytes(BarcodesRequest barcodesRequest)
        {
            IList <byte[]> list = new List <byte[]>();

            barcodesRequest.Contents.ToList().ForEach(x =>
            {
                var bytes = BarCodeHelper.GetBarcodeImage(new BarcodeRequest()
                {
                    BackgroundColor = barcodesRequest.BackgroundColor,
                    ForegroundColor = barcodesRequest.ForegroundColor,
                    BarcodeType     = barcodesRequest.BarcodeType,
                    Height          = barcodesRequest.Height,
                    Width           = barcodesRequest.Width,
                    Margin          = barcodesRequest.Margin,
                    Content         = new BarcodeContent()
                    {
                        Content     = x.Content,
                        DisplayText = x.DisplayText
                    },
                    ImageFormat = barcodesRequest.ImageFormat
                });

                list.Add(bytes);
            });

            return(list);
        }
        public HCSWF_dialog_container(SortedList scanCodes, SortedList sl_Check, CnasHCSWorkflowInterface workflowServer, string pd_code, SortedList sL_parametertmp02, DataTable dtpartvalue, SortedList sL_parametersinfo)
            : base(scanCodes)

        {
            _sl_Check          = sl_Check;
            _sL_parametertmp02 = sL_parametertmp02;
            _pdcode            = pd_code;
            _sL_parametersinfo = sL_parametersinfo;
            _dtpartvalue       = dtpartvalue;
            Logger             = Logger ?? LogManager.GetLogger("CnasWNSClient");

            InitializeComponent();
            ControlViewBase viewBase = WorkFlowDialogGenerator.Instance.GeneratorWFDialog(PdCode);

            if (viewBase != null)
            {
                _workFlowView          = viewBase;
                DialogResultStatus     = viewBase.IsShown ? 1 : 0;
                _workFlowView.Sl_check = this._sl_Check;
                _workFlowView.Dock     = DockStyle.Fill;
                infoPanel.Controls.Add(viewBase);
                infoPanel.SetRow(viewBase, 0);
                _workFlowView.PdCode         = PdCode;
                _workFlowView.ScanBarCodes   = ScanBarCodes;
                _workFlowView.WorkflowServer = workflowServer as WorkflowArithmeticClass;
                if (ViewData.ContainsKey("UserInfo") && ViewData["UserInfo"] is UserBase)
                {
                    viewBase.UserInfo = ViewData["UserInfo"] as UserBase;
                }
                else
                {
                    UserBase userInfo = UserBaseHelper.GetUserByBarCode(BarCodeHelper.GetBarCodeByType("BCB", ScanBarCodes));
                    if (userInfo != null)
                    {
                        ViewData.Add("UserInfo", userInfo);
                        viewBase.UserInfo = userInfo;
                    }
                    else
                    {
                        Logger.Error(string.Format("Can not get user info. User barCode:{0}", BarCodeHelper.GetBarCodeByType("BCB", ScanBarCodes)));
                    }
                }
                MinimumSize = new Size((int)(_workFlowView.Width + mainPanel.ColumnStyles[1].Width + 100),
                                       viewBase.Height + 180);
            }
            else
            {
                DialogResultStatus = 0;
            }
            confirmBtn.Height  = buttonGroup.ItemHeight - 3;
            buttonPanel.Height = confirmBtn.Margin.Top + confirmBtn.Margin.Bottom + confirmBtn.Height * 2 +
                                 cancelBtn.Margin.Top + cancelBtn.Margin.Bottom;
            cancelBtn.Height           = confirmBtn.Height;
            confirmBtn.BackgroundImage = BarCodeHelper.GetBarcodeImage(_okBarCode, "确  认", confirmBtn.Width, confirmBtn.Height);
            cancelBtn.BackgroundImage  = BarCodeHelper.GetBarcodeImage(_closeBarCode, "关  闭", cancelBtn.Width, cancelBtn.Height);
        }
        private void OnButtonGroupDrawItem(object sender, DrawItemEventArgs e)
        {
            ListBox buttonGroup = sender as ListBox;

            if (buttonGroup != null && buttonGroup.Items != null)
            {
                if (buttonGroup.Items.Count > 0)
                {
                    Dictionary <string, string> item = buttonGroup.Items[e.Index] as Dictionary <string, string>;
                    if (item != null)
                    {
                        Rectangle bound = e.Bounds;

                        Rectangle imageBound = new Rectangle(bound.X + buttonGroup.Margin.Horizontal - 1,
                                                             e.Bounds.Y,
                                                             buttonGroup.Width, buttonGroup.ItemHeight - 3);

                        //if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
                        //{
                        //	e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.Bounds);
                        //}
                        //else
                        //{
                        //	e.Graphics.FillRectangle(Brushes.Beige, e.Bounds);
                        //}
                        e.Graphics.FillRectangle(Brushes.White, e.Bounds);
                        e.Graphics.DrawLine(Pens.DarkGray, bound.X, bound.Y, bound.X + bound.Width, bound.Y);
                        //Rectangle titleBounds = new Rectangle(bound.X + buttonGroup.Margin.Horizontal,
                        //  e.Bounds.Y + buttonGroup.Margin.Top,
                        //  e.Bounds.Width - buttonGroup.Margin.Right - buttonGroup.Margin.Horizontal,
                        //  (int)e.Font.GetHeight() + 2);

                        if (item.ContainsKey("op_barCode") && item.ContainsKey("op_name"))
                        {
                            Image itemImage = BarCodeHelper.GetBarcodeImage(item["op_barCode"], item["op_name"], imageBound.Width, imageBound.Height);
                            e.Graphics.DrawImage(itemImage, imageBound);
                            //e.Graphics.DrawString(item["op_name"], e.Font, Brushes.Black, titleBounds);
                        }
                        else if (item.ContainsKey("op_ico"))
                        {
                        }

                        e.DrawFocusRectangle();
                    }
                }
            }
        }
Пример #4
0
        private void AutoImage(SortedList indata)
        {
            selectPanel.Controls.Clear();
            int int_Y = 15;

            for (int i = 0; i < indata.Count; i++)
            {
                if (i > 5)
                {
                    return;        //最多允许排列5个按钮;
                }
                PictureBox pic_tmp = new PictureBox();
                pic_tmp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
                pic_tmp.Location        = new System.Drawing.Point(1, int_Y);
                pic_tmp.Name            = indata.GetKey(i).ToString();
                pic_tmp.Size            = new System.Drawing.Size(180, 80);
                pic_tmp.TabStop         = false;
                pic_tmp.BackgroundImage = BarCodeHelper.GetBarcodeImage(indata.GetKey(i).ToString(), indata.GetByIndex(i).ToString());
                pic_tmp.Click          += new System.EventHandler(this.BCX_Click);
                selectPanel.Controls.Add(pic_tmp);
                int_Y = int_Y + 90;
            }
        }
Пример #5
0
 byte[] IBarcodeGeneratorService.GetBarcodeBytes(BarcodeRequest barcodeRequest)
 {
     return(BarCodeHelper.GetBarcodeImage(barcodeRequest));
 }