コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        public AnnFontEditor(AnnFont annFont, string category)
        {
            _category = category;
            _annFont  = annFont;

            AnnPropertyInfo fontFamilyNameInfo = new AnnPropertyInfo(string.Empty, false, annFont.FontFamilyName, category, "Stroke", "Family Name", true, typeof(AnnStringEditor));

            fontFamilyNameInfo.ValueChanged += new AnnObjectEditorValueChangedHandler(fontFamilyName_ValueChanged);

            fontFamilyNameInfo.Values["Arial"]           = "Arial";
            fontFamilyNameInfo.Values["Courier New"]     = "Courier New";
            fontFamilyNameInfo.Values["Times New Roman"] = "Times New Roman";
            fontFamilyNameInfo.Values["Verdana"]         = "Verdana";

            AnnPropertyInfo fontSize = new AnnPropertyInfo(string.Empty, false, annFont.FontSize, category, "FontSize", "Size in Points", true, typeof(AnnDoubleEditor));

            fontSize.Values[" 8"]  = 8;
            fontSize.Values["10"]  = 10;
            fontSize.Values["11"]  = 11;
            fontSize.Values["12"]  = 12;
            fontSize.Values["13"]  = 13;
            fontSize.Values["14"]  = 14;
            fontSize.Values["16"]  = 16;
            fontSize.Values["18"]  = 18;
            fontSize.Values["20"]  = 20;
            fontSize.ValueChanged += new AnnObjectEditorValueChangedHandler(fontSize_ValueChanged);

            _properties["FontFamilyName"] = fontFamilyNameInfo;
            _properties["FontSize"]       = fontSize;
        }
コード例 #3
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();
        }
コード例 #4
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            AnnFont annFont = value as AnnFont;

            if (annFont != null)
            {
                return(Leadtools.Annotations.Rendering.AnnWinFormsRenderingEngine.ToFont(annFont));
            }
            else
            {
                return(Leadtools.Annotations.Rendering.AnnWinFormsRenderingEngine.ToFont(new AnnFont("Arial", 12)));
            }
        }