コード例 #1
0
        public void SetZone(Page ocrPage, int zoneIndex, bool isVisible, bool isNameVisible)
        {
            _ocrPage   = ocrPage;
            _zoneIndex = zoneIndex;

            IsVisible         = isVisible;
            mylabel.IsVisible = isNameVisible;

            if (_ocrPage != null && _zoneIndex >= 0 && _zoneIndex < _ocrPage.Fields.Count)
            {
                Field zone = _ocrPage.Fields[_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));
            }
        }
コード例 #2
0
        void fillPropertyInfo_ValueChanged(object oldValue, object newValue)
        {
            if (newValue != null)
            {
                if (_annObject != null)
                {
                    AnnHiliteObject annHiliteObject = _annObject as AnnHiliteObject;
                    if (annHiliteObject != null)
                    {
                        annHiliteObject.HiliteColor = (string)newValue;

                        if (OnPropertyChanged != null)
                        {
                            OnPropertyChanged("HiliteColor", newValue);
                        }
                    }
                    else
                    {
                        AnnBrush newFill = AnnSolidColorBrush.Create((string)newValue);
                        _annObject.Fill = newFill;

                        if (OnPropertyChanged != null)
                        {
                            OnPropertyChanged("Fill", newFill);
                        }
                    }
                }
            }
        }
 // Adds extra data and updates to automation object
 private static void UpdateAutomationObject(AnnAutomationObject automationObject)
 {
     if (automationObject.ObjectTemplate != null && automationObject.ObjectTemplate.SupportsFill && automationObject.ObjectTemplate.Fill == null)
     {
         automationObject.ObjectTemplate.Fill = AnnSolidColorBrush.Create("transparent");
     }
 }
コード例 #4
0
        private void UpdatePen()
        {
            if (!_annObj.SupportsStroke)
            {
                _penWidth.Value = 1;

                _lblPenColor.BackColor = Color.Red;
                //_cmbDashStyle.SelectedIndex = (int)AnnStrokeLineCap.Flat;
            }
            else
            {
                if (_annObj.Stroke != null)
                {
                    _penWidth.Value = (int)_annObj.Stroke.StrokeThickness.Value;
                    AnnSolidColorBrush CurrentBrush = _annObj.Stroke.Stroke as AnnSolidColorBrush;
                    _lblPenColor.BackColor = Color.FromName(CurrentBrush.Color);
                }
                else
                {
                    _penWidth.Value        = 1;
                    _lblPenColor.BackColor = Color.Red;
                    _chkUsePen.Checked     = false;
                }
                //_cmbDashStyle.SelectedIndex = (int)_annObj.Stroke.StrokeDashCap;
            }
        }
コード例 #5
0
 private void UpdateBrush()
 {
     if (!_annObj.SupportsFill)
     {
         if (_annObj is AnnHiliteObject)
         {
             _lblBrushColor.BackColor = Color.FromName(((AnnHiliteObject)_annObj).HiliteColor);
         }
         else
         {
             _lblBrushColor.BackColor = Color.Red;
         }
     }
     else
     {
         if (((AnnSolidColorBrush)_annObj.Fill == null))
         {
             _annObj.Fill             = AnnSolidColorBrush.Create("Transparent");
             _lblBrushColor.BackColor = Color.FromName(((AnnSolidColorBrush)_annObj.Fill).Color.ToString());
             _chkUseBrush.Checked     = false;
         }
         else
         {
             _lblBrushColor.BackColor = Color.FromName(((AnnSolidColorBrush)_annObj.Fill).Color.ToString());
         }
     }
 }
