小编rad*_*aku的帖子

如何使用轮廓在图像上绘制文本?

我一直在寻找和寻找带有轮廓到图像的绘图文字?

在这里我的代码

    private static void tulisnamafile(string imagepath, string textnya)
    {

        Image image = Image.FromStream(new MemoryStream(File.ReadAllBytes(imagepath)));
        Bitmap newImage = new Bitmap(640, 380);
        using (Graphics g = Graphics.FromImage(newImage))
        {
            // Draw base image
            g.DrawImageUnscaled(image, 0, 0);
            //Static is HERE
            SolidBrush brushing = new SolidBrush(Color.White);
            Font font = new Font(("Comic Sans MS"), 20.0f);
            int napoint = newImage.Height - 90;
            int napointa = image.Width - 200;
            FontFamily ff = new FontFamily("Times New Roman");
            int fontSize = 24;
            Font f = new Font(ff, fontSize, FontStyle.Regular); …
Run Code Online (Sandbox Code Playgroud)

c# visual-studio-2008 winforms

5
推荐指数
1
解决办法
9129
查看次数

如何在backgroundworker中更改ListView?跨线程错误

可能重复:
最简洁,最正确的避免交叉线程操作错误的方法?

我在运行程序时遇到错误.... {"跨线程操作无效:控制'listView1'从其创建的线程以外的线程访问."}

    private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) {
        TestObject argumentTest = e.Argument as TestObject;
        string[] lines = argumentTest.ThreeValue.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

        HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
        foreach (string vr in lines)
        {
            string country = argumentTest.OneValue.Trim();
            string url = vr + country + '/code/' + argumentTest.TwoValue.Trim();
            string sourceCode = WorkerClass.getSourceCode(url);

            document.LoadHtml(sourceCode);
            var title = document.DocumentNode.SelectSingleNode("//title");
            var desc = document.DocumentNode.SelectSingleNode("//div[@class='productDescription']");

            //-- eksekusi title
            string isititle = title.InnerText;
            string isititle2 = isititle.Replace("droidflashgame: ", "");
            string isititle3 = …
Run Code Online (Sandbox Code Playgroud)

c# delegates winforms

4
推荐指数
1
解决办法
5317
查看次数

C#if else逻辑错误

我做了一些逻辑,但它的错误?

我的代码

private static void DrawText(String text, Font font, Color textColor, Color backColor)
{
    Image img = new Bitmap(640, 360);
    Graphics drawing = Graphics.FromImage(img);

    Color color = textColor;
    if (text.Length <= 80) {
        Rectangle displayRectangle =
            new Rectangle(new Point(20, 100), new Size(img.Width - 1, img.Height - 1));
    } else {
        Rectangle displayRectangle =
            new Rectangle(new Point(20, 80), new Size(img.Width - 1, img.Height - 1));
    }
    StringFormat format1 = new StringFormat(StringFormatFlags.NoClip);
    StringFormat format2 = new StringFormat(format1);

     // ERROR ON NEXT LINE …
Run Code Online (Sandbox Code Playgroud)

c# winforms

1
推荐指数
2
解决办法
619
查看次数

如何拆分特殊字符'##'和'}'

我已经尝试过这里,但这里 仍然没有运气.

文本1:

一些包含}和再次}或者可能}的文字

文本2:

一些文本包含##和##或者##

我的代码

string str1 = "Some text that contained } and again } or maybe }";
// Some time its contained ##

string[] words;
if (str1.Contains("}"))
{
    words = str1.Split("}");
}
else if (str1.Contains ("##"))
{
    words = str1.Split("##");
} else {
    words = null;
}
Run Code Online (Sandbox Code Playgroud)

我有2个错误

'string.Split(params char [])'的最佳重载方法匹配有一些无效的参数

参数'1':无法从'string'转换为'char []'}

.net c#

-1
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×4

winforms ×3

.net ×1

delegates ×1

visual-studio-2008 ×1