Пример #1
0
 public Ruler() : base(FactorySource.PerThread)
 {
     this.cursorBrush         = new SolidColorBrush();
     this.lineBrush           = new SolidColorBrush();
     this.textBrush           = new SolidColorBrush();
     this.unitsBoxBrush       = new SolidColorBrush();
     this.measurementUnit     = PaintDotNet.MeasurementUnit.Inch;
     this.dpu                 = 96.0;
     this.scaleFactor         = PaintDotNet.ScaleFactor.OneToOne;
     base.UseHwndRenderTarget = true;
     this.tickLabelFontLazy   = new Lazy <SizedFontProperties>(delegate {
         using (IGdiFontMap map = DirectWriteFactory.Instance.GetGdiFontMapRef(true))
         {
             FontProperties fontProperties;
             try
             {
                 fontProperties = map.GetFontProperties(tickLabelFontNames);
             }
             catch (NoFontException)
             {
                 fontProperties = new FontProperties(string.Empty, string.Empty, FontWeight.Normal, FontStretch.Normal, PaintDotNet.DirectWrite.FontStyle.Normal, TextDecorations.None);
             }
             return(new SizedFontProperties(fontProperties, UIUtil.ScaleHeight((float)10.66667f)));
         }
     }, LazyThreadSafetyMode.PublicationOnly);
     using (ISystemFonts fonts = new PaintDotNet.DirectWrite.SystemFonts())
     {
         this.unitsBoxFont = fonts.Menu;
     }
 }
Пример #2
0
 private int[] GetSubdivisions(PaintDotNet.MeasurementUnit unit)
 {
     if (unit != PaintDotNet.MeasurementUnit.Inch)
     {
         if (unit == PaintDotNet.MeasurementUnit.Centimeter)
         {
             return(subdivsCm);
         }
         return(subdivsOther);
     }
     return(subdivsInch);
 }