コード例 #6
0
ファイル: ViewerControl.cs プロジェクト: sakpung/webstudy
        AnnAutomationObject CreateZoneAutomationObject()
        {
            AnnAutomationObject  automationObj        = new AnnAutomationObject();
            ZoneAnnotationObject zoneAnnotationObject = new ZoneAnnotationObject();

            AnnAutomationObject rectAutomationObject = GetAutomationObject(_annAutomationManager, AnnObject.RectangleObjectId);
            AnnRectangleObject  rectObject           = rectAutomationObject.ObjectTemplate as AnnRectangleObject;

            zoneAnnotationObject.Stroke = rectObject.Stroke != null?rectObject.Stroke.Clone() as AnnStroke : null;

            zoneAnnotationObject.Fill = rectObject.Fill != null?rectObject.Fill.Clone() as AnnBrush : null;

            zoneAnnotationObject.CellPen = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), new LeadLengthD(1));

            automationObj.Id               = AnnObject.UserObjectId;
            automationObj.Name             = zoneAnnotationObject.FriendlyName;
            automationObj.ObjectTemplate   = zoneAnnotationObject;
            automationObj.DrawDesignerType = rectAutomationObject.DrawDesignerType;
            automationObj.EditDesignerType = typeof(ZoneAnnotationObjectEditDesigner);
            automationObj.RunDesignerType  = rectAutomationObject.RunDesignerType;
            automationObj.DrawCursor       = rectAutomationObject.DrawCursor;

            // Disable the rotation points
            automationObj.UseRotateThumbs = false;
            return(automationObj);
        }
コード例 #7
0
        private void AddAnnotationRectangle(MedicalViewerSubCell subCell)
        {
            AnnRectangleObject rect = new AnnRectangleObject();

            rect.IsVisible = false;
            rect.Stroke    = AnnStroke.Create(AnnSolidColorBrush.Create("Red"), LeadLengthD.Create(5));
            subCell.AnnotationContainer.Children.Add(rect);
        }
コード例 #8
0
 void strokePropertyInfo_ValueChanged(object oldValue, object newValue)
 {
     _annStroke.Stroke = AnnSolidColorBrush.Create((string)newValue);
     if (OnValueChanged != null)
     {
         OnValueChanged(oldValue, newValue);
     }
 }
コード例 #9
0
        public override void Render(AnnContainerMapper mapper, AnnObject annObject)
        {
            if (mapper == null)
            {
                ExceptionHelper.ArgumentNullException("mapper");
            }
            if (annObject == null)
            {
                ExceptionHelper.ArgumentNullException("annObject");
            }

            IAnnDrawEngine engine = RenderingEngine as IAnnDrawEngine;

            if (engine != null)
            {
                base.Render(mapper, annObject);

                AnnIntersectionPointObject annIntersectionPointObject = annObject as AnnIntersectionPointObject;
                if (annIntersectionPointObject != null)
                {
                    int count = annIntersectionPointObject.Points.Count;
                    if (count < 2)
                    {
                        return;
                    }

                    LeadPointD[] leadPoints = mapper.PointsFromContainerCoordinates(annIntersectionPointObject.Points.ToArray(), annIntersectionPointObject.FixedStateOperations);

                    if (annIntersectionPointObject.SupportsStroke && annIntersectionPointObject.Stroke != null)
                    {
                        AnnStroke stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), annIntersectionPointObject.Stroke.StrokeThickness);
                        stroke.StrokeDashArray = new double[] { 3, 1, 1, 1, 1, 1 }; // DashDotDot

                        IAnnDrawPen pen = engine.ToPen(mapper.StrokeFromContainerCoordinates(stroke, annIntersectionPointObject.FixedStateOperations), annIntersectionPointObject.Opacity);
                        try
                        {
                            if (leadPoints.Length > 2)
                            {
                                LeadPointD intersectionPoint = annIntersectionPointObject.IntersectionPoint;
                                intersectionPoint = mapper.PointFromContainerCoordinates(intersectionPoint, annIntersectionPointObject.FixedStateOperations);

                                double radius = mapper.LengthFromContainerCoordinates(annIntersectionPointObject.IntersectionPointRadius, annIntersectionPointObject.FixedStateOperations);
                                DrawPoint(annIntersectionPointObject, engine, intersectionPoint, radius);

                                if (leadPoints.Length < 5 && annIntersectionPointObject.IntersectionInsideContainer)
                                {
                                    engine.DrawLine(pen, leadPoints[3], intersectionPoint);
                                }
                            }
                        }
                        finally
                        {
                            engine.Destroy(pen);
                        }
                    }
                }
            }
        }
