Ejemplo n.º 1
0
 private void OnTextChange(object sender, EventArgs e)
 {
     if (type == 1) //Unicode
     {
         pictureBox1.Image = UnicodeFonts.WriteText(font, textBox1.Text);
     }
     else
     {
         pictureBox1.Image = ASCIIText.DrawText(font, textBox1.Text);
     }
 }
Ejemplo n.º 2
0
 private void lstFont_MeasureItem(object sender, MeasureItemEventArgs e)
 {
     if (e.Index > (this.fntunicode ? 12 : 9))
     {
         e.ItemHeight = 0;
     }
     else
     {
         Bitmap bitmap = this.fntunicode ? UnicodeFonts.WriteText(e.Index, "ABCabc123!@#$АБВабв") : UnicodeFonts.WriteText(e.Index, "ABCabc123 */ АБВабв");
         e.ItemHeight = bitmap.Height;
         bitmap.Dispose();
     }
 }
Ejemplo n.º 3
0
 public override void RefreshCache()
 {
     if (this.mHue == null)
     {
         this.mHue = Hues.GetHue(0);
     }
     if (this.mCache != null)
     {
         this.mCache.Dispose();
     }
     this.mCache = UnicodeFonts.WriteText(2, this.mInitialText + " ");
     if ((this.mHue == null || this.mHue.Index == 0 ? 0 : 1) == 0)
     {
         return;
     }
     this.mHue.ApplyTo(this.mCache, false);
 }
Ejemplo n.º 4
0
        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.WriteText(e.Index, "ABCabc123!@#$АБВабв") : UnicodeFonts.WriteText(e.Index, "ABCabc123 */ АБВабв");

            e.Graphics.DrawImage((Image)bitmap, e.Bounds.Location);
            bitmap.Dispose();
        }
Ejemplo n.º 5
0
 public override void RefreshCache()
 {
     if (this.mCache != null)
     {
         this.mCache.Dispose();
     }
     this.mCache = this.mUnicode ? UnicodeFonts.WriteText(this.mFontIndex, this.mText + " ") : UnicodeFonts.WriteText(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;
 }
Ejemplo n.º 6
0
        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.WriteText(this.mFontIndex, this.mText + " ");
                this.mSize = stringImage.Size;
                stringImage.Dispose();
            }
            this.RefreshCache();
        }
Ejemplo n.º 7
0
 private void OnTextChange(object sender, EventArgs e)
 {
     pictureBox1.Image = _type == 1
         ? UnicodeFonts.WriteText(_font, textBox1.Text)
         : ASCIIText.DrawText(_font, textBox1.Text);
 }