private void PropertyForm_Load(object sender, EventArgs e) { AnnObject annObject = TifEditor.GetCurrentEditor().AnnAutomation.CurrentEditObject; AnnTextObject obj = annObject as AnnTextObject; if (obj != null && obj.GetType() != typeof(AnnStampObject)) { this.Opacity = 100; InitializeValue(); } else { /* if (obj != null && obj.GetType() == typeof(AnnStampObject)) * { * */ if (obj == null) { MessageBox.Show("The property form is not supported for selected object in this version."); } /* * }*/ this.Close(); } }
void fontPropertyInfo_ValueChanged(object oldValue, object newValue) { AnnTextObject annTextObject = _annObject as AnnTextObject; if (annTextObject != null) { AnnFont newFont = annTextObject.Font.Clone(); string fontFamilyName = newValue as string; if (fontFamilyName == null) { newFont.FontSize = double.Parse(newValue.ToString()); } else { newFont.FontFamilyName = fontFamilyName; } annTextObject.Font = newFont; if (OnPropertyChanged != null) { OnPropertyChanged("Font", newFont); } } }
void automation_ToolTip(object sender, AnnToolTipEventArgs e) { if (e.AnnotationObject != null) { AnnTextObject text = e.AnnotationObject as AnnTextObject; string toolTipText = string.Empty; if (text != null) { toolTipText = text.Text; } else { AnnPolyRulerObject ruler = e.AnnotationObject as AnnPolyRulerObject; if (ruler != null) { if (ruler.MeasurementUnit == AnnUnit.Pixel) { LeadLengthD lengthInUnits = ruler.GetRulerLength(1); double lengthInPixels = Automation.Container.Mapper.LengthFromContainerCoordinates(lengthInUnits, AnnFixedStateOperations.Scrolling | AnnFixedStateOperations.Zooming); toolTipText = string.Format("{0} {1}", Math.Round(lengthInPixels, 2), ruler.UnitsAbbreviation[AnnUnit.Pixel]); } else { toolTipText = ruler.GetRulerLengthAsString(Automation.Container.Mapper.CalibrationScale); } } else { AnnRichTextObject richText = e.AnnotationObject as AnnRichTextObject; if (richText != null) { toolTipText = richText.ToString(); } else { AnnStickyNoteObject stickyNote = e.AnnotationObject as AnnStickyNoteObject; if (stickyNote != null) { toolTipText = stickyNote.Metadata[AnnObject.ContentMetadataKey]; } else { AnnAutomationObject annAutomationObject = MainForm.ManagerHelper.AutomationManager.FindObjectById(e.AnnotationObject.Id); toolTipText = annAutomationObject.Name; } } } } MainForm.ManagerHelper.SetToolTip(_viewer, toolTipText); } else { MainForm.ManagerHelper.SetToolTip(null, string.Empty); } }
private void SetObjectValue() { AnnObject annObject = TifEditor.GetCurrentEditor().AnnAutomation.CurrentEditObject; AnnTextObject obj = annObject as AnnTextObject; if (obj != null) { obj.Text = txtData.Text; } }
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(); }
void text_ValueChanged(object oldValue, object newValue) { AnnTextObject annTextObject = _annObject as AnnTextObject; annTextObject.Text = (string)newValue; if (OnPropertyChanged != null) { OnPropertyChanged("Text", newValue); } }
void wordWrapInfo_ValueChanged(object oldValue, object newValue) { AnnTextObject annTextObject = _annObject as AnnTextObject; if (annTextObject != null) { annTextObject.WordWrap = (bool)newValue; if (OnPropertyChanged != null) { OnPropertyChanged("WordWrap", newValue); } } }
private void ShowPropertyDialog(AnnObject annObject) { if (IsEligible(annObject)) { AnnTextObject textObj = annObject as AnnTextObject; if (textObj != null) { PropertyForm.userData = textObj.Text; editor.AnnAutomation.ShowObjectPropertiesDialog(); textObj.Text = PropertyForm.userData; editor.AnnAutomation.Container.Objects.Add(textObj); editor.AnnAutomation.Viewer.Invalidate(textObj.InvalidRectangle); } } }
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); } } }
void verticalAlignment_ValueChanged(object oldValue, object newValue) { AnnTextObject annTextObject = _annObject as AnnTextObject; if (annTextObject != null) { AnnVerticalAlignment newVerticalAlignment = (AnnVerticalAlignment)Enum.Parse(typeof(AnnVerticalAlignment), (string)this.Properties["VerticalAlignment"].Values[(string)newValue]); annTextObject.VerticalAlignment = newVerticalAlignment; if (OnPropertyChanged != null) { OnPropertyChanged("VerticalAlignment", newVerticalAlignment); } } }
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(); }
void RemoveText() { if (_imageViewer != null && _imageViewer.Controls != null) { foreach (Control control in _imageViewer.Controls) { if (control is TextBox) { AnnTextObject textObject = control.Tag as AnnTextObject; if (textObject != null) { textObject.Text = control.Text; } control.LostFocus -= new EventHandler(text_LostFocus); _imageViewer.Controls.Remove(control); } } } }
public AnnObjectEditor(AnnObject annObject) { _annObject = annObject; if (annObject.SupportsFill && !(annObject is AnnHotspotObject)) { AnnBrush fill = null; AnnHiliteObject annHiliteObject = _annObject as AnnHiliteObject; if (annHiliteObject != null) { fill = AnnSolidColorBrush.Create(annHiliteObject.HiliteColor); } else { fill = annObject.Fill; } AnnPropertyInfo fillPropertyInfo = new AnnPropertyInfo("Color", false, fill, "Fill", "Hilite Color", string.Empty, annObject.SupportsFill, typeof(AnnSolidColorBrushEditor)); fillPropertyInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(fillPropertyInfo_ValueChanged); _properties["Color"] = fillPropertyInfo; } if (annObject.SupportsStroke && !(annObject is AnnHotspotObject)) { AnnPropertyInfo strokePropertyInfo = new AnnPropertyInfo("Stroke", false, annObject.Stroke, "Stroke", "Stroke the object", string.Empty, annObject.SupportsStroke, typeof(AnnStrokeEditor)); strokePropertyInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(strokePropertyInfo_ValueChanged); _properties["Stroke"] = strokePropertyInfo; } if (annObject.SupportsFont) { AnnPropertyInfo fontPropertyInfo = new AnnPropertyInfo(string.Empty, false, annObject.Font, "Font", "Select Font", string.Empty, annObject.SupportsFont, typeof(AnnFontEditor)); fontPropertyInfo.ValueChanged += fontPropertyInfo_ValueChanged; _properties["Font"] = fontPropertyInfo; } AnnPropertyInfo hyperlink = new AnnPropertyInfo(string.Empty, false, annObject.Hyperlink, "Hyperlink", "Hyperlink", "Hyperlink", true, typeof(AnnStringEditor)); hyperlink.ValueChanged += new AnnObjectEditorValueChangedHandler(hyperlink_ValueChanged); _properties["Hyperlink"] = hyperlink; if (annObject.SupportsOpacity) { AnnPropertyInfo opacity = new AnnPropertyInfo(string.Empty, false, annObject.Opacity, "Opacity", "Opacity", "Opacity", true, typeof(AnnDoubleEditor)); opacity.ValueChanged += opacity_ValueChanged; _properties["Opacity"] = opacity; } if (annObject is AnnCurveObject) { AnnCurveObject closedCurveObject = annObject as AnnCurveObject; AnnPropertyInfo tensionInfo; if (closedCurveObject != null) { tensionInfo = new AnnPropertyInfo(string.Empty, false, closedCurveObject.Tension, "Curve", "Tension", "Tension", true, typeof(AnnDoubleEditor)); } else { AnnCurveObject curveObject = annObject as AnnCurveObject; tensionInfo = new AnnPropertyInfo(string.Empty, false, curveObject.Tension, "Curve", "Tension", "Tension", true, typeof(AnnDoubleEditor)); } tensionInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(tensionInfo_ValueChanged); _properties["Tension"] = tensionInfo; } if (annObject is AnnPolyRulerObject) { AnnPolyRulerObject annPolyRulerObject = annObject as AnnPolyRulerObject; AnnPropertyInfo showGauge = new AnnPropertyInfo(string.Empty, false, annPolyRulerObject.ShowGauge, "Ruler", "ShowGauge", "Show Gauge", true, typeof(AnnBooleanEditor)); showGauge.Values["True"] = true; showGauge.Values["False"] = false; showGauge.ValueChanged += new AnnObjectEditorValueChangedHandler(showGauge_ValueChanged); _properties["ShowGauge"] = showGauge; AnnPropertyInfo gaugeLengthInfo = new AnnPropertyInfo("GaugeLength", false, annPolyRulerObject.GaugeLength, "Ruler", "GaugeLength", "Gauge Length", true, typeof(AnnLengthEditor)); _properties["GaugeLength"] = gaugeLengthInfo; AnnPropertyInfo tickMarksLengthInfo = new AnnPropertyInfo("TickMarksLength", false, annPolyRulerObject.TickMarksLength, "Ruler", "TickMarksLength", "TickMarks Length", true, typeof(AnnLengthEditor)); _properties["TickMarksLength"] = tickMarksLengthInfo; _polyRulerObj = annPolyRulerObject; gaugeLengthInfo.ValueChanged += gaugeLengthInfo_ValueChanged; tickMarksLengthInfo.ValueChanged += tickMarksLengthInfo_ValueChanged; string measurementUnit = Enum.GetName(typeof(AnnUnit), (int)annPolyRulerObject.MeasurementUnit); AnnPropertyInfo measurementUnitInfo = new AnnPropertyInfo(string.Empty, false, measurementUnit, "Ruler", "MeasurementUnit", "Measurement Unit", true, typeof(AnnStringEditor)); measurementUnitInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(measurementUnitInfo_ValueChanged); FillEnumValue(measurementUnitInfo, typeof(AnnUnit)); _properties["MeasurementUnit"] = measurementUnitInfo; AnnPropertyInfo precisionInfo = new AnnPropertyInfo(string.Empty, false, annPolyRulerObject.Precision.ToString(), "Ruler", "Precision", "Precision", true, typeof(AnnStringEditor)); precisionInfo.Values["0"] = 0; precisionInfo.Values["1"] = 1; precisionInfo.Values["2"] = 2; precisionInfo.Values["3"] = 3; precisionInfo.Values["4"] = 4; precisionInfo.Values["5"] = 5; precisionInfo.Values["6"] = 6; precisionInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(precisionInfo_ValueChanged); _properties["Precision"] = precisionInfo; AnnPropertyInfo showTickMarksInfo = new AnnPropertyInfo(string.Empty, false, annPolyRulerObject.ShowTickMarks, "Ruler", "ShowTickMarks", "Show Tick Marks", true, typeof(AnnBooleanEditor)); showTickMarksInfo.Values["True"] = true; showTickMarksInfo.Values["False"] = false; showTickMarksInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(showTickMarksInfo_ValueChanged); _properties["ShowTickMarks"] = showTickMarksInfo; } if (annObject is AnnProtractorObject) { AnnProtractorObject annProtractorObject = annObject as AnnProtractorObject; AnnPropertyInfo acuteInfo = new AnnPropertyInfo(string.Empty, false, annProtractorObject.Acute.ToString(), "Protractor", "Acute", "Acute", true, typeof(AnnStringEditor)); acuteInfo.Values["True"] = true; acuteInfo.Values["False"] = false; acuteInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(acuteInfo_ValueChanged); _properties["Acute"] = acuteInfo; AnnPropertyInfo anglePrecisionInfo = new AnnPropertyInfo(string.Empty, false, annProtractorObject.AnglePrecision.ToString(), "Protractor", "Angle Precision", "Precision", true, typeof(AnnStringEditor)); anglePrecisionInfo.Values["0"] = 0; anglePrecisionInfo.Values["1"] = 1; anglePrecisionInfo.Values["2"] = 2; anglePrecisionInfo.Values["3"] = 3; anglePrecisionInfo.Values["4"] = 4; anglePrecisionInfo.Values["5"] = 5; anglePrecisionInfo.Values["6"] = 6; anglePrecisionInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(anglePrecisionInfo_ValueChanged); _properties["AnglePrecision"] = anglePrecisionInfo; string angulartUnit = Enum.GetName(typeof(AnnAngularUnit), (int)annProtractorObject.AngularUnit); AnnPropertyInfo angularUnitInfo = new AnnPropertyInfo(string.Empty, false, angulartUnit, "Protractor", "AngularUnit", "Angular Unit", true, typeof(AnnStringEditor)); angularUnitInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(angularUnitInfo_ValueChanged); FillEnumValue(angularUnitInfo, typeof(AnnAngularUnit)); _properties["AngularUnit"] = angularUnitInfo; } if (annObject is AnnRubberStampObject) { AnnRubberStampObject annRubberStampObject = annObject as AnnRubberStampObject; string rubberStamp = Enum.GetName(typeof(AnnRubberStampType), (int)annRubberStampObject.RubberStampType); if (rubberStamp.StartsWith("Stamp")) { rubberStamp = rubberStamp.Replace("Stamp", ""); } AnnPropertyInfo ruberStampTypeinfo = new AnnPropertyInfo(string.Empty, false, rubberStamp, "Rubber Stamp", "RuberStampType", "Rubber Stamp Type", true, typeof(AnnStringEditor)); FillEnumValue(ruberStampTypeinfo, typeof(AnnRubberStampType)); ruberStampTypeinfo.ValueChanged += new AnnObjectEditorValueChangedHandler(ruberStampTypeinfo_ValueChanged); _properties["RuberStampType"] = ruberStampTypeinfo; } if (annObject is AnnTextObject) { AnnTextObject annTextObject = annObject as AnnTextObject; AnnPropertyInfo textBackgroundPropertyInfo = new AnnPropertyInfo(string.Empty, false, annTextObject.TextBackground, "Text", "TextBackground", "Background", true, typeof(AnnSolidColorBrushEditor)); _properties["TextBackground"] = textBackgroundPropertyInfo; textBackgroundPropertyInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(textBackgroundPropertyInfo_ValueChanged); AnnPropertyInfo textForegroundPropertyInfo = new AnnPropertyInfo(string.Empty, false, annTextObject.TextForeground, "Text", "TextForeground", "Foreground", true, typeof(AnnSolidColorBrushEditor)); textForegroundPropertyInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(textForegroundPropertyInfo_ValueChanged); _properties["TextForeground"] = textForegroundPropertyInfo; AnnPropertyInfo text = new AnnPropertyInfo(string.Empty, false, annTextObject.Text, "Text", "Acute", "Text", true, typeof(AnnStringEditor)); text.ValueChanged += new AnnObjectEditorValueChangedHandler(text_ValueChanged); _properties["Text"] = text; string vertical = Enum.GetName(typeof(AnnVerticalAlignment), (int)annTextObject.VerticalAlignment); AnnPropertyInfo verticalAlignment = new AnnPropertyInfo(string.Empty, false, vertical, "Text", "VerticalAlignment", "Vertical Alignment", true, typeof(AnnStringEditor)); verticalAlignment.ValueChanged += new AnnObjectEditorValueChangedHandler(verticalAlignment_ValueChanged); FillEnumValue(verticalAlignment, typeof(AnnVerticalAlignment)); _properties["VerticalAlignment"] = verticalAlignment; string horizontal = Enum.GetName(typeof(AnnHorizontalAlignment), (int)annTextObject.HorizontalAlignment); AnnPropertyInfo horizontalAlignment = new AnnPropertyInfo(string.Empty, false, horizontal, "Text", "HorizontalAlignment", "Horizontal Alignment", true, typeof(AnnStringEditor)); horizontalAlignment.ValueChanged += new AnnObjectEditorValueChangedHandler(horizontalAlignment_ValueChanged); FillEnumValue(horizontalAlignment, typeof(AnnHorizontalAlignment)); _properties["HorizontalAlignment"] = horizontalAlignment; AnnPropertyInfo wordWrapInfo = new AnnPropertyInfo(string.Empty, false, annTextObject.WordWrap, "Text", "Word Wrap", "Word Wrap", true, typeof(AnnBooleanEditor)); wordWrapInfo.Values["True"] = true; wordWrapInfo.Values["False"] = false; _properties["WordWrap"] = wordWrapInfo; wordWrapInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(wordWrapInfo_ValueChanged); } if (annObject is AnnTextRollupObject) { AnnTextRollupObject annTextRollupObject = annObject as AnnTextRollupObject; AnnPropertyInfo expandedInfo = new AnnPropertyInfo(string.Empty, false, annTextRollupObject.Expanded, "TextRollup", "Expanded", "Expanded", true, typeof(AnnBooleanEditor)); expandedInfo.Values["True"] = true; expandedInfo.Values["False"] = false; expandedInfo.ValueChanged += expandedInfo_ValueChanged; _properties["Expanded"] = expandedInfo; } if (annObject is AnnTextPointerObject) { AnnTextPointerObject annTextPointerObject = annObject as AnnTextPointerObject; AnnPropertyInfo fixedPointerInfo = new AnnPropertyInfo(string.Empty, false, annTextPointerObject.FixedPointer.ToString(), "Text Pointer", "FixedPointer", "Fixed", true, typeof(AnnStringEditor)); fixedPointerInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(fixedPointerInfo_ValueChanged); fixedPointerInfo.Values["True"] = true; fixedPointerInfo.Values["False"] = false; _properties["FixedPointer"] = fixedPointerInfo; } if (annObject is AnnStampObject) { AnnStampObject annStampObject = annObject as AnnStampObject; AnnPropertyInfo pictureInfo = new AnnPropertyInfo(string.Empty, false, annStampObject.Picture, "Picture", "Picture", "Picture", true, typeof(AnnPictureEditor)); pictureInfo.ValueChanged += pictureInfo_ValueChanged; _properties["Picture"] = pictureInfo; } if (annObject is AnnImageObject) { AnnImageObject annImageObject = annObject as AnnImageObject; AnnPropertyInfo pictureInfo = new AnnPropertyInfo(string.Empty, false, annImageObject.Picture, "Picture", "Picture", "Picture", true, typeof(AnnPictureEditor)); pictureInfo.ValueChanged += annImageObject_PictureInfo_ValueChanged; _properties["Picture"] = pictureInfo; } if (annObject is AnnFreehandHotspotObject) { AnnFreehandHotspotObject annFreehandHotspotObject = annObject as AnnFreehandHotspotObject; AnnPropertyInfo pictureInfo = new AnnPropertyInfo(string.Empty, false, annFreehandHotspotObject.Picture, "Picture", "Picture", "Picture", true, typeof(AnnPictureEditor)); pictureInfo.ValueChanged += freeHandPictureInfo_ValueChanged; _properties["Picture"] = pictureInfo; } if (annObject is AnnPointObject) { AnnPointObject annPointObject = annObject as AnnPointObject; AnnPropertyInfo showPictureInfo = new AnnPropertyInfo(string.Empty, false, annPointObject.ShowPicture, "Point", "ShowPicture", "Show Picture", true, typeof(AnnBooleanEditor)); showPictureInfo.Values["True"] = true; showPictureInfo.Values["False"] = false; showPictureInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(showPictureInfo_ValueChanged); _properties["ShowPicture"] = showPictureInfo; } if (annObject.Id == AnnObject.MediaObjectId || annObject.Id == AnnObject.AudioObjectId) { AnnMediaObject annMediaObject = annObject as AnnMediaObject; AnnPropertyInfo media = new AnnPropertyInfo(string.Empty, false, annMediaObject.Media, "Media", "Media", "Source", true, typeof(AnnMediaEditor)); media.ValueChanged += new AnnObjectEditorValueChangedHandler(media_ValueChanged); _properties["Media"] = media; } if (annObject.Id == AnnObject.EncryptObjectId) { AnnEncryptObject annEncryptObject = annObject as AnnEncryptObject; if (annEncryptObject != null) { AnnPropertyInfo key = new AnnPropertyInfo(string.Empty, false, annEncryptObject.Key, "Encrypt", "", "Key", true, typeof(AnnIntegerEditor)); key.ValueChanged += new AnnObjectEditorValueChangedHandler(encryptKey_ValueChanged); _properties["Key"] = key; if (!annEncryptObject.IsEncrypted) { AnnPropertyInfo encryptor = new AnnPropertyInfo(string.Empty, false, annEncryptObject.Encryptor, "Encrypt", "", "Encryptor", true, typeof(AnnBooleanEditor)); encryptor.Values["True"] = true; encryptor.Values["False"] = false; encryptor.ValueChanged += new AnnObjectEditorValueChangedHandler(encryptor_ValueChanged); _properties["Encryptor"] = encryptor; } } } }