wince动态加载图片,数据类型转换
2007-12-26 13:25
429 查看
最近刚开始折腾wince(c#),记录一下:
1、动态加载图片
声明个索引:
private uint img_idx;
函数实现:
Bitmap bmp;
string[] fname = new string[] ...{ "/Program Files/test/2.png", "/Program Files/test/3.png", "/Program Files/test/4.png" };
MessageBox.Show("显示下一个界面!");
bmp = new Bitmap(fname[img_idx]);
pictureBox1.Image = Image.FromHbitmap(bmp.GetHbitmap());
img_idx++;
if (img_idx > 2)
img_idx = 0;
2、整形转换
字节到整形
byte[] test8 = new byte[] ...{ 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8 };
uint test32;
string tt;
test32 = BitConverter.ToUInt32(test8, 4);
tt = System.Convert.ToString(test32);
MessageBox.Show(tt);
整形到字节
byte[] test8 = new byte[] ...{0,0,0,0};
uint test32,i;
string tt;
test32 = 0x12345678;
test8 = BitConverter.GetBytes(test32);
for (i = 0; i < 4; i++)
...{
tt = System.Convert.ToString(test8[i]);
MessageBox.Show(tt);
}
PC默认是小端,结果是120,86,52,18(十进制显示)
1、动态加载图片
声明个索引:
private uint img_idx;
函数实现:
Bitmap bmp;
string[] fname = new string[] ...{ "/Program Files/test/2.png", "/Program Files/test/3.png", "/Program Files/test/4.png" };
MessageBox.Show("显示下一个界面!");
bmp = new Bitmap(fname[img_idx]);
pictureBox1.Image = Image.FromHbitmap(bmp.GetHbitmap());
img_idx++;
if (img_idx > 2)
img_idx = 0;
2、整形转换
字节到整形
byte[] test8 = new byte[] ...{ 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8 };
uint test32;
string tt;
test32 = BitConverter.ToUInt32(test8, 4);
tt = System.Convert.ToString(test32);
MessageBox.Show(tt);
整形到字节
byte[] test8 = new byte[] ...{0,0,0,0};
uint test32,i;
string tt;
test32 = 0x12345678;
test8 = BitConverter.GetBytes(test32);
for (i = 0; i < 4; i++)
...{
tt = System.Convert.ToString(test8[i]);
MessageBox.Show(tt);
}
PC默认是小端,结果是120,86,52,18(十进制显示)
相关文章推荐
- MACOS获得 CGContextRef 获得图片数据类型转换 NSImage、CIImage、CGImageRef
- 动态数据类型转换
- java 中能否使用 动态加载的类(Class.forName) 来做类型转换?
- Struts2 (动态调用、接收请求参数、类型转换、数据验证、拦截器)Day:2018/2/7
- 利用java反射机制 读取配置文件 实现动态类加载以及动态类型转换
- Silverlight项目笔记7:xml/json数据解析、TreeView、引用类型与数据绑定错误、图片加载、虚拟目录设置、silverlight安全机制引发的问题、WebClient缓存问题
- Gdiplus byte *数据转换为Bitmap类型图片
- java 图片缩放,获取图片类型,字节数据和流的转换
- 图片数据类型转换 NSImage、CIImage、CGImageRef
- 利用java反射机制 读取配置文件 实现动态类加载以及动态类型转换
- 获取本地路径的方法,在沙河路径中保存图片 ,将保存文件到沙河路径下 把图片转换成NSData类型的数据来保存文件
- jquery动态加载图片数据练习代码
- 从JSON取数据实现图片瀑布流布局的数据动态加载
- jquery动态加载图片数据练习代码
- C#动态加载DLL并进行类型转换
- masterslider支持动态加载数据,懒加载图片
- 【JavaWeb-16】静态参数封装、3种动态参数封装、数据类型转换、struts标签、验证器
- ListView动态加载图片以及分段加载数据
- WinCE下加载各种类型图片,便于绘制图像的类
- C#中的数据类型转换和图片拼接