当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 可以只通过复制几个头文件和库文件吗? 如果是, 是哪几个文件呢? ......
 ·如何将字节流转换为字符串    »显示摘要«
    摘要: 我将text加密后,生成为文本文件,我要将该文本文件解密后,再在textbox.text中读出,请问该如何实现。我是使用dec加密解密的,因为解密后的stream是字节流,因而无法在textbox中显示,请问该如何解决?谢谢(最好有代码) ......


setlength(hImgData,ImgSize)出错

这个自定义函数执行到setlength(hImgData,ImgSize);时出错,请各位帮忙一下  
  function   LoadBmpFile(BmpFile:string):boolean;  
  var  
      HimgData:   array   of   array   of   int64;  
      hf:file;  
      bf:bitmapfileheader;  
      bi:bitmapinfoheader;  
      widthbytes:integer;  
      Nullcount:integer;  
      ImgSize:integer;  
      LineBytes:integer;  
      numcolors:integer;  
  begin  
      AssignFile(hf,BmpFile);  
      Reset(hf,1);//RecSize   is   an   optional   expression,   which   can   be   specified   only   if   F   is   an   untyped   file.   If   F   is   an   untyped   file,   RecSize   specifies   the   record   size   to   be   used   in   data   transfers.   If   RecSize   is   omitted,   a   default   record   size   of   128   bytes   is   assumed.  
      Blockread(hf,bf,Sizeof(Bitmapfileheader));//BlockRead   reads   Count   or   fewer   records   from   the   file   F   into   memory,   starting   at   the   first   byte   occupied   by   Buf.   The   actual   number   of   complete   records   read   (less   than   or   equal   to   Count)   is   returned   in   AmtTransferred.  
      widthbytes:=trunc(((8-(bi.biWidth*bi.biBitCount   mod   8))   mod   8   +   bi.biBitCount*bi.biWidth)/8);  
      LineBytes:=(4-(widthbytes   mod   4))   mod   4   +widthbytes;  
      Nullcount   :=   LineBytes-WidthBytes;  
      ImgSize:=   LineBytes*bi.biHeight;  
      if   bi.biClrUsed<>0   then  
          NumColors:=bi.biClrUsed  
      else  
      begin  
              if   bi.bibitcount=1   then  
                  NumColors:=2  
              else   if   bi.biBItCount=4   then  
                  NumColors:=16  
              else   if   bi.biBitCount=8   then  
                  NumColors:=256  
              else   if   bi.biBitCount=24   then  
                  NumColors:=0  
              else  
              begin  
                  showMessage(invalid   color   number!);  
                  Closefile(hf);  
                  result:=False;  
                  Exit;  
              end;  
      end;        
      if   bf.bfOffBits   <>   NumColors   *   SizeOf(RGBQUAD)   +   SizeOf(BitMapFileHeader)  
            +   SizeOf   (BitMapInfoHeader)   then  
      begin  
            ShowMessage(Invalid   color   numbers!);  
            CloseFile(hf);  
            Result   :=   False;    
            Exit;  
      end;  
      setlength(hImgData,ImgSize);  
      Blockread(hf,hImgData,SizeOf(hImgData),ImgSize);  
      CloseFile(hf);  
      Result:=True;  
  end;

NO.1   作者: qxj

长度上加1


    摘要: 我只是想要个ddraw的例子,以前有一些可惜全是fullscreen的,不好用。我现在把fullscreen去掉了,结果到处出错。本人懒得看教程,尤其e文比较差,所以希望各位能给个例子,我copy一下哈! 例子越简单越好,只有建立页面、粘贴位图就够了。如果哪位能提供一系列由简入难的例子一定给高分!如果不够再贴贴再加分! 顺便问一下,不是fullscreen是不是就不能“翻页”了啊?该怎么解......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE