コード例 #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;
 }
コード例 #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;
 }