[GDI+] 创建Images的两种方式

王朝other·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

使用Bitmap构造完成一个新的image对象,大小为xsize,ysize

[C#]

Bitmap myImage = new Bitmap(<xsize>,<ysize>);

[VB]

Dim MyImage = new Bitmap(<xsize>,<ysize>)

下面这个方法创建一个默认颜色深度的Images对象,也可以使用像素格式化的参数构造

[C#]

Bitmap myImage = new Bitmap(<xsize>,<ysize>,PixelFormat.<format>);

[VB]

Dim MyImage = new Bitmap(<xsize>,<ysize>,PixelFormat.<format>)

Pixel Formats valid for the creation of a bitmap image are:

Format16bppArgb1555

Format16bppGrayScale

Format16bppRgb555

Format16bppRgb565

Format1bppIndexed

Format24bppRgb

Format32bppArgb

Format32bppPArgb

Format32bppRgb

Format48bppRgb

Format4bppIndexed

Format64bppArgb

Format64bppPArgb

Format8bppIndexed

Images 可以从磁盘装在标准格式的位图文件(JPEG, GIF, TIFF or windows Bitmap)

可以使用方法 Image.FromFile 装载指定的 Image 文件

[C#]

Bitmap bm = (Bitmap)Image.FromFile("<filename>");

[VB]

Dim bm as Bitmap = CType(Image.FromFile("<filename">),Bitmap)

[待续...]

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有  導航