コード例 #10
0
        public AnnotationPropertiesDialog(MedicalViewerMultiCell cell)
        {
            InitializeComponent();
            _cell = cell;

            _annObj = _cell.Automation.CurrentEditObject;

            if (!_annObj.SupportsStroke)
            {
                _tabAnnProperties.TabPages.Remove(_penTab);
            }
            if (!_annObj.SupportsFill && !(_annObj is AnnHiliteObject))
            {
                _tabAnnProperties.TabPages.Remove(_brushTab);
            }
            if (!_annObj.SupportsFont)
            {
                _tabAnnProperties.TabPages.Remove(_fontTab);
            }

            _chkUsePen.Checked = _annObj.SupportsStroke;

            _chkUseBrush.Checked = _annObj.SupportsFill | (_annObj is AnnHiliteObject);

            if (_annObj is AnnHiliteObject)
            {
                _chkUseBrush.Visible = false;
                _brushTab.Text       = "Hilite";
            }

            //if (_annObj.SupportsStroke)
            //{
            //   foreach (AnnStrokeLineCap dash in (AnnStrokeLineCap[])Enum.GetValues(typeof(AnnStrokeLineCap)))
            //   {
            //      _cmbDashStyle.Items.Add(dash.ToString());
            //   }
            //}
            //else
            //   _cmbDashStyle.Enabled = false;

            if (_annObj.SupportsFont)
            {
                AnnTextObject AnnTempText = _annObj as AnnTextObject;
                AnnFont       objFont     = _annObj.Font;
                _annFont           = new AnnFont(objFont.FontFamilyName.ToString(), objFont.FontSize);
                _annFont.FontStyle = objFont.FontStyle;
                AnnSolidColorBrush CurrentBrush = AnnTempText.TextForeground as AnnSolidColorBrush;
                _fontColor = Color.FromName(CurrentBrush.Color);
            }

            UpdateFont();
            UpdateBrush();
            UpdatePen();
        }
コード例 #11
0
        private void AddFusionEditRectangle(MedicalViewerSubCell subCell)
        {
            AnnRectangleObject rect = new AnnRectangleObject();

            rect.IsVisible = false;
            rect.Stroke    = AnnStroke.Create(AnnSolidColorBrush.Create("Red"), LeadLengthD.Create(5));
            subCell.AnnotationContainer.Children.Add(rect);
            //rect.RotateGripper = new LeadLengthD(1);

            _cell.AnnotationPrecedency = true;
        }
コード例 #12
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(AnnBrush))
            {
                AnnSolidColorBrush solidColorBrush = new AnnSolidColorBrush();
                solidColorBrush.Color = ColorTranslator.ToHtml((Color)value);
                return(solidColorBrush);
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
コード例 #13
0
        private void InitAutomationManager()
        {
            _annManager = new AnnAutomationManager();

            _annManager.CreateDefaultObjects();
            List <AnnAutomationObject> objectsToRemove = new List <AnnAutomationObject>();

            foreach (AnnAutomationObject obj in _annManager.Objects)
            {
                if (Enum.GetName(typeof(AnnObjects), obj.Id) == null)
                {
                    objectsToRemove.Add(obj);
                }
            }

            foreach (AnnAutomationObject obj in objectsToRemove)
            {
                _annManager.Objects.Remove(obj);
            }
            _automationHelper = new AutomationManagerHelper(_annManager);
            _automationHelper.CreateToolBar();
            if (_annManager.RenderingEngine != null)
            {
                _annManager.RenderingEngine.LoadPicture += RenderingEngine_LoadPicture;
            }

            _automationHelper.ToolBar.Dock       = DockStyle.Right;
            _automationHelper.ToolBar.Appearance = ToolBarAppearance.Flat;
            _automationHelper.ToolBar.AutoSize   = false;
            _automationHelper.ToolBar.Visible    = true;
            _automationHelper.ToolBar.BringToFront();

            this.Controls.Add(_automationHelper.ToolBar);

            foreach (AnnAutomationObject obj in _annManager.Objects)
            {
                obj.UseRotateThumbs = true;
                if (obj.ObjectTemplate != null && obj.ObjectTemplate.SupportsStroke)
                {
                    //obj.Object.Pen = new AnnPen(Color.White, new AnnLength(1));
                }
            }

            _automation = new AnnAutomation(_annManager, _viewer);

            _automation.EditText += new EventHandler <AnnEditTextEventArgs>(automation_EditText);

            //Change AnnText to use Pen
            LeadLengthD         annLength  = new LeadLengthD(1);
            AnnAutomationObject annAutText = _automation.Manager.FindObjectById((int)AnnObjects.TextObjectId);

            annAutText.ObjectTemplate.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Red"), annLength);
            _automation.Active = true;
        }
コード例 #14
0
ファイル: Form1.cs プロジェクト: jjzaab/LTCustomAnnotation
        void scEngine_CaptureInformation(object sender, ScreenCaptureInformationEventArgs e)
        {
            e.Image.XResolution = e.Image.YResolution = 300;
            AnnAutomationObject customAnn   = annAutomationManager.FindObjectById(AnnObject.StampObjectId);
            AnnStampObject      customStamp = (AnnStampObject)customAnn.ObjectTemplate;

            customStamp.Text = " ";

            customStamp.Fill    = null;
            customStamp.Stroke  = AnnStroke.Create(AnnSolidColorBrush.Create("Red"), LeadLengthD.Create(0));;
            customStamp.Picture = new AnnPicture(RasterImageConverter.ConvertToImage(e.Image, ConvertToImageOptions.None));
        }
コード例 #15
0
ファイル: MainForm.cs プロジェクト: sakpung/webstudy
        AnnRectangleObject CreateRectangle(LeadRectD rect, AnnBrush brush, AnnLayer layer)
        {
            AnnRectangleObject annRectObject = new AnnRectangleObject();

            annRectObject.Rect          = rect;
            annRectObject.Fill          = brush;
            annRectObject.Stroke.Stroke = AnnSolidColorBrush.Create("yellow");
            _automation.Container.Children.Add(annRectObject);
            layer.Children.Add(annRectObject);

            return(annRectObject);
        }
コード例 #16
0
ファイル: MainForm.cs プロジェクト: sakpung/webstudy
        void CreateDefaultLayers()
        {
            string[] layers = new string[] { "Red", "Green", "Blue" };

            LeadRectD rect = new LeadRectD(LeadPointD.Create(860, 700), LeadPointD.Create(5200, 1850));

            foreach (string layer in layers)
            {
                CreateRectangle(rect, AnnSolidColorBrush.Create(layer), CreateLayer(string.Format("{0} Layer", layer)));
                rect.Offset(360, 360);
            }
        }
コード例 #17
0
        public AnnNorbergObject()
        {
            SetId(-1008);

            this.Labels["FirstAngle"]  = new AnnLabel();
            this.Labels["SecondAngle"] = new AnnLabel();

            this.Labels["AngleText"].Background = AnnSolidColorBrush.Create("white");
            this.Labels["AngleText"].Foreground = AnnSolidColorBrush.Create("blue");

            this.Labels["FirstRulerLength"].IsVisible  = false;
            this.Labels["SecondRulerLength"].IsVisible = false;
        }
コード例 #18
0
ファイル: AnnMedicalPack.cs プロジェクト: sakpung/webstudy
        private AnnThumbStyle CreateLocationThumbStyle()
        {
            AnnThumbStyle locationThumbStyle = new AnnRectangleThumbStyle();

            double thumbSize = ThumbSize;

            locationThumbStyle.Size   = LeadSizeD.Create(thumbSize, thumbSize);
            locationThumbStyle.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("black"), LeadLengthD.Create(1));

            locationThumbStyle.Fill = AnnSolidColorBrush.Create("lightblue");

            return(locationThumbStyle);
        }
