Ejemplo n.º 1
0
 public RulerForm(Options options)
 {
     this.options  = options;
     Settings      = new Settings();
     CustomMarkers = new MarkerCollection();
     manager       = new WinFormsWindowManager(this)
     {
         AlwaysTrackResize = true
     };
     // Name all the properties we want to have persisted
     manager.ManageDefault();
     manager.Manage(nameof(Settings), nameof(TopMost), nameof(CustomMarkers));
     manager.Manage(nameof(ResizeMode), defaultValue: FormResizeMode.Horizontal);
     manager.Manage(nameof(Opacity), defaultValue: 1);
     manager.CustomSettings.AddSetting("Shortcuts", typeof(Shortcut[]), null);
     manager.BeforeSaved += Manager_BeforeSaved;
     manager.Initialize();
     InitializeComponent();
     updateChecker      = new WinFormsUpdateChecker(Program.UPDATE_URL, this, Program.UPDATE_MODE);
     mouseTracker       = new MouseTracker(this);
     mouseTracker.Tick += mouseTracker_Tick;
     painter            = new RulerPainter(this);
     this.SetStyle(ControlStyles.ResizeRedraw, true);
     this.TopMost     = true;
     this.MouseWheel += RulerForm_MouseWheel;
     this.DpiChanged += RulerForm_DpiChanged;
 }
Ejemplo n.º 2
0
 public RulerForm()
 {
     Settings      = new Settings();
     CustomMarkers = new MarkerCollection();
     manager       = new WinFormsWindowManager(this)
     {
         AlwaysTrackResize = true
     };
     // Name all the properties we want to have persisted
     manager.ManageDefault();
     manager.Manage(nameof(Settings), nameof(TopMost), nameof(CustomMarkers));
     manager.Manage(nameof(ResizeMode), defaultValue: FormResizeMode.Horizontal);
     manager.Manage(nameof(Opacity), defaultValue: 1);
     manager.Initialize();
     InitializeComponent();
     updateChecker = new WinFormsUpdateChecker(Program.UPDATE_URL, this, Program.UPDATE_MODE);
     mouseTracker  = new MouseTracker(this);
     painter       = new RulerPainter(this);
     this.SetStyle(ControlStyles.ResizeRedraw, true);
     this.TopMost     = true;
     this.MouseWheel += RulerForm_MouseWheel;
 }
Ejemplo n.º 3
0
 public RulerForm()
 {
     Settings = new Settings();
     manager  = new WinFormsWindowManager(this)
     {
         AlwaysTrackResize = true
     };
     // Name all the properties we want to have persisted
     manager.ManageDefault();
     manager.Manage(nameof(Settings), nameof(TopMost));
     manager.Manage(nameof(CustomLines), SettingsSerializeAs.Binary);
     manager.Manage(nameof(Opacity), defaultValue: 1);
     manager.Initialize();
     InitializeComponent();
     updateChecker = new WinFormsUpdateChecker(Program.UPDATE_URL, this, Program.UPDATE_MODE);
     this.SetStyle(ControlStyles.ResizeRedraw, true);
     this.DoubleBuffered = true;
     this.TopMost        = true;
     CustomLines         = new LinkedList <int>();
     this.MouseWheel    += RulerForm_MouseWheel;
     rulerToolTip.SetToolTip(this, RulerLength.ToString());
 }