如何使用Graphics.DrawString绘制完全单色的文本? - c#

Bitmap bmp = new Bitmap(300, 50);
Graphics gfx = Graphics.FromImage(bmp);
gfx.DrawString("Why I have black outer pixels?", new Font("Verdana", 14),
    new SolidBrush(Color.White), 0, 0);
gfx.Dispose();
bmp.Save(Application.StartupPath + "\\test.png", ImageFormat.Png);

我需要文字完全是白色的。我尝试了不同的画笔,如Brushes.White等,但都不好。我能做什么?所有文本像素必须为白色,只是不透明度会发生变化。

c#大神给出的解决方案

解决:(结合使用textrenderinghints和拉绳)

        Bitmap bmp = new Bitmap(300, 50);
        Graphics gfx = Graphics.FromImage(bmp);

        gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
        gfx.DrawString("Why I have black outer pixels?", new Font("Verdana", 14),
            new SolidBrush(Color.White), 0, 0);
        gfx.Dispose();
        bmp.Save(Application.StartupPath + "\\test.png", ImageFormat.Png);

当回复有时是一个对象有时是一个数组时,如何在使用改造时解析JSON回复? - java

我正在使用Retrofit来获取JSON答复。这是我实施的一部分-@GET("/api/report/list") Observable<Bills> listBill(@Query("employee_id") String employeeID); 而条例草案类是-public static class…

Mongo汇总 - javascript

我的收藏中有以下文件{ "_id": ObjectId("54490b8104f7142f22ecc97f"), "title": "Sample1", "slug": "samplenews", "cat": …

提交表单后显示模式对话框 - php

提交下载文件后,我有一张表格。我要自动而不是自动下载文件..以显示模态对话框并显示下载链接。<form name="softwareform" id="softwareform" action="../downloadlink.php" method="POST" alig…

DataSourceTransactionManager和JndiObjectFactoryBean和JdbcTemplate的用途是什么? - java

以下的用途是什么:org.springframework.jdbc.core.JdbcTemplate org.springframework.jdbc.datasource.DataSourceTransactionManager org.springframework.jndi.JndiObjectFactoryBean <tx:annotatio…

在Map中,如果我们使用现有键进行修改,则不会获得ConcurrentModificationException - java

我有以下代码,我希望从情况2的情况下抛出ConcurrentModificationException,但它运行成功。据我所知,如果我对地图中的单个键执行相同的操作,则不会抛出异常,因为here但是当我重现这种具有两个案例的多个密钥的场景时,通过新密钥修改。通过现有密钥进行修改。情况1: Map<String,String> mp = new H…