• 浅淡建立bitmap实例


    Bitmap 构造函数

    初始化 Bitmap 类的新实例。

    重载列表
    名称 说明
    Bitmap (Image) 从指定的现有图像初始化 Bitmap 类的新实例。

    由 .NET Compact Framework 支持。

    Bitmap (Stream) 从指定的数据流初始化 Bitmap 类的新实例。

    由 .NET Compact Framework 支持。

    Bitmap (String) 从指定的文件初始化 Bitmap 类的新实例。

    由 .NET Compact Framework 支持。

    Bitmap (Image, Size) 从指定的现有图像并使用指定的大小初始化 Bitmap 类的新实例。
    Bitmap (Int32, Int32) 用指定的大小初始化 Bitmap 类的新实例。

    由 .NET Compact Framework 支持。

    Bitmap (Stream, Boolean) 从指定的数据流初始化 Bitmap 类的新实例。
    Bitmap (String, Boolean) 从指定的文件初始化 Bitmap 类的新实例。
    Bitmap (Type, String) 从指定的资源初始化 Bitmap 类的新实例。
    Bitmap (Image, Int32, Int32) 从指定的现有图像并使用指定的大小初始化 Bitmap 类的新实例。
    Bitmap (Int32, Int32, Graphics) 用指定的大小和指定的 Graphics 对象的分辨率初始化 Bitmap 类的新实例。
    Bitmap (Int32, Int32, PixelFormat) 用指定的大小和格式初始化 Bitmap 类的新实例。

    由 .NET Compact Framework 支持。

    Bitmap (Int32, Int32, Int32, PixelFormat, IntPtr) 用指定的大小、像素格式和像素数据初始化 Bitmap 类的新实例。

    其实最难理解的也是困扰我许久的就是Bitmap 构造函数 (Type, String)这种形式

    从指定的资源初始化 Bitmap 类的新实例。

    public Bitmap (
        Type type,
        string resource)

    参数

    备注

    此构造函数将给定类型的命名空间与资源的字符串名称组合,并在程序集清单中查找匹配项。例如,可以将 Button 类型和 Button.bmp 传入到此构造函数中,它将查找名为 System.Windows.Forms.Button.bmp 的资源。

    private void ConstructFromResourceSaveAsGif(PaintEventArgs e)
    {
        // Construct a bitmap from the button image resource.
        Bitmap bmp1 = new Bitmap(typeof(Button), "Button.bmp");
        // Save the image as a GIF.
        bmp1.Save("c:\\button.gif", System.Drawing.Imaging.ImageFormat.Gif);
        // Construct a new image from the GIF file.
        Bitmap bmp2 = new Bitmap("c:\\button.gif");
        // Draw the two images.
        e.Graphics.DrawImage(bmp1, new Point(10, 10));
        e.Graphics.DrawImage(bmp2, new Point(10, 40));
        // Dispose of the image files.
        bmp1.Dispose();
        bmp2.Dispose();
    }

  • 相关阅读:
    (轻松一刻)神秘而又强大的蓝翔学院!而且还是当中最可怕的挖掘机系!
    IIS 反向代理二级目录及泛目录
    正则表达式匹配外链和内链
    关于 preg_replace_callbank 的学习记录
    Linux 笔记
    Linux 笔记
    Linux 笔记
    使用 Docker 安装 showdoc
    Docker 入门
    Linux 笔记
  • 原文地址:https://www.cnblogs.com/symbol441/p/946753.html
Copyright © 2020-2023  润新知