楼主的需求和1楼的还是有点区别
楼主可能需要的是黑白这种纯文本的而非1楼那种带html标签的可以去解析像素,然后按照相应的像素值进行合理的填充
不难1楼不仅进行二值的解析还解析了颜色,然后给填充字符包上颜色标签

解决方案 »

  1.   

    。。接接
    。。接接
    。接。。接。。
    。接。。接。。
    接。接。
    。。接。接接接接接接接。接
    接接。。
    接接。。
    。。接。接。。
    。接。。接。。
    。。接接接接接



    。原理差不多,楼主自己优化吧private void button1_Click(object sender, EventArgs e)
    {
        if (textBoxChar.Text.Length <= 0) return;
        if (textBoxBack.Text.Length <= 0) return;
        if (textBoxFore.Text.Length <= 0) return;
        Graphics vGraphics = CreateGraphics();
        SizeF vSizeF = vGraphics.MeasureString(textBoxChar.Text, Font);
        vGraphics.Dispose();
        Bitmap vBitmap = new Bitmap((int)vSizeF.Width, (int)vSizeF.Height);
        vGraphics = Graphics.FromImage(vBitmap);
        RectangleF vRectangleF = new RectangleF(0, 0, vBitmap.Width, vBitmap.Height);
        StringFormat vStringFormat = new StringFormat();    vGraphics.DrawString(textBoxChar.Text, Font, Brushes.Black, 0, 0);
        vGraphics.Dispose();
        StringBuilder vBuffer = new StringBuilder();
        for (int i = 0; i < vBitmap.Height; i++)
        {
            for (int j = 0; j < vBitmap.Width; j++)
            {
                Color vColor = vBitmap.GetPixel(j, i);
                if (vColor.ToArgb() != 0)
                    vBuffer.Append(textBoxFore.Text);
                else vBuffer.Append(textBoxBack.Text);
            }
            vBuffer.AppendLine();
        }
        textBoxOutput.Text = vBuffer.ToString();
    }