zoukankan      html  css  js  c++  java
  • bitmap.fromstream

    private Bitmap GetBitMapFromFile( string imageFileName )
    {
    byte[] buffer = null;
    Stream stream = null;
    try
    {
    stream = new FileStream(
    imageFileName, // String Path
    FileMode.Open , // FileMode
    FileAccess.Read , // FileAccess
    FileShare.Read , // FileShare
    4096 , // bufferSize
    true ); // useAsync

    buffer = new byte[stream.Length];
    stream.Seek(0,SeekOrigin.Begin);
    stream.Read(buffer,0,(int)stream.Length);
    }
    catch( )// make simple for posting
    {
    }
    finally
    {
    if( stream != null )
    {
    stream.Close();
    }
    }
    // Memory RetentionFrown
    // The new MemoryStream cause memory retention
    return Bitmap.FromStream(new MemoryStream(buffer)) as Bitmap;
    }
  • 相关阅读:
    tzselect
    tzfile
    ttytype
    tty
    TRUNCATE
    true
    troff
    touch
    Open vSwitch
    Web 在线文件管理器学习笔记与总结(5)修改文件内容
  • 原文地址:https://www.cnblogs.com/si812cn/p/1673000.html
Copyright © 2011-2022 走看看