📄 uo_supperbutton.sru
字号:
$PBExportHeader$uo_supperbutton.sru
forward
global type uo_supperbutton from commandbutton
end type
type tagrect from structure within uo_supperbutton
end type
type us_bitmap from structure within uo_supperbutton
end type
type pointapi from structure within uo_supperbutton
end type
type rect from structure within uo_supperbutton
end type
type toolinfo from structure within uo_supperbutton
end type
type msg from structure within uo_supperbutton
end type
type point from structure within uo_supperbutton
end type
end forward
type tagrect from structure
long left
long top
long right
long bottom
end type
type us_bitmap from structure
long bmtype
long bmwidth
long bmheight
long bmwidthbytes
long bmplanes
long bmbitspixel
blob bmbits
end type
type pointapi from structure
long x
long y
end type
type rect from structure
long left
long top
long right
long bottom
end type
type toolinfo from structure
unsignedlong cbsize
unsignedlong uflags
unsignedlong hwnd
unsignedlong uid
rect rect
unsignedlong hinstance
long lpsztext
end type
type msg from structure
unsignedlong hwnd
unsignedlong message
unsignedlong wparam
unsignedlong lparam
long time
point pt
end type
type point from structure
long x
long y
end type
global type uo_supperbutton from commandbutton
integer width = 279
integer height = 100
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "&OK"
event ue_paint pbm_paint
event ue_lbuttondown pbm_lbuttondown
event ue_mousemove pbm_mousemove
event ue_lbuttonup pbm_lbuttonup
event ue_size pbm_size
event ue_bnhilite pbm_askcbformatname
event ue_setstyle pbm_bmsetstyle
event ue_dbclk pbm_lbuttondblclk
event ue_keyup pbm_keyup
event ue_keydown pbm_keydown
event ue_enable pbm_enable
event readme ( )
end type
global uo_supperbutton uo_supperbutton
type prototypes
//功能修正增加(pcm)
FUNCTION ulong SetPixel(ulong hdc,ulong x2,ulong y2,ulong crColor) LIBRARY "gdi32.dll"
FUNCTION ulong MoveToEx(ulong hdc,ulong x1,ulong y1,ref POINTAPI lpPoint) LIBRARY "gdi32.dll"
FUNCTION ulong GetSystemMetrics(ulong nIndex) LIBRARY "user32.dll"
FUNCTION ulong DrawFocusRect(ulong hdc,ref tagrect lpRect) LIBRARY "user32.dll"
FUNCTION ulong InflateRect(ref tagrect lpRect,ulong x1,ulong y1) LIBRARY "user32.dll"
FUNCTION ulong FrameRect(ulong hdc,ref tagrect lpRect,ulong hBrush) LIBRARY "user32.dll"
FUNCTION ulong CopyRect(ref tagrect lpDestRect,ref tagrect lpSourceRect) LIBRARY "user32.dll"
//从指定窗口的结构中取得信息
FUNCTION uLong GetWindowuLong(uLong hwnd, uLong nIndex) Alias For GetWindowLongA LIBRARY "USER32.DLL"
//在窗口结构中为指定的窗口设置信息
FUNCTION uLong SetWindowuLong(uLong hwnd, uLong nIndex,uLong dwNewLong) Alias For SetWindowLongA LIBRARY "USER32.DLL"
//文本绘图函数
//FUNCTION ulong TextOut(ulong hdc,ulong x,ulong y,ref string lpString,ulong nCount) LIBRARY "gdi32.dll" ALIAS FOR "TextOutA"
//内存拷贝
//用指定的刷子填充一个矩形
FUNCTION ulong FillRect(ulong hdc,ref tagrect lpRect,ulong hBrush) LIBRARY "user32.dll"
//用纯色创建一个刷子
FUNCTION ulong CreateSolidBrush(ulong crColor) LIBRARY "gdi32.dll"
//为任何一种标准系统颜色取得一个刷子
FUNCTION ulong GetSysColorBrush(ulong nIndex) LIBRARY "user32.dll"
//判断指定windows显示对象的颜色
FUNCTION ulong GetSysColor(ulong nIndex) LIBRARY "user32.dll"
//指定阴影刷子、虚线画笔以及字符中的空隙的填充方式
FUNCTION ulong SetBkMode(ulong hdc,ulong nBkMode) LIBRARY "gdi32.dll"
//为指定的设备场景设置背景颜色。背景颜色用于填充阴影刷子、虚线画笔以及字符(如背景模式为OPAQUE)中的空隙。也在位图颜色转换期间使用
FUNCTION ulong SetBkColor(ulong hdc,ulong crColor) LIBRARY "gdi32.dll"
//设置当前文本颜色。这种颜色也称为“前景色”
FUNCTION ulong SetTextColor(ulong hdc,ulong crColor) LIBRARY "gdi32.dll"
//将一幅位图从一个设备场景复制到另一个。源和目标DC相互间必须兼容。这个函数会在设备场景中定义一个目标矩形,并在位图中定义一个源图象。源矩形会根据需要进行伸缩,以便与目标矩形的大小相符
//FUNCTION ulong StretchBlt(ulong hdc,ulong x,ulong y,ulong nWidth,ulong nHeight,ulong hSrcDC,ulong xSrc,ulong ySrc,ulong nSrcWidth,ulong nSrcHeight,ulong dwRop) LIBRARY "gdi32.dll"
//将文本描绘到指定的矩形中
FUNCTION ulong DrawText(ulong hdc,string lpStr,ulong nCount,ref tagrect lpRect,ulong wFormat) LIBRARY "user32.dll" ALIAS FOR "DrawTextA"
//用指定的样式描绘一个矩形的边框
FUNCTION boolean DrawEdge(ulong hdc,ref tagrect qrc,ulong edge,ulong grfFlags) LIBRARY "user32.dll"
//释放由调用GetDC或GetWindowDC函数获取的指定设备场景。它对类或私有设备场景无效(但这样的调用不会造成损害)
FUNCTION ulong ReleaseDC(ulong hwnd,ulong hdc) LIBRARY "user32.dll"
//删除专用设备场景或信息场景,释放所有相关窗口资源
FUNCTION ulong DeleteDC(ulong hdc) LIBRARY "gdi32.dll"
//每个设备场景都可能有选入其中的图形对象。其中包括位图、刷子、字体、画笔以及区域等等。一次选入设备场景的只能有一个对象。选定的对象会在设备场景的绘图操作中使用。例如,当前选定的画笔决定了在设备场景中描绘的线段颜色及样式
FUNCTION ulong SelectObject(ulong hdc,ulong hObject) LIBRARY "gdi32.dll"
//用这个函数删除GDI对象,比如画笔、刷子、字体、位图、区域以及调色板等等。对象使用的所有系统资源都会被释放
FUNCTION ulong DeleteObject(ulong hObject) LIBRARY "gdi32.dll"
//用指定的样式、宽度和颜色创建一个画笔
FUNCTION ulong CreatePen(ulong nPenStyle,ulong nWidth,ulong crColor) LIBRARY "gdi32.dll"
//为指定的设备场景指定一个新的当前画笔位置。前一个位置保存在lpPoint中
FUNCTION ulong MoveToEx(ulong hdc,ulong ix,ulong iy,ulong lpPoint) LIBRARY "gdi32.dll"
//用当前画笔画一条线,从当前位置连到一个指定的点。这个函数调用完毕,当前位置变成x,y点
FUNCTION ulong LineTo(ulong hdc,ulong ix,ulong iy) LIBRARY "gdi32.dll"
//校验窗口的全部或部分客户区。这样便可告之windows指定的区域不需要重画
//FUNCTION ulong ValidateRect(ulong hwnd,ref tagrect lpRect) LIBRARY "user32.dll"
//取回与某一设备场景相关的窗口的句柄
//FUNCTION ulong WindowFromDC(ulong hdc) LIBRARY "user32.dll"
//获取指定窗口的设备场景
FUNCTION ulong GetDC(ulong hwnd) LIBRARY "user32.dll"
//载入一个位图、图标或指针
FUNCTION ulong LoadImage(ulong hInst,string lpsz,ulong un1,ulong n1,ulong n2,ulong un2) LIBRARY "user32.dll" ALIAS FOR "LoadImageA"
//在指定的位置画一个图标
//FUNCTION ulong DrawIcon(ulong hdc,ulong x,ulong y,ulong hIcon) LIBRARY "user32.dll"
FUNCTION boolean DrawIconEx(ulong hdc,ulong xLeft,ulong yTop,ulong hIcon,ulong cxWidth,ulong cyWidth,ulong istepIfAniCur,ulong hbrFlickerFreeDraw,ulong diFlags) LIBRARY "user32.dll"
//创建一幅与设备有关位图,它与指定的设备场景兼容
//FUNCTION ulong CreateCompatibleBitmap(ulong hdc,ulong nWidth,ulong nHeight) LIBRARY "gdi32.dll"
//在指定的设备场景中设置一个像素的RGB值
//FUNCTION ulong SetPixel(ulong hdc,ulong x,ulong y,ulong crColor) LIBRARY "gdi32.dll"
FUNCTION ulong GetTextFace(ulong hdc,ulong nCount,ref string lpFacename) LIBRARY "gdi32.dll" ALIAS FOR "GetTextFaceA"
//FUNCTION ulong GetTextMetrics(ulong hdc,ref TEXTMETRIC lpMetrics) LIBRARY "gdi32.dll" ALIAS FOR "GetTextMetricsA"
//FUNCTION ulong CreateFontIndirect(ref LOGFONT lpLogFont) LIBRARY "gdi32.dll" ALIAS FOR "CreateFontIndirectA"
FUNCTION boolean DrawState(ulong hDC,ulong hBrush,ulong lpDrawStateProc,ulong lParam,ulong wParam,ulong n1,ulong n2,ulong n3,ulong n4,ulong un) LIBRARY "user32.dll" ALIAS FOR "DrawStateA"
FUNCTION ulong DestroyIcon(ulong hIcon) LIBRARY "user32.dll"
FUNCTION ulong Rectangle(ulong hdc,ulong X1,ulong Y1,ulong X2,ulong Y2) LIBRARY "gdi32.dll"
function long LoadLibrary( ref string lpLibFileName2 ) LIBRARY "KERNEL32" Alias For LoadLibraryA
function long FreeLibrary( long hinstance ) LIBRARY "KERNEL32"
FUNCTION ulong LoadBitmap(ulong hInstance, long lpBitmapName) LIBRARY "user32.dll" ALIAS FOR "LoadBitmapA"
FUNCTION ulong CreateDC(string lpDriverName,string lpDeviceName, string lpOutput, long lpInitData) LIBRARY "gdi32.dll" ALIAS FOR "CreateDCA"
FUNCTION ulong CreateCompatibleDC(ulong hdc) LIBRARY "gdi32.dll"
FUNCTION ulong GetPixel(ulong hdc,ulong ix,ulong iy) LIBRARY "gdi32.dll"
FUNCTION ulong LoadImage(ulong hInst,long lpsz,ulong un1,ulong n1,ulong n2,ulong un2) LIBRARY "user32.dll" ALIAS FOR "LoadImageA"
//if it's use in other version ,please modify by hand.
FUNCTION long FN_ResGetIconID(string lpLibFileName) LIBRARY "PBVM80.dll"
FUNCTION long FN_ResGetBitmapID(string lpLibFileName) LIBRARY "PBVM80.dll"
FUNCTION string FN_ResGetBitmapName(long lpLibFileName) LIBRARY "PBVM80.dll"
Function Long ImageList_Create (Long MinCx , Long MinCy , Long flags ,Long cInitial ,Long cGrow) Library "PBVM80.dll" ALIAS FOR "PBImageList_Create"
Function Long ImageList_AddMasked(Long hImageList ,Long hbmImage , Long crMask ) Library "PBVM80.dll" ALIAS FOR "PBImageList_AddMasked"
Function Long ImageList_GetIcon(Long hImageList , Long ImgIndex , Long hbmMask ) Library "PBVM80.dll" ALIAS FOR "PBImageList_GetIcon"
Function Long ImageList_Destroy(Long hImageList) Library "PBVM80.dll" ALIAS FOR "PBImageList_Destroy"
//ImageList 函数
//Function Long ImageList_Create (Long MinCx , Long MinCy , Long flags ,Long cInitial ,Long cGrow) Library "COMCTL32.DLL"
//Function Long ImageList_AddMasked(Long hImageList ,Long hbmImage , Long crMask ) Library "COMCTL32.DLL"
//Function Long ImageList_GetIcon(Long hImageList , Long ImgIndex , Long hbmMask ) Library "COMCTL32.DLL"
FUNCTION ulong RoundRect(ulong hdc,ulong X1,ulong Y1,ulong X2,ulong Y2,ulong X3,ulong Y3) LIBRARY "gdi32.dll"
FUNCTION ulong GetStockObject(ulong nIndex) LIBRARY "gdi32.dll"
function ulong SetCapture(ulong hwnd) library "user32.dll"
function boolean ReleaseCapture() library "user32.dll"
function ulong GetCapture() library "user32.dll"
//获得整个窗口的范围矩形,窗口的边框、标题栏、滚动条及菜单等都在这个矩形内
FUNCTION ulong GetWindowRect(ulong hwnd,ref tagRECT lpRect) LIBRARY "user32.dll"
//移动矩形
FUNCTION ulong OffsetRect(ref tagrect lpRect,ulong xs,ulong ys) LIBRARY "user32.dll"
FUNCTION ulong GetClientRect(ulong hwnd,ref tagRECT lpRect) LIBRARY "user32.dll"
FUNCTION ulong DefWindowProc(ulong hwnd,ulong wMsg,ulong wParam,ulong lParam) LIBRARY "user32.dll" ALIAS FOR "DefWindowProcA"
//画矩形函数
Function uLong CreateRectRgn(Long X1 , Long Y1 , Long X2 , Long Y2 ) LIBRARY "gdi32.dll"
Function uLong CombineRgn(Long hDestRgn, Long hSrcRgn1 , Long hSrcRgn2 , Long nCombineMode ) LIBRARY "gdi32.dll"
Function uLong SetWindowRgn(Long hwnd , Long hRgn , Boolean bRedraw ) LIBRARY "user32.dll"
/*提示信息显示定义*/
//确保动态链接库(DLL)被加载
SubRoutine InitCommonControls() library "comctl32.dll"
//创建窗口
Function long CreateWindowExA(ulong dwExStyle,string ClassName, long WindowName, ulong dwStyle,ulong X4, ulong Y4, ulong nWidth, ulong nHeight, ulong hWndParent, ulong hMenu, ulong hInstance, ulong lpParam) library "user32.dll"
//清除指定的窗口以及它的所有子窗口
Function integer DestroyWindow(long hWnd) library "user32.dll"
//调用一个窗口的窗口函数,将一条消息发给那个窗口
Function integer ToolTipMsg(long hWnd, long uMsg, long wParam, REF TOOLINFO ToolInfo) library "user32.dll" Alias For "SendMessageA"
//调用一个窗口的窗口函数,将一条消息发给那个窗口
Function integer RelayMsg(long hWnd, long uMsg, long wParam, REF MSG Msg) library "user32.dll" Alias For "SendMessageA"
//分配指定数量的内存
Function long LocalAlloc(long Flags, long Bytes) library "kernel32.dll"
//释放内存并使句柄无效
Function long LocalFree(long MemHandle) library "kernel32.dll"
//复制字符串到缓冲区
Function long lstrcpy(long Destination, string Source) library "kernel32.dll"
end prototypes
type variables
public:
//boolean 默认焦点 = false
boolean XP风格 = false
long XP风格类型 = 1
long XP风格背景颜色 = 12632256
boolean 椭圆形状 = false
boolean 边框 = false
//long 边框颜色 = rgb(0,128,192)
long 边框颜色 = rgb(72,148,168)
boolean 凸起效果 = true
long 凸起效果颜色 = rgb(242,238,230)
boolean 凸起效果渐进色背景 = true
long 凸起效果渐进色结束=RGB(160,190,190)
long 凸起效果渐进色开始=RGB(255,255,255)
boolean 渐进色背景 = true
boolean 水平渐进 = false
long 渐进色结束=RGB(168,204,216)
long 渐进色开始=RGB(255,255,255)
boolean PB自带图片 = false
ToolBarAlignment 图片排列方式 = Alignatleft!
string 正常状态图片 = "Custom038!"
String 鼠标移入图片 = "Custom038!"
long 鼠标移入背景颜色 = rgb(242,238,230)
long 字体颜色 =rgb(0,0,0)
long 不可用状态字体颜色=rgb(128,128,128)
long 鼠标移入字体颜色 =rgb(0,0,0)
long 背景颜色
boolean 显示提示信息 = false
string 提示信息
private:
long 系统颜色刷子
long 背景颜色刷子
ulong h_bmpBk,h_normalPic,h_movePic
boolean ib_captured = false
boolean ib_pushDown = false
integer ii_picsize
tagRect winRect
Private :
boolean ib_blup //修正按钮up的时候还触发mousemove
boolean 焦点 = false
boolean ib_MouseOnButton
//-------------------------------------
//CONSTANT var
//SetBkMode
CONSTANT ulong TRANSPARENT = 1
//DrawEdge
CONSTANT uLong BDR_RAISEDOUTER = 1
CONSTANT uLong BDR_SUNKENOUTER = 2
CONSTANT uLong BDR_RAISEDINNER = 4
CONSTANT uLong BDR_SUNKENINNER = 8
CONSTANT uLong BDR_OUTER = 3
CONSTANT uLong BDR_INNER = 12
CONSTANT uLong BF_LEFT = 1
CONSTANT uLong BF_RIGHT = 4
CONSTANT uLong BF_TOP = 2
CONSTANT uLong BF_BOTTOM = 8
CONSTANT uLong BF_RECT = 1
//GetSysColor GetSysColorBrush
CONSTANT uLong COLOR_BACKGROUND=1
CONSTANT uLong COLOR_HIGHLIGHT= 13
CONSTANT uLong COLOR_HIGHLIGHTTEXT = 14
CONSTANT uLong COLOR_MENU = 4
CONSTANT uLong COLOR_WINDOW = 5
CONSTANT uLong COLOR_MENUTEXT = 7
CONSTANT uLong COLOR_WINDOWTEXT = 8
CONSTANT uLong COLOR_ACTIVECAPTION = 2
CONSTANT uLong COLOR_BTNFACE = 15
CONSTANT uLong COLOR_INFOBK = 24
Constant integer COLOR_BTNHIGHLIGHT = 20
Constant integer COLOR_BTNSHADOW = 16
//LoadImage
CONSTANT uLong IMAGE_BITMAP = 0
CONSTANT uLong IMAGE_ICON = 1
CONSTANT uLong IMAGE_CURSOR = 2
CONSTANT uLong IMAGE_ENHMETAFILE = 3
CONSTANT uLong LR_DEFAULTCOLOR = 0
CONSTANT uLong LR_MONOCHROME = 1
CONSTANT uLong LR_COLOR = 2
CONSTANT uLong LR_COPYRETURNORG = 4
CONSTANT uLong LR_COPYDELETEORG = 8
CONSTANT uLong LR_LOADFROMFILE = 16
CONSTANT uLong LR_LOADTRANSPARENT = 32
CONSTANT uLong LR_DEFAULTSIZE = 64
CONSTANT uLong LR_VGACOLOR = 128
CONSTANT uLong LR_LOADMAP3DCOLORS = 4096
CONSTANT uLong LR_CREATEDIBSECTION = 8192
CONSTANT uLong LR_COPYFROMRESOURCE = 16384
CONSTANT uLong LR_SHARED = 32768
//CreatePen
CONSTANT uLong PS_SOLID = 0
//
CONSTANT uLong SRCCOPY = 13369376
//DrawText
CONSTANT uLong DT_LEFT = 0
CONSTANT uLong DT_CENTER = 1
CONSTANT uLong DT_RIGHT = 2
CONSTANT uLong DT_VCENTER = 4
CONSTANT uLong DT_BOTTOM = 8
CONSTANT uLong DT_SINGLELINE = 32
CONSTANT uLong DT_CALCRECT = 1024
CONSTANT uLong DT_WORDBREAK = 16
Constant integer DST_ICON = 3
Constant integer DST_BITMAP =4
Constant integer DSS_NORMAL =0
Constant integer DSS_DISABLED = 32
Constant integer DSS_MONO = 128
Constant integer DSS_UNION = 16
Constant int SM_CYMENU = 15
Constant int SM_CXMENUCHECK = 71
//use in GetStockObject
Constant int WHITE_BRUSH=0
Constant int GRAY_BRUSH =1
Constant int LTGRAY_BRUSH=2
Constant int DKGRAY_BRUSH=3
Constant int BLACK_BRUSH=4
Constant int NULL_BRUSH=5
Constant int WHITE_PEN=6
Constant int BLACK_PEN=7
Constant int NULL_PEN=8
Constant int OEM_FIXED_FONT=10
Constant int ANSI_FIXED_FONT=11
Constant int ANSI_VAR_FONT=12
Constant int SYSTEM_FONT=13
Constant int WM_GETFONT = 49
constant Long RGN_DIFF = 4
constant Long SM_CXICON = 11
constant Long SM_CYICON = 12
//提示信息显示定义
Private:
// Constants
CONSTANT string TOOLTIPS_CLASS = 'tooltips_class32'
CONSTANT ulong CW_USEDEFAULT = 2147483648
CONSTANT long WM_USER = 1024
CONSTANT long WS_EX_TOPMOST = 8
// ToolTip Messages
CONSTANT long TTM_ADDTOOL = WM_USER + 4
CONSTANT long TTM_RELAYEVENT = WM_USER + 7
long hWndTT
// Tooltip control window handle
long ToolID = 1 // Tooltip internal ID
// Tooltip flags
constant long TOOLINFO_SIZE = 40
CONSTANT integer TTF_CENTERTIP = 2
CONSTANT integer TTF_RTLREADING = 4
//CONSTANT integer TTF_DI_SETITEM = 32768
//CONSTANT long TTM_NEWTOOLRECT = WM_USER + 6
CONSTANT integer TTS_BALLOON = 64
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -