Example #1
0
        public void SetZone(IOcrPage ocrPage, int zoneIndex, bool isVisible, bool isNameVisible)
        {
            _ocrPage   = ocrPage;
            _zoneIndex = zoneIndex;

            IsVisible         = isVisible;
            mylabel.IsVisible = isNameVisible;

            if (_ocrPage != null && _zoneIndex >= 0 && _zoneIndex < _ocrPage.Zones.Count)
            {
                OcrZone zone = _ocrPage.Zones[_zoneIndex];
                if (string.IsNullOrEmpty(zone.Name))
                {
                    mylabel.Text = "Zone " + (_zoneIndex + 1).ToString();
                }
                else
                {
                    mylabel.Text = zone.Name;
                }

                if (zone.ZoneType == OcrZoneType.None || zone.ZoneType == OcrZoneType.Graphic || zone.ZoneType == OcrZoneType.Barcode)
                {
                    RasterColor color = RasterColorConverter.FromColor(Color.FromArgb(32, Color.Yellow));
                    this.Fill   = AnnSolidColorBrush.Create(color.ToString());//Color.FromArgb(32, Color.Yellow)
                    this.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), new LeadLengthD(1));
                }
                else
                {
                    this.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Red"), new LeadLengthD(1));
                }
            }
        }
Example #2
0
        private void _pnlPalette_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            for (int i = 0; i < Palette.Length; i++)
            {
                if (GetColorRectangle(i).Contains(e.X, e.Y))
                {
                    RasterColor color = Palette[i];
                    _lblCurrentColor.BackColor = Converters.ToGdiPlusColor(color);
                    Color foreColor = Color.FromArgb(
                        (byte)((color.R + 128) % 256),
                        (byte)((color.G + 128) % 256),
                        (byte)((color.B + 128) % 256));
                    _lblCurrentColor.ForeColor = foreColor;
                    _lblCurrentColor.Text      = string.Format(DemosGlobalization.GetResxString(GetType(), "Resx_Index") + " = {0} : {1}", i, color.ToString());
                    return;
                }
            }

            if (_lblCurrentColor.BackColor != SystemColors.Control)
            {
                _lblCurrentColor.BackColor = SystemColors.Control;
            }
            if (_lblCurrentColor.ForeColor != SystemColors.ControlText)
            {
                _lblCurrentColor.BackColor = SystemColors.ControlText;
            }
            if (_lblCurrentColor.Text != string.Empty)
            {
                _lblCurrentColor.Text = string.Empty;
            }
        }