private static byte[] CropText(byte[] chars, int width, CompoundFont FontStyle) { if (chars == null || chars.Length == 1) return chars; int tw = 0; for (int r = 0; r < chars.Length; r++) { tw += FontStyle.Font.Chars[chars[r]].width; if (tw > width - 3) { chars = chars.Clone(0, r); break; } } //while (width >= (w - 3)) //{ // chars = chars.Clone(1, chars.Length - 1); // width = FontStyle.Font.TextWidth(chars); //} return chars; }
public ListboxItem() : base() { Text1Style = new CompoundFont(null, G3Color.BLACK, G3Color.WHITE); Text2Style = new CompoundFont(null, G3Color.BLACK, G3Color.WHITE); }