void IView.SetViewModel(IViewModel viewModel) { this.viewModel = viewModel; this.drawing = new ControlDrawing(new GraphicsResources(viewModel, "Tahoma", Font.Size, 6, new LogJoint.Drawing.Image(this.bookmarkPictureBox.Image)), viewModel); this.datesSize = new Lazy <int>(() => { using (LJD.Graphics g = new LJD.Graphics(this.CreateGraphics(), true)) return(drawing.MeasureDatesAreaHeight(g)); }); }
// Shared initialization code void Initialize() { drawing = new ControlDrawing( new GraphicsResources( NSFont.SystemFontOfSize(NSFont.SystemFontSize).FontName, (float)NSFont.SystemFontSize, (float)NSFont.SystemFontSize * 0.6f, LJD.Extensions.ToColor(NSColor.ControlBackground), new LJD.Image(NSImage.ImageNamed("TimelineBookmark.png")) ) ); dateAreaHeight = new Lazy <int>(() => { using (var g = new LJD.Graphics()) return(drawing.MeasureDatesAreaHeight(g)); }); }
void IView.SetViewModel(IViewModel viewModel) { this.viewModel = viewModel; drawing = new ControlDrawing( new GraphicsResources( viewModel, NSFont.SystemFontOfSize(NSFont.SystemFontSize).FontName, (float)NSFont.SystemFontSize, (float)NSFont.SystemFontSize * 0.6f, new Image(NSImage.ImageNamed("TimelineBookmark.png")) ), viewModel ); dateAreaHeight = new Lazy <int> (() => { using (var g = new Graphics()) return(drawing.MeasureDatesAreaHeight(g)); }); }
public TimeLineControl() { InitializeComponent(); this.SetStyle(ControlStyles.ResizeRedraw, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.focuslessMouseWheelMessagingFilter = new UIUtils.FocuslessMouseWheelMessagingFilter(this); this.drawing = new ControlDrawing(new GraphicsResources( "Tahoma", Font.Size, 6, System.Drawing.SystemColors.ButtonFace, new LogJoint.Drawing.Image(this.bookmarkPictureBox.Image))); this.datesSize = new Lazy <int>(() => { using (LJD.Graphics g = new LJD.Graphics(this.CreateGraphics(), true)) return(drawing.MeasureDatesAreaHeight(g)); }); this.minMarkHeight = UI.UIUtils.Dpi.ScaleUp(25, 120); Func <int, int> makeEven = x => x % 2 != 0 ? (x + 1) : x; this.containersHeaderAreaHeight = makeEven(UI.UIUtils.Dpi.ScaleUp(12, 120)); this.containerControlSize = makeEven(UI.UIUtils.Dpi.ScaleUp(9, 120)); contextMenu.Opened += delegate(object sender, EventArgs e) { Invalidate(); }; contextMenu.Closed += delegate(object sender, ToolStripDropDownClosedEventArgs e) { Invalidate(); }; this.Disposed += (sender, e) => focuslessMouseWheelMessagingFilter.Dispose(); }