コード例 #19
0
ファイル: AnnMedicalPack.cs プロジェクト: sakpung/webstudy
        private AnnThumbStyle CreateRotateGripperThumbStyle()
        {
            AnnThumbStyle rotateGripperThumbStyle = new AnnEllipseThumbStyle();

            double thumbSize = ThumbSize;

            rotateGripperThumbStyle.Size   = LeadSizeD.Create(thumbSize, thumbSize);
            rotateGripperThumbStyle.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("black"), LeadLengthD.Create(1));

            rotateGripperThumbStyle.Fill = AnnSolidColorBrush.Create("lightgreen");

            return(rotateGripperThumbStyle);
        }
コード例 #20
0
        private void _okButton_Click(object sender, EventArgs e)
        {
            if (IsSnaptoGridDirty)
            {
                // Set Stoke Color Value
                _snapToGridOptions.GridStroke.Stroke = AnnSolidColorBrush.Create(ColorTranslator.ToHtml(_gridColorColorPicker.Color));

                // Set Stoke Style Value
                if (_lineStyleComboBox.SelectedIndex == 0)
                {
                    _snapToGridOptions.GridStroke.StrokeDashArray = null;
                }
                else
                {
                    _snapToGridOptions.GridStroke.StrokeDashArray = new double[] { 4, 4 }
                };

                // Set Show Grid Value
                _snapToGridOptions.ShowGrid = _showGridCheckBox.Checked;

                // Set Enable Snap Value
                _snapToGridOptions.EnableSnap = _enableSnapCheckBox.Checked;

                // Set Line Spacing Value.
                int gridLength = _snapToGridOptions.GridLength;
                int.TryParse(_gridLengthTextBox.Text, out gridLength);
                if (gridLength < 5 || gridLength > 999)
                {
                    MessageBox.Show("Grid Length must be between 5 and 999.");
                    _gridLengthTextBox.Text = _snapToGridOptions.GridLength.ToString();
                    return;
                }
                _snapToGridOptions.GridLength = gridLength;

                // Set Line Spacing Value.
                int lineSpacing = _snapToGridOptions.LineSpacing;
                int.TryParse(_lineSpacingTextBox.Text, out lineSpacing);
                if (lineSpacing < 1 || lineSpacing > 100)
                {
                    MessageBox.Show("Line Spacing must be between 1 and 100.");
                    _lineSpacingTextBox.Text = _snapToGridOptions.LineSpacing.ToString();
                    return;
                }
                _snapToGridOptions.LineSpacing = lineSpacing;

                _automation.Manager.SnapToGridOptions = _snapToGridOptions.Clone() as AnnSnapToGridOptions;
            }

            this.Close();
        }
    }
コード例 #21
0
        public ZoneAnnotationObject() :
            base()
        {
            _ocrPage   = null;
            _zoneIndex = 0;
            _cellPen   = null;
            SetId(AnnObject.UserObjectId);

            mylabel                 = this.Labels["AnnObjectName"];
            mylabel.Background      = AnnSolidColorBrush.Create("Black");
            mylabel.Foreground      = AnnSolidColorBrush.Create("White");
            mylabel.RestrictionMode = AnnLabelRestriction.None;
            mylabel.IsVisible       = true;
        }
コード例 #22
0
        void textBackgroundPropertyInfo_ValueChanged(object oldValue, object newValue)
        {
            AnnTextObject annTextObject = _annObject as AnnTextObject;

            if (annTextObject != null)
            {
                AnnBrush newBrush = AnnSolidColorBrush.Create((string)newValue);
                annTextObject.TextBackground = newBrush;

                if (OnPropertyChanged != null)
                {
                    OnPropertyChanged("TextBackground", newBrush);
                }
            }
        }
