private static bool PropertyEquals(DMember member1, DMember member2) { if (member1 == null || member2 == null || member1.MType != member2.MType) return false; switch (member1.MType) { case MemberType.TextChar: return member1.WFont.Equals(member2.WFont) && member1.FontColor.Equals(member2.FontColor); } return false; }
private void ExecuteMemberPaint(DMember member) { member.Paint(_graphics); }
private void ResetPosition(DMember hMember) { var tempMember = _firstMember.NextMember; while (tempMember != null) { tempMember.Y = this.Y + hMember.Height - tempMember.Height - (int)GetFontHeightOffSet(hMember, tempMember); tempMember = tempMember.NextMember; } _firstMember.Y = _firstMember.NextMember.Y; _lastMember.Y = _lastMember.PreMember.Y; _firstMember.X = this.X; }
/// <summary> /// 修正字体底部对齐所需偏移量 /// </summary> /// <param name="member1"></param> /// <param name="member2"></param> /// <returns></returns> public static float GetFontHeightOffSet(DMember member1, DMember member2) { if (member1.WFont == null || member2.WFont == null || member1.WFont.Size.Equals(member2.WFont.Size)) return 0; var fontFamily = member1.WFont.FontFamily; var descent = fontFamily.GetCellDescent(FontStyle.Regular); //字体下部距离 var descentPixel1 = member1.WFont.Size * descent / fontFamily.GetEmHeight(FontStyle.Regular); //var descentPixel2 = member2.WFont.Size * descent / fontFamily.GetEmHeight(FontStyle.Regular); //return descentPixel1 - descentPixel2; return descentPixel1; }
private static bool PropertyEquals(DMember member1, DMember member2) { if (member1 == null || member2 == null) return false; return member1.WFont.Equals(member2.WFont) && member1.FontColor.Equals(member2.FontColor); }