protected void DrawTwoRows(Graphics g, LiveSplitState state, float width, float height) { NameLabel.ShadowColor = state.LayoutSettings.ShadowsColor; ValueLabel.ShadowColor = state.LayoutSettings.ShadowsColor; if (InformationName != null && LongestString != null && InformationName.Length > LongestString.Length) { LongestString = InformationName; NameMeasureLabel.Text = LongestString; } NameMeasureLabel.Text = LongestString; NameMeasureLabel.Font = state.LayoutSettings.TextFont; NameMeasureLabel.SetActualWidth(g); MinimumHeight = 0.85f * (g.MeasureString("A", ValueLabel.Font).Height + g.MeasureString("A", NameLabel.Font).Height); NameLabel.Width = width - 10; NameLabel.Height = height; NameLabel.X = 5; NameLabel.Y = 0; ValueLabel.Width = ValueLabel.IsMonospaced ? width - 12 : width - 10; ValueLabel.Height = height; ValueLabel.Y = 0; ValueLabel.X = 5; PrepareDraw(state, LayoutMode.Horizontal); NameLabel.Draw(g); ValueLabel.Draw(g); }
public void DrawVertical(Graphics g, LiveSplitState state, float width, Region clipRegion) { if (DisplayTwoRows) { VerticalHeight = 0.9f * (g.MeasureString("A", ValueLabel.Font).Height + g.MeasureString("A", NameLabel.Font).Height); PaddingTop = PaddingBottom = 0; DrawTwoRows(g, state, width, VerticalHeight); } else { VerticalHeight = 31; NameLabel.ShadowColor = state.LayoutSettings.ShadowsColor; NameLabel.OutlineColor = state.LayoutSettings.TextOutlineColor; ValueLabel.ShadowColor = state.LayoutSettings.ShadowsColor; ValueLabel.OutlineColor = state.LayoutSettings.TextOutlineColor; var textHeight = 0.75f * Math.Max(g.MeasureString("A", ValueLabel.Font).Height, g.MeasureString("A", NameLabel.Font).Height); PaddingTop = Math.Max(0, (VerticalHeight - textHeight) / 2f); PaddingBottom = PaddingTop; NameMeasureLabel.Text = LongestString; NameMeasureLabel.SetActualWidth(g); ValueLabel.SetActualWidth(g); NameLabel.Width = width - ValueLabel.ActualWidth - 10; NameLabel.Height = VerticalHeight; NameLabel.X = 5; NameLabel.Y = 0; ValueLabel.Width = ValueLabel.IsMonospaced ? width - 12 : width - 10; ValueLabel.Height = VerticalHeight; ValueLabel.Y = 0; ValueLabel.X = 5; PrepareDraw(state, LayoutMode.Vertical); NameLabel.Draw(g); ValueLabel.Draw(g); } }