Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BarcodeWriterToolItem"/> class.
        /// </summary>
        /// <param name="visualTool">The visual tool.</param>
        /// <param name="text">The action text.</param>
        /// <param name="toolTip">The action tool tip.</param>
        /// <param name="icon">The action icon.</param>
        /// <param name="subactions">The sub-actions of the action.</param>
        public BarcodeWriterToolAction(
            BarcodeWriterTool visualTool,
            string text,
            string toolTip,
            Image icon,
            params VisualToolAction[] subactions)
            : base(visualTool, text, toolTip, icon, subactions)
        {
#if !REMOVE_BARCODE_SDK
            visualTool.WriterSettings.Barcode     = BarcodeType.Code128;
            visualTool.WriterSettings.PixelFormat = BarcodeImagePixelFormat.Bgra32;
            visualTool.WriterSettings.Value       = "0123456789";
            visualTool.WriterSettings.Padding     = 4;
            visualTool.Rectangle = new Rectangle(0, 0, 120, 40);
            visualTool.WriterSettings.Changed += new EventHandler(WriterSettings_Changed);
#endif
        }
Beispiel #2
0
        /// <summary>
        /// Updates barcode image.
        /// </summary>
        private void WriterSettings_Changed(object sender, EventArgs e)
        {
#if !REMOVE_BARCODE_SDK
            if (_barcodeWriterToolForm == null)
            {
                return;
            }
            BarcodeWriterToolForm form = _barcodeWriterToolForm as BarcodeWriterToolForm;
            try
            {
                BarcodeWriterTool tool = (BarcodeWriterTool)VisualTool;
                using (VintasoftImage barcodeImage = tool.GetBarcodeImage())
                {
                    form.BarcodeImage = barcodeImage.GetAsBitmap();
                }
            }
            catch (WriterSettingsException)
            {
                form.BarcodeImage = null;
            }
#endif
        }