2010-03-15 44 views

回答

4

你應該能夠很容易地確定流的大小。

MemoryStream ms = new MemoryStream(); 
int length = ms.Length; 

長度現在是以字節爲單位的流的長度。這個bytenumber也應該是隻包含這個流的任何文件的大小。

編輯:

如果以像素爲單位的意思是你可以使用類似:

Image img = Image.FromStream(ms); 
int width = img.Width; 
int height = img.Height;