Esempio n. 1
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Occurs when the element is rendered.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">A <see cref="CustomDrawElementCustomDrawEventArgs"/> that contains the event data.</param>
        public void OnRenderCustomDrawElement(object sender, CustomDrawElementCustomDrawEventArgs e)
        {
            Code39ExtendedSymbology symbology = customDrawElement.Tag as Code39ExtendedSymbology;

            if (symbology != null)
            {
                symbology.Render(e.DrawingContext, new Point(0, 0), customDrawElement.RenderSize);
            }
        }
Esempio n. 2
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // NON-PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Renders the bar code.
        /// </summary>
        private void RenderToDrawingContext()
        {
            Code39ExtendedSymbology symbology = new Code39ExtendedSymbology();

            symbology.ValueDisplayStyle = this.ValueDisplayStyle;
            symbology.Value             = this.Value;
            customDrawElement.Tag       = symbology;

            Size desiredSize = symbology.MeasureDesiredSize(new Size(double.PositiveInfinity, double.PositiveInfinity));

            customDrawElement.Width  = desiredSize.Width;
            customDrawElement.Height = desiredSize.Height;
            customDrawElement.InvalidateVisual();
        }