CommonDialog控件封装了Windows打开。保存。打印等对话框

解决方案 »

  1.   

    Printer.PaintPicture Picture1.Picture
    按Ctrl-T找Microsoft Common Dialog..
      

  2.   

    printer.PaintPicture YourPic.image,0,0,yourpic.width,yourpic.height,0,0,PrinterPic.width,PrinterPic.width,vbsrccopy
      

  3.   

    OK
    printer.PaintPicture YourPic.image,0,0,yourpic.width,yourpic.height,0,0,PrinterPic.width,PrinterPic.width,vbsrccopypaintPicture 封装了。WinApi StretchbltDeclare Function StretchBlt Lib "gdi32" Alias "StretchBlt" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long 
    说明 
    将一幅位图从一个设备场景复制到另一个。源和目标DC相互间必须兼容。这个函数会在设备场景中定义一个目标矩形,并在位图中定义一个源图象。源矩形会根据需要进行伸缩,以便与目标矩形的大小相符 
    返回值 
    Long,非零表示成功,零表示失败。会设置GetLastError 
    参数表 
    参数 类型及说明 
    hdc Long,目标设备场景 
    x,y Long,目标矩形左上角的x,y坐标,以逻辑坐标表示 
    nWidth,nHeight Long,目标矩形的宽度和高度,以逻辑坐标表示 
    hSrcDC Long,源设备场景。如光栅运算未指定一个源,则这个参数应为零 
    xSrc,ySrc Long,用源DC的逻辑坐标表示的源矩形左上角位置 
    nSrcWidth,nSrcHeight Long,分别指定用逻辑单位(以源DC为基础)传输的一幅图象的宽度和高度。如其中有一个参数的符号(指正负号)与对应的目标参数不符,位图就会在对应的轴上作镜像转换处理 
    dwRop Long,传输过程中进行的光栅运算。如刷子属于光栅运算的一部分,就使用选入目标DC的刷子 
    注解 
    可用GetDeviceCaps函数判断特定的设备场景是否支持此函数
    不可选择对源位图进行剪切或旋转处理,源位图也不能是一个图元文件设备场景
     
      

  4.   

    printer.PaintPicture YourPic.image,0,0,yourpic.width,yourpic.height,0,0,PrinterPic.width,PrinterPic.width,vbsrccopy只看PaintPicture方法。
    Yourpic.image是你要打印的图像。
    0:你要打印源图像的左上角X位置
    0:你要打印源图像的左上角Y位置
    YourPic.width:你要打印源图像的Width
    Yourpic.Height:0:你要打印源图像的Height//通过上面四个参数可以打印图象的一部分
    0:打印机图像的左上角X位置
    0:打印机图像的左上角Y位置//通过上面两个参数可以设置图象在打印纸上的位置
    PrinterPic.width:打印图像的Width
    PrinterPic.Height:打印图像的Height//通过上面两个参数可以放缩打印的图象
    vbsrccopy:vb常数。这个参数是设置Rop运算的方式。可以通过设置Rop来合成图像。如果只是打印操作。VbSrccopy已足够。 
      

  5.   

    printer.PaintPicture YourPic.image,0,0,yourpic.width,yourpic.height,0,0,PrinterPic.width,PrinterPic.width,vbsrccopyYourPic.image:你要打印的图象。
    0,0,yourpic.width,yourpic.height。要打印图像的顶点位置宽高。可通过它来设置打印图像的区域。0,0,PrinterPic.width,PrinterPic.width图像在打印纸上的位置和宽高。可以放缩图像。
    VbSrcCopy:Vb常数Rop方式。(Rop可以合成图像)如是打印操作Vbscrcopy已足够。