SLOW bitmap from Stream

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,there
i 'm writing an application about bitmap displaying.But i find it
works not very well because of the terrorable performance .

here's my code

/// <summary>
/// Get BMP according to the FrameNumber,then display
/// </summary>
/// <param name="FrameNo"></param>
/// <param name="FandR_Flag">direction</param>
/// <returns></returns>
public Bitmap createImage(int FrameNo, int FandR_Flag)
{
string xustr;
byte[] xutest;
xustr = "CAM";

//find image,cost about 1ms
xutest = ri.Fun_GetSpeData(xustr, FrameNo, FandR_Flag);

//read byte[] into memostream,cost about 1ms
MemoryStream ms = new MemoryStream(xutest, 0, xutest.Length);

//here cost 423ms to construct an bmp, what happened
here?!!!!!!!!!!!!!!!!!!!!!!!!
Bitmap bmp = new Bitmap(ms);

xutest = null;
ms.Close();
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
return bmp;
}

Any suggestion?

Thanks in advance~

Regards,

Freesc
.



Relevant Pages

  • Re: System.Drawing.Bitmap.Bitmap() Error
    ... Bitmap bmp = new Bitmap; ... there is no public parameterless constructor for the ... Bitmap, ... You are assigning the return value from the "GetImage" method of whatever ...
    (microsoft.public.dotnet.general)
  • Spash screens in a Access 2003 application. How?
    ... I have a BMP file, with the same name as the application, in the folder where the app resides. ... The application also has user level security. ... Create a bitmap (bitmap: A picture made from a series of small dots, much like a piece of graph paper with certain squares filled in to form shapes and lines. ... Using Microsoft Windows Explorer, create a shortcut for your application by clicking File, pointing to New, and clicking Shortcut. ...
    (comp.databases.ms-access)
  • Re: LoadImage API
    ... >> The .bmp never shows in the picture box. ... > loads a bitmap and resizes it according ... > returning the handle of the bmp object for you. ... > device context and then "blits" it into a picture box. ...
    (comp.lang.basic.visual.misc)
  • Re: BMP
    ... That's definitely not a bmp header. ... about a bitmap after it's loaded. ...  4 | data offset ...
    (comp.graphics.algorithms)
  • RE: SLOW bitmap from Stream
    ... Visual Developer - Device Application Development MVP ... /// Get BMP according to the FrameNumber,then display ... public Bitmap createImage ... bytexutest; ...
    (microsoft.public.dotnet.framework.compactframework)