コード例 #1
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);
            }
        }
コード例 #2
0
ファイル: LengthConvertor.cs プロジェクト: sakpung/webstudy
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            LeadLengthD length = (LeadLengthD)value;

            return(length.Value);
        }
コード例 #3
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();
        }
コード例 #4
0
ファイル: CalibrationDialog.cs プロジェクト: sakpung/webstudy
        private void ApplyCalibrate()
        {
            if (_isPixelUnit)
            {
                _polyRulerObject.MeasurementUnit = AnnUnit.SmartEnglish;
            }

            // the method _polyRulerObject.GetRulerLength() , gets the ruler length in AnnUnit.Unit so we need to convert it to current _polyRulerObject.MeasurementUnit with no calibration ratio
            LeadLengthD lengthInUnits = _polyRulerObject.GetRulerLength(1);

            double sourceLength = AnnUnitConverter.Convert(lengthInUnits.Value, AnnUnit.Unit, _polyRulerObject.MeasurementUnit);

            double destLength = 1;

            // check if the entered value is Number
            if (!double.TryParse(_txtRulerLength.Text, out destLength))
            {
                throw new Exception("Invalid Ruler Length Value");
            }

            if (sourceLength != 0 && destLength != 0)
            {
                AnnUnit destUnit = (AnnUnit)Enum.Parse(typeof(AnnUnit), _comboMesurementUnit.SelectedItem.ToString());

                if (_cboxApplyToAllRulers.Checked)
                {
                    _mapper.Calibrate(LeadLengthD.Create(sourceLength), _polyRulerObject.MeasurementUnit, LeadLengthD.Create(destLength), destUnit);

                    AnnAutomationManager manager = _automation.Manager;

                    //update all exisiting rulers to have the new calibration measurement unit
                    foreach (AnnObject annObject in _automation.Container.Children)
                    {
                        AnnPolyRulerObject polyRuler = annObject as AnnPolyRulerObject;
                        if (polyRuler != null)
                        {
                            polyRuler.MeasurementUnit = destUnit;
                        }
                    }
                }
                else
                {
                    _polyRulerObject.Calibrate(LeadLengthD.Create(sourceLength), _polyRulerObject.MeasurementUnit, LeadLengthD.Create(destLength), destUnit);
                }

                _polyRulerObject.MeasurementUnit = destUnit;
            }

            if (_isPixelUnit)
            {
                _polyRulerObject.MeasurementUnit = AnnUnit.Pixel;
            }
        }
コード例 #5
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);
        }
コード例 #6
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);
        }
コード例 #7
0
ファイル: AnnNorbergDrawer.cs プロジェクト: sakpung/webstudy
 static AnnNorbergDrawer()
 {
     _objectTemplate = new AnnRectangleObject();
     _objectTemplate.Stroke.Stroke          = AnnSolidColorBrush.Create("black");
     _objectTemplate.Stroke.StrokeThickness = LeadLengthD.Create(2);
 }