本文整理汇总了C#中Bitmap.GetBitmap方法的典型用法代码示例。如果您正苦于以下问题:C# Bitmap.GetBitmap方法的具体用法?C# Bitmap.GetBitmap怎么用?C# Bitmap.GetBitmap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitmap
的用法示例。
在下文中一共展示了Bitmap.GetBitmap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Bitmap_GetBitmap
public MFTestResults Bitmap_GetBitmap()
{
MFTestResults result = MFTestResults.Fail;
ArrayList bitmaps = new ArrayList();
Log.Comment("Allocate a bitmap and then get it.");
try
{
using (Bitmap window = new Bitmap(UntitledBmp.Untitled, Bitmap.BitmapImageType.Bmp))
{
Log.Comment("Verify what we put in is what we get out.");
byte[] bitmap = window.GetBitmap();
byte[] convertedOriginal = ConvertOriginal(UntitledBmp.Untitled);
Log.Comment("Don't include the header from the original file which has an offset of: xx");
Log.Comment("Verify that the length of the resultant bitmap is the same as the input bitmap");
for (int i = 0; i < bitmap.Length; ++i)
{
if (bitmap[i] != convertedOriginal[i])
{
Log.Comment("The lengths are the same but the input image is different from the resultant image at position: " + i.ToString());
return result;
}
}
result = MFTestResults.Pass;
}
}
catch (Exception e)
{
Log.Comment("Incorrectly threw exception: " + e.ToString());
result = MFTestResults.Fail;
}
return result;
}