AtelierElieScripter.ResourceObjects.JapFontResourceObject.GetTextWithBoxBitmap C# (CSharp) Метод

GetTextWithBoxBitmap() публичный Метод

GetTextWithBoxBitmap
public GetTextWithBoxBitmap ( string text, int nameId ) : Bitmap
text string Text String
nameId int Name Id int
Результат System.Drawing.Bitmap
        public Bitmap GetTextWithBoxBitmap(string text, int nameId)
        {
            Bitmap textBitmap = GetTextBitmap(text, TEXTBOXTEXTMAXWIDTH, TEXTBOXTEXTLINES, TEXTBOXTEXTLINESPACING);
            Bitmap textWithBoxBitmap = new Bitmap(textBox.Width, textBox.Height);

            Imaging.ImageAttributes attr = new Imaging.ImageAttributes();
            attr.SetColorKey(Color.Black, Color.Black);

            using (Graphics g = Graphics.FromImage(textWithBoxBitmap))
            {
                g.InterpolationMode = InterpolationMode.NearestNeighbor;

                // Draw textbox
                Rectangle textboxRect = new Rectangle(0, 0, textBox.Width, textBox.Height);
                g.DrawImage(textBox, textboxRect, 0, 0, textBox.Width, textBox.Height, GraphicsUnit.Pixel, attr);

                // Draw Name
                NameResourceObject nameRes = NameResourceObject.Instance;
                Bitmap nameBitmap = nameRes.GetName(nameId);
                Rectangle nameRect = new Rectangle(TEXTBOXNAMEX, TEXTBOXNAMEY, nameBitmap.Width, nameBitmap.Height);
                g.DrawImage(nameBitmap, nameRect, 0, 0, nameBitmap.Width, nameBitmap.Height, GraphicsUnit.Pixel, attr);

                // Draw Text
                Rectangle textRect = new Rectangle(TEXTBOXTEXTX, TEXTBOXTEXTY, textBitmap.Width, textBitmap.Height);
                g.DrawImage(textBitmap, textRect, 0, 0, textBitmap.Width, textBitmap.Height, GraphicsUnit.Pixel, attr);

            }

            return textWithBoxBitmap;
        }