您的位置:程序门 -> vb -> 基础类



怎么用快捷键保存屏幕放大镜中的图片


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


怎么用快捷键保存屏幕放大镜中的图片
发表于:2007-03-23 20:17:15 楼主
屏幕放大镜代码太多了
不能放在这里

屏幕放大镜,运行这个程序之后,当光标在屏幕上移动时,光标位置附近的图像会放大显示在程序窗口中。支持以不同的比例放大图像。利用windows   api函数,同时还使用了api对ini   文件进行操作。(.zip)

就是网上找的的这个文件明的

谢谢了

qq   653999965
发表于:2007-03-23 20:38:101楼 得分:0
不知道在说什么
发表于:2007-03-23 20:44:092楼 得分:0
w   r   u   say?
发表于:2007-03-23 22:25:293楼 得分:0
没明白啥意思?


═══════════════════
http://www.egooglet.com   资料、源码下载

http://bbs.j2soft.cn   论坛交流
═══════════════════
发表于:2007-03-24 10:06:394楼 得分:0
有点象windows优化大师做显卡测试的时候那个效果是吗?
我的思路是,借鉴你手头的代码,把从屏幕获得的像素写进picturebox,并保存图像。
发表于:2007-03-24 10:39:505楼 得分:0
真谢谢你们能怎么快回复我都没想到啊   谢谢   了是我没说明白

我找了给   用vb   做的屏幕放大镜   的代码   代码太多了   不能放在这里

你们可以进我的博客去看看代码

我的意思是用快捷键保存放大镜中的图片

就是这意思

代码在我的博客里   博客地址     http://blog.sina.com.cn/u/1250721294

发表于:2007-03-24 10:43:476楼 得分:0
还是进我的   金万维吧   博客也放不下那些代码:

我的金万维   是   uuicc.gnway.net

麻烦你们了啊
发表于:2007-03-24 10:50:477楼 得分:0
我的   那个屏幕放大镜源码下载地址是:

http://soft.fige.com.cn/701010486.html

http://download.csdn.net/source/152124

麻烦   谢谢了!
发表于:2007-03-24 11:04:338楼 得分:0
传上关键代码部分,就是获取屏幕图像的部分和放大的部分。
发表于:2007-03-24 11:58:249楼 得分:0
好的:

option   explicit

'user   defined   types
private   type   pointapi       'api   point   structure.
        x       as   long
        y       as   long
end   type

private   type   sizerect       'size   structure   (uses   width,   height   instead   of   bounds)
        left         as   long
        top           as   long
        width       as   long
        height     as   long
end   type

private   type   rectapi         'rect   structure   (uses   right,   bottom   bounds   instead   of   width,   height)
        left         as   long
        top           as   long
        right       as   long
        bottom     as   long
end   type

'windows   api   blt   (bitblt,   patblt,   stretchblt)   rop   constants.
private   const   srccopy                       as   long   =   &hcc0020
private   const   patcopy                       as   long   =   &hf00021

'setwindowpos   flags.
private   const   swp_nomove                 as   long   =   2
private   const   swp_nosize                 as   long   =   1
private   const   swp_noactivate         as   long   =   &h10
private   const   swp_flags                   as   long   =   swp_nomove   or   swp_nosize   or   swp_noactivate
private   const   hwnd_topmost             as   long   =   -1
private   const   hwnd_notopmost         as   long   =   -2

'module   level   variables.
private   mfscale   as   single       'scale   of   zoom   percentage   (6   =   600%)   (6   x   size   =   600%   increase)
private   mloldx     as   long           'holds   last   x-coord   of   mouse
private   mloldy     as   long           'holds   last   y-coord   of   mouse

