我一直在寻找和寻找带有轮廓到图像的绘图文字?
在这里我的代码
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) 可能重复:
最简洁,最正确的避免交叉线程操作错误的方法?
我在运行程序时遇到错误.... {"跨线程操作无效:控制'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) 我做了一些逻辑,但它的错误?
我的代码
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) 文本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 []'}