+ -
当前位置:首页 → 问答吧 → 2进制打开文件

2进制打开文件

时间:2011-12-13

来源:互联网

Dim blob() As Byte
Open Fname For Binary As #1
ReDim blob(LOF(1))
Get #1, , blob()
Close #1

这个是VB的2进制打开文件在.NET中该怎么转换?

作者: lxq19851204   发布时间: 2011-12-13

Private Function ReadFile(ByVal nFileName As String) As Byte()
  Dim i As New IO.FileStream(nFileName, IO.FileMode.OpenOrCreate)
  Dim n(i.Length - 1) As Byte
  i.Read(n, 0, i.Length)
  Return n
  End Function

作者: haoting987   发布时间: 2011-12-13

Private Function ReadFile(ByVal nFileName As String) As Byte()
  Dim i As New IO.FileStream(nFileName, IO.FileMode.OpenOrCreate)‘开流
  Dim n(i.Length - 1) As Byte
  i.Read(n, 0, i.Length)’读流
  i.Close()'关流
  Return n
  End Function

作者: haoting987   发布时间: 2011-12-13

LS的谢谢了,再帮我看个问题?
Private Sub DrawPicture(ByVal Pict As IPictureDisp)
  ' Must use hidden PictureBox to easily resize picture.
  Set HiddenPict.Picture = Pict
  Picture1.PaintPicture HiddenPict.Picture, _
  0, 0, Picture1.ScaleWidth, _
  Picture1.ScaleHeight, _
  0, 0, HiddenPict.ScaleWidth, _
  HiddenPict.ScaleHeight, vbSrcCopy
  Picture1.Picture = Picture1.Image
End Sub

在VB.NET中IPictureDisp好像没了.

作者: lxq19851204   发布时间: 2011-12-13

look

http://topic.csdn.net/t/20020624/09/825261.html

作者: Sandy945   发布时间: 2011-12-13

Private Sub DrawPicture(ByVal nImage As Image)
  Dim i As Bitmap
  Dim g As Graphics
  i = New Bitmap(Picture1.Width, Picture1.Height) '新图片大小
  g = Graphics.FromImage(i)
  g.DrawImage(nImage, New Rectangle(0, 0, Picture1.Width, Picture1.Height), New Rectangle(0, 0, nImage.Width, nImage.Height), GraphicsUnit.Pixel) '拉伸画 
  Picture1.Image = i
  '以上等效于 Picture1.SizeMode = PictureBoxSizeMode.StretchImage  

  End Sub

作者: haoting987   发布时间: 2011-12-13

热门下载

更多