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

 

 ·求压缩算法,(2000分)    »显示摘要«
    摘要: 我现在遇到一个难题,需要一个压缩算法,请教各位高手! 我现在有一个二进制串: 110001000001111100001010100000011100000000000000011010100..... 需要一个算法,压缩这个二进制串,但要求结果也是二进制串 010100101010....(当然要比上面的小) 然后需要一个响应的解压缩算法,还原成以前的串 1100010000011111......
    摘要: 向各位请教:我看到的现在网上很多自称为eip的东西只是实现了一些相关的链接,例如想自己内部mis的链接和internet相关站点的链接。而在我的理解中,eip绝不仅仅只有这些。不知谁能给我一个eip的描述或者定义。我知道ibm、方正等很多公司提出了自己的eip实施方案,不知道他们的关注点又在哪里?构建一个eip要注意那些问题? ......


,窗体上的picturebox内画的图如何打印只要解决了,

代码越少越好!  
   
 

NO.1   作者: 阿甘

打印整个窗体吧

NO.2   作者: itofly

 
   
          Visual   Basic的Printer对象支持PaintPicture方法,可以支持打印位图。其语法为:    
          Printer.PaintPicture   picture,   x1,   y1,   width1,   height1,   x2,   y2,   width2,   height2,   opcode    
          参数Picture是必需的,指明要绘制到打印机上的图形的来源源,通常是对象的Picture或Image属性。    
          参数x1,   y1也是必需的,均为单精度数值,指定参数picture所确定图形在打印机上绘制的坐标。其值的单位是由Printer的   ScaleMode   属性决定的。    
          参数Width1和Height1是可选的,都是单精度数值,指示图象的目标宽度和高度。如果目标宽度/高度比源宽度   (width2)/高度大或者小,将适当地拉伸或压缩图形。如果省略这两个参数,则使用图形的原始尺寸。    
          参数x2,   y2、Width2和Height2是可选的。它们指示参数picture确定的图象内剪贴区的坐标和大小。利用这四个参数,我们可以打印图象的一部分。默认是打印整个图象。    
          参数Opcode是可选的,是长型数值。它用来定义在将图象绘制到打印机上时对图象执行的位操作。关于位操作符常数的完整列表,请参阅   Visual   Basic帮助文件中的有关内容。对于打印机来说,这个参数较少使用;而在屏幕显示图象时往往利用这个参数实现一些特殊效果。    
          通过使用负的目标高度值   (height1)或目标宽度值   (width1)   ,可以水平或垂直翻转位图。    
          下面是一个简单的例子:    
          Printer.PaintPicture   Picture1.Image,   0,   0    
             
           
 

NO.3   作者: aSenb

Picture1.Print  
 

NO.4   作者: tonylk

使用api的绘图函数将图象绘制到vb的printer对象上,最后记得使用printer自己的方法画一点内容上去,不然会打印不出东西的.  
  Attribute   VB_Name   =   "PrintModule"  
  ***********************************************  
  API   Declares  
  2002.11.14  
  Private   Type   RECT  
                  Left   As   Long  
                    As   Long  
                  Right   As   Long  
                  Bottom   As   Long  
  End   Type  
   
  Private   Type   POINTAPI  
                  x   As   Long  
                  y   As   Long  
  End   Type  
   
  Private   Declare   Function   DrawText   Lib   "user32"   Alias   "DrawTextA"   (ByVal   hdc   As   Long,   ByVal   lpStr   As   String,   ByVal   nCount   As   Long,   lpRect   As   RECT,   ByVal   wFormat   As   Long)   As   Long  
  Private   Declare   Function   MoveToEx   Lib   "gdi32"   (ByVal   hdc   As   Long,   ByVal   x   As   Long,   ByVal   y   As   Long,   lpPoint   As   POINTAPI)   As   Long  
  Private   Declare   Function   LineTo   Lib   "gdi32"   (ByVal   hdc   As   Long,   ByVal   x   As   Long,   ByVal   y   As   Long)   As   Long  
   
  ***********************************************  
  draw   a   line   from   (X1,Y1)   to   (X2,Y2)   on   the   hdc  
  2002.11.14  
  Private   Sub   P_DrawLine(DC   As   Long,   X1   As   Long,   Y1   As   Long,   X2   As   Long,   Y2   As   Long)  
          Dim   PointTmp   As   POINTAPI  
          If   MoveToEx(DC,   X1,   Y1,   PointTmp)   =   0   Then  
                  Debug.Print   "Error   when   moveto   point!!"  
          End   If  
          If   LineTo(DC,   X2,   Y2)   =   0   Then  
                  Debug.Print   "Error   when   draw   line!!"  
          End   If  
  End   Sub  
   
  ***********************************************  
  draw   the   text   in   rect(X1,Y1,X1+Wid,Y1+Hei)   on   the   hdc  
  2002.11.14  
  Private   Sub   P_DrawText(DC   As   Long,   Text   As   String,   X1   As   Long,   Y1   As   Long,   Wid   As   Long,   Hei   As   Long)  
          Dim   TextRect   As   RECT  
          TextRect.Left   =   X1  
          TextRect.   =   Y1  
          TextRect.Right   =   X1   +   Wid  
          TextRect.Bottom   =   Y1   +   Hei  
          If   DrawText(DC,   Text,   Len(Text),   TextRect,   0)   =   0   Then  
                  Debug.Print   "Error   when   draw   text!!"  
          End   If  
  End   Sub  
   
  ***********************************************  
  print   listview   on   the   pictures   canvas   or   printers   canvas  
  if   the   canvas   is   a   picturebox,   only   the   fist   page   will   be   displayed  
  2002.11.14  
  Public   Function   PrintListview(LView   As   ListView,   Canvas   As   Object,   Wid   As   Integer,   Hei   As   Integer)   As   Boolean  
          On   Error   GoTo   ErrorHandler  
           
          Dim   PageRect   As   RECT  
          Dim   TextHeight   As   Long  
          Dim   ColumnWidth   As   Long  
          Dim   CurLine   As   Long,   CurColumn   As   Long  
          Dim   I   As   Integer,   J   As   Integer  
           
          PrintListview   =   True  
          If   LView.ColumnHeaders.Count   =   0   Then  
                  Exit   Function  
          End   If  
          If   (Canvas   Is   Printer)   Then  
                  Canvas.Print   "."   !!use   printer   objects   original   method   to   print   something,else   nothing   will   be   printed!!  
          End   If  
          ***********************************************  
          set   the   initialize   values  
          TextHeight   =   Canvas.TextHeight("H")  
          PageRect.Left   =   Wid   *   0.05  
          PageRect.   =   Hei   *   0.05  
          PageRect.Right   =   Wid   *   0.95  
          PageRect.Bottom   =   Hei   *   0.9  
          ColumnWidth   =   (PageRect.Right   -   PageRect.Left)   /   LView.ColumnHeaders.Count  
          CurLine   =   PageRect.  
          CurColumn   =   PageRect.Left  
           
          ***********************************************  
          print   column   header  
          Call   P_DrawLine(Canvas.hdc,   PageRect.Left,   CurLine,   PageRect.Right,   CurLine)  
          CurLine   =   CurLine   +   Hei   *   0.005  
                   
          For   J   =   1   To   LView.ColumnHeaders.Count  
                  Call   P_DrawText(Canvas.hdc,   Space(2)   &   LView.ColumnHeaders.Item(J).Text,   CurColumn,   CurLine,   ColumnWidth,   TextHeight)  
                  CurColumn   =   CurColumn   +   ColumnWidth  
          Next  
          CurLine   =   CurLine   +   TextHeight   +   Hei   *   0.005  
           
          Call   P_DrawLine(Canvas.hdc,   PageRect.Left,   CurLine,   PageRect.Right,   CurLine)  
          CurLine   =   CurLine   +   Hei   *   0.005  
           
          ***********************************************  
          print   items  
          For   I   =   1   To   LView.ListItems.Count  
                  Set   ListViewItem   =   LView.ListItems(I)  
                  CurColumn   =   PageRect.Left  
                  Call   P_DrawText(Canvas.hdc,   Space(2)   &   LView.ListItems(I).Text,   CurColumn,   CurLine,   ColumnWidth,   TextHeight)  
                  CurColumn   =   CurColumn   +   ColumnWidth  
                  For   J   =   1   To   LView.ColumnHeaders.Count   -   1  
                          Call   P_DrawText(Canvas.hdc,   Space(2)   &   ListViewItem.SubItems(J),   CurColumn,   CurLine,   ColumnWidth,   TextHeight)  
                          CurColumn   =   CurColumn   +   ColumnWidth  
                  Next  
                  CurLine   =   CurLine   +   TextHeight   +   Hei   *   0.005  
                   
                  Call   P_DrawLine(Canvas.hdc,   PageRect.Left,   CurLine,   PageRect.Right,   CurLine)  
                  CurLine   =   CurLine   +   Hei   *   0.005  
                   
                  ***********************************************  
                  finish   current   page,start   next   page  
                  If   (CurLine   >=   PageRect.Bottom)   And   (I   <>   LView.ListItems.Count)   Then  
                          ***********************************************  
                          draw   column   line  
                          CurColumn   =   PageRect.Left  
                          CurLine   =   CurLine   -   Hei   *   0.005  
                          For   J   =   1   To   LView.ColumnHeaders.Count   +   1  
                                  Call   P_DrawLine(Canvas.hdc,   CurColumn,   PageRect.,   CurColumn,   CurLine)  
                                  CurColumn   =   CurColumn   +   ColumnWidth  
                          Next  
                          ***********************************************  
                          if   neednt   to   draw   next   page  
                          If   Not   (Canvas   Is   Printer)   Then  
                                  Exit   Function  
                          Else  
                                  Call   P_DrawText(Canvas.hdc,   "Page:"   &   Canvas.Page,   PageRect.Left,   PageRect.Bottom   +   2   *   TextHeight,   PageRect.Right,   PageRect.Bottom   +   3   *   TextHeight)  
                                  Canvas.NewPage  
                                  Canvas.Print   "."   !!!!!!!!!!!!!  
                          End   If  
                          ***********************************************  
                          reset   the   initialize   values  
                          CurLine   =   PageRect.  
                          CurColumn   =   PageRect.Left  
                          ***********************************************  
                          print   column   header   of   next   page  
                          Call   P_DrawLine(Canvas.hdc,   PageRect.Left,   CurLine,   PageRect.Right,   CurLine)  
                          CurLine   =   CurLine   +   Hei   *   0.005  
                           
                          For   J   =   1   To   LView.ColumnHeaders.Count  
                                  Call   P_DrawText(Canvas.hdc,   Space(2)   &   LView.ColumnHeaders.Item(J).Text,   CurColumn,   CurLine,   ColumnWidth,   TextHeight)  
                                  CurColumn   =   CurColumn   +   ColumnWidth  
                          Next  
                          CurLine   =   CurLine   +   TextHeight   +   Hei   *   0.005  
                           
                          Call   P_DrawLine(Canvas.hdc,   PageRect.Left,   CurLine,   PageRect.Right,   CurLine)  
                          CurLine   =   CurLine   +   Hei   *   0.005  
                  End   If  
          Next  
           
          ***********************************************  
          draw   column   line  
          CurColumn   =   PageRect.Left  
          CurLine   =   CurLine   -   Hei   *   0.005  
          For   J   =   1   To   LView.ColumnHeaders.Count   +   1  
                  Call   P_DrawLine(Canvas.hdc,   CurColumn,   PageRect.,   CurColumn,   CurLine)  
                  CurColumn   =   CurColumn   +   ColumnWidth  
          Next  
          ***********************************************  
          end   printing  
          If   (Canvas   Is   Printer)   Then  
                  Call   P_DrawText(Canvas.hdc,   "Page:"   &   Canvas.Page,   PageRect.Left,   PageRect.Bottom   +   2   *   TextHeight,   PageRect.Right,   PageRect.Bottom   +   3   *   TextHeight)  
                  Canvas.EndDoc  
          End   If  
          Exit   Function  
           
  ErrorHandler:  
          PrintListview   =   False  
          MsgBox   Err.Number   &   ":"   &   Err.Description  
          If   Canvas   Is   Printer   Then  
                  Canvas.KillDoc  
          End   If  
  End   Function  
   
 


 ·谁有session bean+dao的资料    »显示摘要«
    摘要: 如题 ......
» 本期热门文章:

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