各位高手:
    许多抓图软件都能抓取徒手绘制区域的图象,它的思路大概是这样的:先把整个桌面图象拷贝到一个最大化Form的image1上(image1的范围属性设为整个窗口客户区),然后在image1上徒手绘制任意区域。关于在image1上徒手绘制任意区域并截取相应区域图象,谁能给正确思路及代码???圆,矩形及其他规则图形呢???

解决方案 »

  1.   

    各位高手:
        许多抓图软件都能抓取徒手绘制区域的图象,它的思路大概是这样的:先把整个桌面图象拷贝到一个最大化Form的image1上(image1的范围属性设为整个窗口客户区),然后在image1上随手绘制任意区域, 在image1上随手绘制任意区域容易编程,问题是对画出的任意线条如何进行填充,大概是线条封闭区域外用白色填充,再拷贝相应区域图象,这样就实现了截图,关键问题是对画出的任意线条如何进行填充,有时随手绘制的线条多次交错,十分复杂,大概不会是分析画出点的坐标,然后用floodfill( )进行白色填充吧? 这方法太苯了!! 谁能给正确思路及代码???圆,矩形及其他规则图形呢???
      

  2.   

    我也想知道方法啊!大家帮帮忙.最近比较急着用!
    我想实现的功能是按下按钮的时候抓取窗体上image控件中显示的内容.
      

  3.   

    copyrect,具体使用参考DELPHI自带的帮助。
      

  4.   

    使用Region操作, 具体查阅Windows GDI中有关Region部分的内容.
    你可以建立规则图形的Region及多边形Region, 然后可以使用CombineRgn函数对两个Region进行操作得到新的第三个Region, 其操作可以是 取并集, 取交集, 一个Region减去另一个Region等然后可以使用FillRgn进行填充
    CombineRgn Combines two regions and stores the result in a third region. 
    CreateEllipticRgn Creates an elliptical region. 
    CreateEllipticRgnIndirect Creates an elliptical region. 
    CreatePolygonRgn Creates a polygonal region. 
    CreatePolyPolygonRgn Creates a region consisting of a series of polygons. 
    CreateRectRgn Creates a rectangular region. 
    CreateRectRgnIndirect Creates a rectangular region. 
    CreateRoundRectRgn Creates a rectangular region with rounded corners. 
    EqualRgn Checks the two specified regions to determine whether they are identical. 
    ExtCreateRegion Creates a region from the specified region and transformation data. 
    FillRgn Fills a region by using the specified brush. 
    FrameRgn Draws a border around the specified region by using the specified brush. 
    GetPolyFillMode Retrieves the current polygon fill mode. 
    GetRegionData Fills the specified buffer with data describing a region. 
    GetRgnBox Retrieves the bounding rectangle of the specified region. 
    InvertRgn Inverts the colors in the specified region. 
    OffsetRgn Moves a region by the specified offsets. 
    PaintRgn Paints the specified region by using the brush currently selected into the device context. 
    PtInRegion Determines whether the specified point is inside the specified region. 
    RectInRegion Determines whether any part of the specified rectangle is within the boundaries of a region. 
    SetPolyFillMode Sets the polygon fill mode for functions that fill polygons. 
    SetRectRgn Converts a region into a rectangular region with the specified coordinates. 
      

  5.   

    各位高手:
        许多抓图软件都能抓取正在播放的视频为图片, 然后把它保存在硬盘中. 普通的截图
    代码不能截取正在播放的视频为图片, 但我发现下列普通的截图代码也能对视频进行截图,
    可是编译后有时能对视频截图, 有时却不能, 为什么??? 这样才能使这段代码不论何时都能对视频进行截图?????               TCanvas *Desk =new TCanvas();
                   Graphics::TBitmap *Bmp=new Graphics::TBitmap();
                   RECT rect;
        
                   Desk->Handle=GetDC(0);
                   rect=Rect(0,0,Screen->Width,Screen->Height);
                   Bmp->Width=rect.right-rect.left;
                   Bmp->Height=rect.bottom-rect.top;
                   Bmp->Canvas->CopyRect(
                   Rect(0,0,Bmp->Width,Bmp->Height),
                   Desk,
                   rect);               AnsiString FileName;
                   if(OpenDialog->Execute()) 
                   {
                      FileName = OpenDialog->FileName;
                      Bmp->SaveToFile(FileName); 
                   }
      

  6.   

    如果视频是用DirectX播放的,用普通的截屏是不能截取图像的,给你个参考:
    http://topic.csdn.net/t/20051106/11/4374651.html
      

  7.   

    各位高手: 
       象HyperSnap那样的抓图软件能设置要截取的窗口的宽和高的像素大小(可以大于屏幕的像素大小),并能截取该窗口完整的图像,怎样编程???
      

  8.   

    各位高手:   象HyperSnap那样的抓图软件能设置要截取的窗口的宽和高的像素大小(可以大于屏幕的像素大小),并能截取该窗口完整的图像,怎样编程实现啊???   另, 像snapit那样的抓图软件能进行DOS截屏, 又怎样编程实现呢???
      

  9.   

    看了半天不知道啥个意思,如果只是不规则区域选取,只用GDI+就可以了,我用的VB,抱歉Delphi 下就不会用了~~~~~