'declare   the   windows   api   functions   that   are   to   be   used.
'alphabetical   order   to   ease   lookup   later.
private   declare   function   createcompatiblebitmap   lib   "gdi32 "   (byval   hdc   as   long,   byval   nwidth   as   long,   byval   nheight   as   long)   as   long
private   declare   function   createcompatibledc   lib   "gdi32 "   (byval   hdc   as   long)   as   long
private   declare   function   createpatternbrush   lib   "gdi32 "   (byval   hbitmap   as   long)   as   long
private   declare   function   deletedc   lib   "gdi32 "   (byval   hdc   as   long)   as   long
private   declare   function   deleteobject   lib   "gdi32 "   (byval   hobject   as   long)   as   long
private   declare   function   getcursorpos   lib   "user32 "   (lppoint   as   pointapi)   as   long
private   declare   function   getdc   lib   "user32 "   (byval   hwnd   as   long)   as   long
private   declare   function   getdesktopwindow   lib   "user32 "   ()   as   long
private   declare   function   getsyscolor   lib   "user32 "   (byval   nindex   as   long)   as   long
private   declare   function   getwindowrect   lib   "user32 "   (byval   hwnd   as   long,   lprect   as   rectapi)   as   long
private   declare   function   patblt   lib   "gdi32 "   (byval   hdc   as   long,   byval   x   as   long,   byval   y   as   long,   byval   nwidth   as   long,   byval   nheight   as   long,   byval   dwrop   as   long)   as   long
private   declare   function   releasedc   lib   "user32 "   (byval   hwnd   as   long,   byval   hdc   as   long)   as   long
private   declare   function   selectobject   lib   "gdi32 "   (byval   hdc   as   long,   byval   hobject   as   long)   as   long
private   declare   function   setpixelv   lib   "gdi32 "   (byval   hdc   as   long,   byval   x   as   long,   byval   y   as   long,   byval   crcolor   as   long)   as   long
private   declare   function   setwindowpos   lib   "user32 "   (byval   hwnd   as   long,   byval   hwndinsertafter   as   long,   byval   x   as   long,   byval   y   as   long,   byval   cx   as   long,   byval   cy   as   long,   byval   wflags   as   long)   as   long
private   declare   function   stretchblt   lib   "gdi32 "   (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

private   function   createcheckeredbrush(byval   hdc   as   long,   byval   lcolor1   as   long,   byval   lcolor2   as   long)   as   long

dim   x                       as   long
dim   y                       as   long
dim   lret                 as   long
dim   hbitmapdc       as   long
dim   hbitmap           as   long
dim   holdbitmap     as   long
       
        'convert   system   colors   if   needed
        if   lcolor1   <   0   then
                lcolor1   =   getsyscolor(lcolor1   and   &hff&)
        end   if
        if   lcolor2   <   0   then
                lcolor2   =   getsyscolor(lcolor2   and   &hff&)
        end   if
       
        'create   a   new   dc   and   bitmap   to   draw   the   brush
        hbitmapdc   =   createcompatibledc(hdc)
        hbitmap   =   createcompatiblebitmap(hdc,   8,   8)
        'select   the   bitmap   into   the   dc   for   drawing
        holdbitmap   =   selectobject(hbitmapdc,   hbitmap)
       
        'draw   the   brush 's   bitmap   (checkerboard)
        for   y   =   0   to   6   step   2
                for   x   =   0   to   6   step   2
                        lret   =   setpixelv(hbitmapdc,   x,   y,   lcolor1)
                        lret   =   setpixelv(hbitmapdc,   x   +   1,   y,   lcolor2)
                        lret   =   setpixelv(hbitmapdc,   x,   y   +   1,   lcolor2)
                        lret   =   setpixelv(hbitmapdc,   x   +   1,   y   +   1,   lcolor1)
                next   x
        next   y
       
        'get   the   bitmap   back   out   of   the   dc
        hbitmap   =   selectobject(hbitmapdc,   holdbitmap)
       
        'create   the   brush   from   the   bitmap
        createcheckeredbrush   =   createpatternbrush(hbitmap)
       
        'delete   the   dc   and   bitmap   to   free   memory
        lret   =   deletedc(hbitmapdc)
        lret   =   deleteobject(hbitmap)

end   function
发表于:2007-03-24 11:59:0610楼 得分:0
private   sub   dozoom(ptmouse   as   pointapi)

dim   lret                 as   long
dim   ltemp               as   long
dim   hwnddesk         as   long
dim   hdcdesk           as   long
dim   sizsrce           as   sizerect
dim   sizdest           as   sizerect

        'get   the   desktop   dc
        hwnddesk   =   getdesktopwindow()
        hdcdesk   =   getdc(hwnddesk)
       
        'setup   the   destination   size   for   stretchblt.
        with   sizdest
                .left   =   0
                .top   =   0
                .width   =   piczoom.scalewidth
                .height   =   piczoom.scaleheight
        end   with
       
        'setup   the   source   size   for   stretchblt.
        with   sizsrce
                .left   =   ptmouse.x   -   int((sizdest.width   /   2)   /   mfscale)
                .top   =   ptmouse.y   -   int((sizdest.height   /   2)   /   mfscale)
                .width   =   int(sizdest.width   /   mfscale)
                .height   =   int(sizdest.height   /   mfscale)
                'adjust   source   and   destination   sizes   if   they   don 't   match.
                'sizsrce.size   *   mfscale   must=   sizdest.size   for   acurate   scaling.
                'destination   must   always   be   as   large   or   larger   than   piczoom.
                'adjust   the   width,   if   needed.
                ltemp   =   int(.width   *   mfscale)     '(source.width   *   mfscale   must=   sizdest.width)
                if   ltemp   >   sizdest.width   then
                        sizdest.width   =   ltemp
                elseif   ltemp   <   sizdest.width   then
                        .width   =   .width   +   1
                        sizdest.width   =   ltemp   +   mfscale
                end   if
                'adjust   the   height,   if   needed.
                ltemp   =   int(.height   *   mfscale)   '(sizsrce.height   *   mfscale   must=   sizdest.height)
                if   ltemp   >   sizdest.height   then
                        sizdest.height   =   ltemp
                elseif   ltemp   <   sizdest.height   then
                        .height   =   .height   +   1
                        sizdest.height   =   ltemp   +   mfscale
                end   if
        end   with
       
        'clear   the   current   contents.
        piczoom.cls
       
        'stretch   the   desktop   (source)   into   piczoom   (dest)
        lret   =   stretchblt(piczoom.hdc,   sizdest.left,   sizdest.top,   sizdest.width,   sizdest.height,   hdcdesk,   sizsrce.left,   sizsrce.top,   sizsrce.width,   sizsrce.height,   srccopy)
       
        'release   the   desktop   dc
        lret   =   releasedc(hwnddesk,   hdcdesk)
       
        'redraw   the   grid,   if   needed
        if   chkgrid.value   =   vbchecked   then
                call   drawgrid
        end   if
       
        piczoom.refresh
       
end   sub
发表于:2007-03-24 11:59:2511楼 得分:0
private   sub   drawgrid()

dim   iwidth             as   integer
dim   iheight           as   integer
dim   lret                 as   long
dim   hbrush             as   long
dim   holdbrush       as   long
dim   fx                     as   single
dim   fy                     as   single

        if   mfscale   > =   3   then
       
                'create   a   checkered   brush   (dark   and   light   grey)...
                hbrush   =   createcheckeredbrush(piczoom.hdc,   &h808080,   &hc0c0c0)
                '...and   select   it   into   the   picturebox
                holdbrush   =   selectobject(piczoom.hdc,   hbrush)
               
                iwidth   =   piczoom.scalewidth
                iheight   =   piczoom.scaleheight
               
                'draw   the   gridlines   using   the   checkered   pattern   brush.
                for   fx   =   0   to   iwidth   step   mfscale
                        lret   =   patblt(piczoom.hdc,   int(fx),   0,   1,   iheight,   patcopy)
                next
                for   fy   =   0   to   iheight   step   mfscale
                        lret   =   patblt(piczoom.hdc,   0,   int(fy),   iwidth,   1,   patcopy)
                next
               
                'put   the   old   brush   back   and   delete   the   new   one   to   free   memory
                hbrush   =   selectobject(piczoom.hdc,   holdbrush)
                lret   =   deleteobject(hbrush)
       
        end   if
       
end   sub
发表于:2007-03-24 15:32:3212楼 得分:0
这个是用bitblt获取设备位图,用写向屏幕的代码写向picturebox就可以,picturebox在api里也可以获得窗口句柄


快速检索

最新资讯
热门点击