コード例 #23
0
        private void _btnApply_Click(object sender, EventArgs e)
        {
            if (_chkUsePen.Checked)
            {
                GetColor(_lblPenColor.BackColor);
                _annObj.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create(GetColor(_lblPenColor.BackColor)), LeadLengthD.Create((double)_penWidth.Value));//, AnnUnit.Pixel));
                if (_annObj is AnnPolyRulerObject)
                {
                    AnnPolyRulerObject polyRulerObject = (AnnPolyRulerObject)_annObj;

                    polyRulerObject.TickMarksStroke = _annObj.Stroke;
                }
            }
            else
            {
                _annObj.Stroke = null;
            }

            if (_chkUseBrush.Checked)
            {
                if (_annObj is AnnHiliteObject)
                {
                    ((AnnHiliteObject)_annObj).HiliteColor = GetColor(_lblBrushColor.BackColor);
                }
                else
                {
                    _annObj.Fill = AnnSolidColorBrush.Create(GetColor(_lblBrushColor.BackColor));
                }
            }
            else
            {
                _annObj.Fill = null;
            }

            if (_annFont != null)
            {
                if (!_annFont.Equals(_annObj.Font))
                {
                    _annObj.Font = _annFont;
                }

                AnnTextObject textObject = (AnnTextObject)_annObj;

                textObject.TextForeground = AnnSolidColorBrush.Create(GetColor(_fontColor));
            }

            _cell.RefreshAnnotation();
        }
コード例 #24
0
        private void DrawPoint(AnnMidlineObject annObject, Graphics context, PointF point, double radius)
        {
            LeadRectD  pointBounds = new LeadRectD(point.X - radius, point.Y - radius, radius * 2, radius * 2);
            LeadPointD topLeft     = pointBounds.TopLeft;
            LeadPointD topRight    = pointBounds.TopRight;
            LeadPointD bottomLeft  = pointBounds.BottomLeft;
            LeadPointD bottomRight = pointBounds.BottomRight;

            using (Pen pen = AnnWinFormsRenderingEngine.ToPen(AnnStroke.Create(AnnSolidColorBrush.Create("blue"), annObject.Stroke.StrokeThickness), annObject.Opacity))
            {
                context.DrawLine(pen, new PointF((float)topLeft.X, (float)topLeft.Y), new PointF((float)bottomRight.X, (float)bottomRight.Y));
                context.DrawLine(pen, new PointF((float)bottomLeft.X, (float)bottomLeft.Y), new PointF((float)topRight.X, (float)topRight.Y));
                context.DrawLine(pen, new PointF((float)point.X, (float)(point.Y - pointBounds.Width / 2)), new PointF((float)point.X, (float)(point.Y + pointBounds.Width / 2)));
                context.DrawLine(pen, new PointF((float)point.X - (float)pointBounds.Width / 2, (float)(point.Y)), new PointF((float)point.X + (float)pointBounds.Width / 2, (float)(point.Y)));
            }
        }
コード例 #25
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is AnnHatchBrush)
            {
                return((value as AnnHatchBrush).HatchStyle.ToString());
            }

            AnnSolidColorBrush solidBrush = value as AnnSolidColorBrush;

            if (solidBrush != null)
            {
                return(ColorTranslator.FromHtml(solidBrush.Color));
            }
            else
            {
                return(Color.FromKnownColor(KnownColor.Transparent));
            }
        }
コード例 #26
0
        public AnnSolidColorBrushEditor(AnnSolidColorBrush annSolidColorBrush, string category, string propertyName, string displayName)
        {
            _annSolidColorBrush = annSolidColorBrush;
            _category           = category;

            AnnPropertyInfo info;

            if (annSolidColorBrush != null)
            {
                info = new AnnPropertyInfo(propertyName, false, annSolidColorBrush.Color, category, "Color", displayName, true, typeof(AnnColorEditor));
            }
            else
            {
                info = new AnnPropertyInfo(propertyName, false, "transparent", category, "Color", displayName, true, typeof(AnnColorEditor));
            }

            info.ValueChanged        += new AnnObjectEditorValueChangedHandler(info_ValueChanged);
            _properties[propertyName] = info;
        }
