windows Mobile 开发中使用嵌入的图片等资源
来源:互联网 发布:公安 大数据 编辑:程序博客网 时间:2024/04/28 02:59
在mobile开发中,如果界面上使用 PictureBox,速度太慢,如果只想简单的显示一下图片,可以这样:
一、在项目属性中,添加一个图片资源,例如添加一个 Sample.JPG 文件,资源里面会显示一个 Sample;
二、打开项目文件夹下面的 /Properties/Resources.Designer.cs文件,找到下面这段:
/// <summary>
/// 为使用此强类型资源类的所有资源查找
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
public static System.Drawing.Bitmap Sample{
get {
object obj = ResourceManager.GetObject("Sec", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
这里 C# 已经给你声明了一个 public 类型的变量 Sample
三、好了,现在可以直接在程序里面引用这个变量了:
pictureBox1.Image = VagueRecall.Properties.Resources.Sec;
或者自己绘制:
private void MainForm_Paint(object sender, PaintEventArgs e)
{
Graphics graphics = e.Graphics;
using (Brush brush = new SolidBrush(Color.White))
{
//开始进行渲染窗口的背景
using (Image backGroupImage = VagueRecall.Properties.Resources.Sec)
{
//清空当前的背景
e.Graphics.Clear(Color.Black);
//绘制图片并缩放.
Rectangle srcRect = new Rectangle(0, 0, backGroupImage.Width, backGroupImage.Height);
//设置目标区域
//Rectangle desRect = new Rectangle(0, 0, e.ClipRectangle.Width, e.ClipRectangle.Height);
Rectangle desRect = new Rectangle(0, 0, 480, 122);
desRect.Location = new Point(0, 0);
//绘制背景图片.
e.Graphics.DrawImage(backGroupImage, desRect, srcRect, GraphicsUnit.Pixel);
}
}
}
- windows Mobile 开发中使用嵌入的图片等资源
- Windows Mobile 开发资源
- Windows Mobile 开发资源
- Windows Mobile 开发资源
- windows mobile 开发资源
- Windows Mobile 开发资源
- Windows Mobile 开发资源
- Windows Mobile 开发资源
- windows mobile下资源中添加PNG图片
- PyQt中嵌入图片资源
- C#中使用嵌入资源的图像
- 在.net中使用嵌入的资源
- .NET中使用嵌入的资源
- C#中使用嵌入的资源
- Windows Mobile 开发资源(精)
- Windows Mobile 学习开发资源
- Windows Mobile开发资源介绍
- Windows Mobile 开发资源(精)
- 移动Web开发框架及工具收集
- 解决 java.util.MissingResourceException: Can't find bundle for base name com...config, locale zh_CN 错误
- asp.net上传文件时提示,不支持给定路径的格式解决方法
- php向MySQL datetime类型插入数据
- 递归求N皇后
- windows Mobile 开发中使用嵌入的图片等资源
- WIN7旗舰版下MSserver2000安装详细
- 关于Memcache mutex设计模式的.net实现
- Flash AIR文件操:使用FileStream对象读写文件
- Kettle 在应用中遇到的一些问题和解决方法
- iPhone开发常用代码集锦
- Linux下使用Mysql数据库
- Tiny6410上安装debian基本系统的过程
- 生活