C#如何实现图片文本混合传输

如题所述

1,用画图函数将文本画在图片上面,你想这样吗?
2,用字节流追问

用字节流啊,怎么发送和接受

追答

如果本地的输入输出参考以下代码,再做些修改
如果是网络,以是另外的了
public string ReadTemplate(string name)
{
StreamReader sr = null;
string htmltext = null;
string filepath = Server.MapPath(_TemplatePath) + name + PageType;
if (!File.Exists(filepath)) return htmltext = "读取不到指定的!";
try
{
sr = new StreamReader(Server.MapPath(_TemplatePath) + name + PageType, _code);
htmltext = sr.ReadToEnd();
sr.Close();
}
catch { if (sr != null)sr.Close(); return htmltext = "读取模板的时候出错!"; }
return htmltext;
}

public bool WritehtmlOf(string filePath, string fileName,string str)
{
StreamWriter sw = null;
string htmlFile = Server.MapPath(filePath) + fileName + PageType;
try
{
sw = new StreamWriter(htmlFile, false, _code);
sw.Write(str);
sw.Flush();
return true;
}
catch
{

if (File.Exists(htmlFile))
{
try
{
File.Delete(htmlFile);
}
catch (Exception ex2)
{
throw ex2;
}
}
return false;
}
finally
{
if (sw != null) sw.Close();
}

}

温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-03-15
可以试试把图片数据转码成Base64文本数据。追问

怎么区分你发的是图片还是文字

相似回答