Project1

标题: [周边工具]一个颜色工具 [打印本页]

作者: IamI    时间: 2007-12-31 00:50
标题: [周边工具]一个颜色工具
恩,自己用VB写的一个废物,主要就是写脚本时方便一点,不用去记颜色了{/gg}(《=懒人)
主要功能就是配置RGBA颜色,按F12复制到剪贴板,F4使用Windows的ColorDialog

地址:http://rpg.blue/upload_program/files/color.rar
(才18来K……VB写的就是小……)

P.S.右键菜单很会被遗忘~
作者: IamI    时间: 2007-12-31 00:50
标题: [周边工具]一个颜色工具
恩,自己用VB写的一个废物,主要就是写脚本时方便一点,不用去记颜色了{/gg}(《=懒人)
主要功能就是配置RGBA颜色,按F12复制到剪贴板,F4使用Windows的ColorDialog

地址:http://rpg.blue/upload_program/files/color.rar
(才18来K……VB写的就是小……)

P.S.右键菜单很会被遗忘~
作者: 洛克人SZ    时间: 2007-12-31 01:00
很不错的东西,要是加入拾色功能就更好了。
还有,调用 Windows 的 ColorDialog 不是按 F5 而是按 F4 …………
作者: IamI    时间: 2007-12-31 01:02
以下引用洛克人SZ于2007-12-30 17:00:35的发言:

很不错的东西,要是加入拾色功能就更好了。
还有,调用 Windows 的 ColorDialog 不是按 F5 而是按 F4 …………

拾色理论上就是把整个屏幕截下来,转换到Bitmap,然后getcolor,这个就麻烦多了,偷懒不干~
作者: 洛克人SZ    时间: 2007-12-31 01:13
其实并不麻烦,可以看看这些代码,用 VB6 写的(不是我)。

  1. Option Explicit

  2. ' Getpixel sample by Matt Hart - [email protected]
  3. ' http://matthart.com
  4. '
  5. ' This sample shows how to get the pixel color of any point
  6. ' on the screen. The GetPixel API requires CLIENT coordinates,
  7. ' so you must first get the window handle and hDC where the
  8. ' cursor is. Once you get that, you can get the pixel.
  9. '
  10. ' However, there's one "gotcha" I found while writing this.
  11. ' Window titlebars return a "-1" for the pixel color, which
  12. ' is invalid! So, what I did to get around that was use
  13. ' BitBlt to copy a pixel from that device to the PictureBox
  14. ' control I'm using to show the colors, then use the Point
  15. ' method to check the color.

  16. Private Type POINTAPI
  17.     x As Long
  18.     y As Long
  19. End Type
  20. Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC 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 dwRop As Long) As Long
  21. Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
  22. Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
  23. Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
  24. Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
  25. Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long

  26. Private Sub Timer1_Timer()
  27.     Static lX As Long, lY As Long
  28.     On Local Error Resume Next
  29.     Dim P As POINTAPI, h As Long, hD As Long, r As Long
  30.     GetCursorPos P
  31.     If P.x = lX And P.y = lY Then Exit Sub
  32.     lX = P.x: lY = P.y
  33.     lblData(0).Caption = lX & "," & lY
  34.     h = WindowFromPoint(lX, lY)
  35.     lblData(1).Caption = h
  36.     hD = GetDC(h)
  37.     lblData(2).Caption = hD
  38.     ScreenToClient h, P
  39.     lblData(3).Caption = P.x & "," & P.y
  40.     r = GetPixel(hD, P.x, P.y)
  41.     If r = -1 Then
  42.         BitBlt Picture1.hdc, 0, 0, 1, 1, hD, P.x, P.y, vbSrcCopy
  43.         r = Picture1.Point(0, 0)
  44.     Else
  45.         Picture1.PSet (0, 0), r
  46.     End If
  47.     lblData(4).Caption = Hex$(r)
  48.     Picture1.BackColor = r
  49. End Sub
复制代码

作者: 越前リョーマ    时间: 2007-12-31 03:54
颜色代码?

这种?
#6F2BD5
作者: link006007    时间: 2007-12-31 04:07
以下引用越前リョーマ于2007-12-30 19:54:26的发言:

颜色代码?

这种?
#6F2BD5

那个16进制的RGB值 应该不是他们说的吧




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1