如何把一图像嵌在程序内 不用指定明确路径,使其在程序内部,这样只要程序文件完整,就不需要外部文件。是用resources吗,具体怎么办 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 resources也可以还可以把图片作为嵌入的资源加到项目里,然后直接用这个嵌入的资源文件 /// <summary> /// 根据文件名称,从"ZJGL.InitResources.dll“中获取文本 /// </summary> /// <param name="filename"></param> /// <returns></returns> private static string GetStringFromInitResources(string filename) { string sPath = Assembly.GetExecutingAssembly().CodeBase; int n = sPath.LastIndexOf("/"); sPath = sPath.Substring(0, n); Assembly a = Assembly.LoadFrom(Path.Combine(sPath,InitResourcesDLL)); Stream strm = a.GetManifestResourceStream( InitResourcesProjectName + "." + filename); .... } 打开项目中的Properties--》Resources.resx-->添加资源就可以了! 我发了个C#版的Kinect切水果 定时器重启后不运行了 OA系统源代码,快快下载 我用vs.net2005發布程序時的一個憑証快要過期了,如何修改此憑証的有效期呀,另外弄的憑証又讓種序發不了,暈。 如何使form窗体总在最前端显示~~~~~并使文字窗体中滚动实现!!!!!! 怎样在软件上实现刷新功能呢?使用.net工具C#写的 C# 类继承错误 谁写过类似{$PageNav$}这种的标签,帮忙看看!! 点击button按钮无反应 两个问题.... excel导入sqlsever棘手的问题 c#写的功能,打包后后在别人机子上不能用
/// <summary>
/// 根据文件名称,从"ZJGL.InitResources.dll“中获取文本
/// </summary>
/// <param name="filename"></param>
/// <returns></returns>
private static string GetStringFromInitResources(string filename)
{
string sPath = Assembly.GetExecutingAssembly().CodeBase;
int n = sPath.LastIndexOf("/");
sPath = sPath.Substring(0, n);
Assembly a = Assembly.LoadFrom(Path.Combine(sPath,InitResourcesDLL)); Stream strm = a.GetManifestResourceStream( InitResourcesProjectName + "." + filename); ....
}
就可以了!