コード例 #27
0
        // Adds extra data to the automation object like context menu, cursors and toolbar image
        private static void UpdateAutomationObject(AnnAutomationObject automationObject)
        {
            if (automationObject.DrawCursor == null)
            {
                automationObject.DrawCursor = GetAutomationObjectCursor(automationObject.Id);
            }

            // Set the automation object toolbar image
            if (automationObject.ToolBarImage == null)
            {
                automationObject.ToolBarImage = GetAutomationObjectToolBarImage(automationObject.Id);
            }

            if (automationObject.ObjectTemplate != null && automationObject.ObjectTemplate.SupportsFill && automationObject.ObjectTemplate.Fill == null)
            {
                automationObject.ObjectTemplate.Fill = AnnSolidColorBrush.Create(Color.Transparent.Name);
            }

            // Set the automation object tooltip
            automationObject.ToolBarToolTipText = automationObject.Name;
            switch (automationObject.Id)
            {
            case AnnObject.EncryptObjectId:
                automationObject.ContextMenu = new EncryptContextMenu();
                break;

            case AnnObject.RedactionObjectId:
                automationObject.ContextMenu = new RedactionContextMenu();
                break;

            case AnnObject.PolyRulerObjectId:
            case AnnObject.ProtractorObjectId:
            case AnnObject.CrossProductObjectId:
            case AnnObject.RulerObjectId:
                automationObject.ContextMenu = new CalibrateContextMenu();
                break;

            default:
                automationObject.ContextMenu = new ObjectContextMenu();
                break;
            }
        }
コード例 #28
0
ファイル: BatesStampDialog.cs プロジェクト: sakpung/webstudy
        private void _btnChangeFont_Click(object sender, EventArgs e)
        {
            using (FontDialog fontDialog = new FontDialog())
            {
                fontDialog.ShowColor = true;
                fontDialog.Font      = _lblBatesText.Font;
                fontDialog.Color     = _lblBatesText.ForeColor;

                if (fontDialog.ShowDialog() == DialogResult.OK)
                {
                    _lblBatesText.Font      = fontDialog.Font;
                    _lblBatesText.ForeColor = fontDialog.Color;

                    Font font = _lblBatesText.Font;
                    _currentBatesStamp.Font       = AnnWinFormsRenderingEngine.FromFont(font);
                    _currentBatesStamp.Logo.Font  = AnnWinFormsRenderingEngine.FromFont(font);
                    _currentBatesStamp.Foreground = AnnSolidColorBrush.Create(_lblBatesText.ForeColor.Name);
                }

                UpdateControls();
            }
        }
コード例 #29
0
        void strokePropertyInfo_ValueChanged(object oldValue, object newValue)
        {
            string    color     = newValue as string;
            AnnStroke newStroke = null;

            newStroke = _annObject.Stroke.Clone();
            if (color == null)
            {
                newStroke.StrokeThickness = LeadLengthD.Create(double.Parse(newValue.ToString()));
            }
            else
            {
                newStroke.Stroke = AnnSolidColorBrush.Create(color);
            }

            _annObject.Stroke = newStroke.Clone();

            if (OnPropertyChanged != null)
            {
                OnPropertyChanged("Stroke", newStroke);
            }
        }
コード例 #30
0
        private void DrawPoint(AnnMidlineObject annObject, IAnnDrawEngine engine, LeadPointD point, double radius)
        {
            LeadRectD  pointBounds = new LeadRectD(point.X - radius, point.Y - radius, radius * 2, radius * 2);
            LeadPointD topLeft     = pointBounds.TopLeft;
            LeadPointD topRight    = pointBounds.TopRight;
            LeadPointD bottomLeft  = pointBounds.BottomLeft;
            LeadPointD bottomRight = pointBounds.BottomRight;

            IAnnDrawPen pen = engine.ToPen(AnnStroke.Create(AnnSolidColorBrush.Create("blue"), annObject.Stroke.StrokeThickness), annObject.Opacity);

            try
            {
                engine.DrawLine(pen, topLeft, bottomRight);
                engine.DrawLine(pen, bottomLeft, topRight);
                engine.DrawLine(pen, new LeadPointD(point.X, (point.Y - pointBounds.Width / 2)), new LeadPointD(point.X, (point.Y + pointBounds.Width / 2)));
                engine.DrawLine(pen, new LeadPointD(point.X - pointBounds.Width / 2, point.Y), new LeadPointD(point.X + pointBounds.Width / 2, point.Y));
            }
            finally
            {
                engine.Destroy(pen);
            }
        }