/// <summary> /// Initializes this class with a graphics object. Must be called before using this class to render.</summary> /// <param name="graphics">The graphics object that this TimelineRenderer will permanently use</param> public virtual void Init(D2dGraphics graphics) { if (m_graphics != null) throw new InvalidOperationException("Only call Init() once"); m_graphics = graphics; m_gridPen = m_graphics.CreateSolidBrush(Color.FromArgb(128, 128, 128, 128)); m_headerBrush = m_graphics.CreateSolidBrush(SystemColors.Control); m_headerLineBrush = m_graphics.CreateSolidBrush(SystemColors.ControlDark); m_scaleLineBrush = m_graphics.CreateSolidBrush(SystemColors.ControlDark); m_expanderBrush = m_graphics.CreateSolidBrush(Color.DimGray); m_nameBrush = m_graphics.CreateSolidBrush(SystemColors.WindowText); m_scaleTextBrush = m_graphics.CreateSolidBrush(SystemColors.WindowText); m_generalSolidColorBrush = m_graphics.CreateSolidBrush(Color.Empty); m_trackTextFormat = D2dFactory.CreateTextFormat(Font); m_trackTextFormat.ParagraphAlignment = D2dParagraphAlignment.Far; m_trackTextFormat.TextAlignment = D2dTextAlignment.Trailing; }
/// <summary> /// Initializes class with graphics object</summary> /// <param name="graphics">Graphics object for drawing</param> public override void Init(D2dGraphics graphics) { base.Init(graphics); SelectedBrush = graphics.CreateSolidBrush(Color.Tomato);//should have width of 3 CollapsedBrush = graphics.CreateSolidBrush(Color.LightGray); InvalidBrush = graphics.CreateSolidBrush(Color.DimGray); GroupBrush = graphics.CreateLinearGradientBrush( new D2dGradientStop(Color.LightGoldenrodYellow, 0), new D2dGradientStop(Color.Khaki, 1)); GhostGroupBrush = graphics.CreateSolidBrush(Color.FromArgb(128, Color.Gray)); TrackBrush = graphics.CreateSolidBrush(Color.LightGray); GhostTrackBrush = graphics.CreateSolidBrush(Color.FromArgb(128, Color.Gray)); TextBrush = graphics.CreateSolidBrush(SystemColors.WindowText); }