private void lstFont_MeasureItem(object sender, MeasureItemEventArgs e) { if (e.Index > (this.fntunicode ? 12 : 9)) { e.ItemHeight = 0; } else { Bitmap bitmap = this.fntunicode ? UnicodeFonts.GetStringImage(e.Index, "ABCabc123!@#$АБВабв") : Fonts.GetStringImage(e.Index, "ABCabc123 */ АБВабв"); e.ItemHeight = bitmap.Height; bitmap.Dispose(); } }
public override void RefreshCache() { if (this.mHue == null) { this.mHue = Hues.GetHue(0); } if (this.mCache != null) { this.mCache.Dispose(); } this.mCache = UnicodeFonts.GetStringImage(2, this.mInitialText + " "); if ((this.mHue == null || this.mHue.Index == 0 ? 0 : 1) == 0) { return; } this.mHue.ApplyTo(this.mCache, false); }
private void lstFont_DrawItem(object sender, DrawItemEventArgs e) { if ((e.State & DrawItemState.Selected) > DrawItemState.None) { e.Graphics.FillRectangle(SystemBrushes.Highlight, e.Bounds); } else { e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds); } if (e.Index > (this.fntunicode ? 12 : 9)) { return; } Bitmap bitmap = this.fntunicode ? UnicodeFonts.GetStringImage(e.Index, "ABCabc123!@#$АБВабв") : Fonts.GetStringImage(e.Index, "ABCabc123 */ АБВабв"); e.Graphics.DrawImage(bitmap, e.Bounds.Location); bitmap.Dispose(); }
public override void RefreshCache() { if (this.mCache != null) { this.mCache.Dispose(); } this.mCache = this.mUnicode ? UnicodeFonts.GetStringImage(this.mFontIndex, this.mText + " ") : Fonts.GetStringImage(this.mFontIndex, this.mText + " "); if ((this.mHue == null || this.mHue.Index == 0 ? 0 : 1) != 0) { this.mHue.ApplyTo(this.mCache, this.mPartialHue); } if (this.mCropped) { Bitmap bitmap = new Bitmap(this.mSize.Width, this.mSize.Height, PixelFormat.Format32bppArgb); Graphics graphics = Graphics.FromImage((Image)bitmap); graphics.Clear(Color.Transparent); graphics.DrawImage((Image)this.mCache, 0, 0); graphics.Dispose(); this.mCache.Dispose(); this.mCache = bitmap; } this.mSize = this.mCache.Size; }
public LabelElement(SerializationInfo info, StreamingContext context) : base(info, context) { this.mFontIndex = 2; int int32 = info.GetInt32("LabelElementVersion"); this.mText = info.GetString(nameof(Text)); this.mHue = Hues.GetHue(info.GetInt32("HueIndex")); if (int32 >= 3) { this.mPartialHue = info.GetBoolean(nameof(PartialHue)); this.mUnicode = info.GetBoolean(nameof(Unicode)); } else { this.mPartialHue = true; this.mUnicode = true; } this.mFontIndex = info.GetInt32("FontIndex"); if (int32 <= 2) { --this.mFontIndex; } if (int32 >= 2) { this.mCropped = info.GetBoolean(nameof(Cropped)); this.mSize = (Size)info.GetValue(nameof(Size), typeof(Size)); } else { this.mCropped = false; Bitmap stringImage = UnicodeFonts.GetStringImage(this.mFontIndex, this.mText + " "); this.mSize = stringImage.Size; stringImage.Dispose(); } this.RefreshCache(); }