zoukankan      html  css  js  c++  java
  • [转载]Converting a bitmap to a byte array

    出自 OceanChip http://www.cnblogs.com/Oceanchip/archive/2006/12/06/583758.html

    方法一:

    Code

    in most cases this works fine, because your bitmap doesn't have an alpha channel. But if it does, and you want to preserve it, then use Format32bppArgb in the fist line when locking the bitmap.
    I wish I could think of a way of doing this without locking the bitmap (ie, you could use GCHandle.Alloc() and then call Marshal.Copy() using the created handle, but the problem is I wouldnt know the size of the bitmap without locking it's bits and the Marshal.Copy() function needs to know the size).

    Code

    方法二:

    Code
  • 相关阅读:
    WinForm获取窗体关闭原因和是否取消关闭值
    DIV CSS 居中代码(以及靠右)
    C#获取本机所有IP地址(包括局域网和本机外网IP)
    C# WinForm关闭窗体确认
    .NET WinForm全屏和退出以及蓝屏黑屏等
    HTML5标签
    C# 文件、文件夹操作语句(删除,创建,移动,检查是否存在)
    jquery聚焦文本框
    JS当前页面登录注册框,固定DIV,底层阴影
    Visual Studio 怎样添加引用
  • 原文地址:https://www.cnblogs.com/mishy/p/1288185.html
Copyright © 2011-2022 走看看