C#中如何实现这种文字效果 楼主的需求和1楼的还是有点区别楼主可能需要的是黑白这种纯文本的而非1楼那种带html标签的可以去解析像素,然后按照相应的像素值进行合理的填充不难1楼不仅进行二值的解析还解析了颜色,然后给填充字符包上颜色标签 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 。。接接。。接接。接。。接。。。接。。接。。接。接。。。接。接接接接接接接。接接接。。接接。。。。接。接。。。接。。接。。。。接接接接接。。。。原理差不多,楼主自己优化吧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();} WPF button,判断鼠标点击有ispressed,判断touch要怎么办? 求一个正则 调用bat文件 专用链接转换工具1.03 C#编写触发程序 请问C#的try语句怎么写? 数据同步 如何从自行添加的第二个窗口里得到信息啊? 怎样增加sting数组的长度?谁能解答给谁加分! 如何替换“\”为“\\”? c#写的telnet连接程序,乱码 无法修改类中的结构体成员的属性,提示错误返回值不是一个变量
。。接接
。接。。接。。
。接。。接。。
接。接。
。。接。接接接接接接接。接
接接。。
接接。。
。。接。接。。
。接。。接。。
。。接接接接接
。
。
。
。原理差不多,楼主自己优化吧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();
}