📄 uo_supperbutton.sru
字号:
else
lbo_jj=true
end if
if ib_pushDown then // Draw pressed state
if 图片排列方式<>floating! then
//----------------------------------------
//old states
//---------------------------------------
if 渐进色背景=false then
hNewBrush =CreateSolidBrush(鼠标移入背景颜色)
FillRect(hdc,ast_rect,hNewBrush)
DeleteObject(hNewBrush)
DrawEdge(hdc,ast_rect, 2, 1+2+4+8)
end if
if 渐进色背景=true then
Of_DrawGradient(hdc, ast_rect ,colorto , colorfrom, lbo_jj)
DrawEdge(hdc,ast_rect, 2, 1+2+4+8)
if 凸起效果 = false and 边框 = true then
//用纯色画个边框
FrameRect(hdc, ast_rect, ll_hbrush)
DeleteObject(ll_hbrush)
end if
end if
if 凸起效果 = true then
if 渐进色背景=true then
Of_DrawGradient(hdc, ast_rect ,colorto , colorfrom, lbo_jj)
end if
DrawEdge(hdc,ast_rect, 2, 1+2+4+8)
end if
else
//----------------------------------------
//old states
//---------------------------------------
if 渐进色背景=false then
if 背景颜色 <> 0 then
FillRect(hdc,ast_rect,背景颜色刷子)
else
FillRect(hdc,ast_rect,系统颜色刷子)
end if
end if
//--------------------------------------------------------------------
// These was added By: pcm Date: 2003.05.28
//--------------------------------------------------------------------
if 渐进色背景=true then
hNewBrush =CreateSolidBrush(鼠标移入背景颜色)
FillRect(hdc,ast_rect,hNewBrush)
DeleteObject(hNewBrush)
DrawEdge(hdc,ast_rect, 2, 1+2+4+8)
end if
end if
elseif ib_Captured then // Draw mousemove state
if 图片排列方式<>floating! then
//----------------------------------------
//old states
//---------------------------------------
if 渐进色背景=false then
hNewBrush =CreateSolidBrush(鼠标移入背景颜色)
FillRect(hdc,ast_rect,hNewBrush)
DeleteObject(hNewBrush)
DrawEdge(hdc,ast_rect, 4, 1+2+4+8)
end if
//--------------------------------------------------------------------
// These was added By: pcm Date: 2003.05.28
//--------------------------------------------------------------------
//long colorfrom,colorto
if 渐进色背景=true then
if 凸起效果=true then
Of_DrawGradient(hdc, ast_rect , colorfrom, colorto, lbo_jj)
DrawEdge(hdc,ast_rect, 4, 1+2+4+8)
else
Of_DrawGradient(hdc, ast_rect , 凸起效果渐进色开始, 凸起效果渐进色结束, lbo_jj)
//用纯色画个边框
if 边框 = true then
FrameRect(hdc, ast_rect, ll_hbrush)
DeleteObject(ll_hbrush)
end if
end if
end if
else
if 渐进色背景=false then
if 凸起效果=false then
if 背景颜色 <> 0 then
FillRect(hdc,ast_rect,背景颜色刷子)
else
FillRect(hdc,ast_rect,系统颜色刷子)
end if
end if
end if
//--------------------------------------------------------------------
// These was added By: pcm Date: 2003.05.28
//--------------------------------------------------------------------
if 渐进色背景=true then
xp1 = ast_rect.Left
yp1 = ast_rect.top
xp2 = ast_rect.Right
yp2 = ast_rect.bottom
FromPix = ast_rect.Left + 1
ToPix = ast_rect.Right - 1
hPen = CreatePen(PS_SOLID, 0, RGB(230,230,250))
hOldPen = SelectObject(hdc, hPen)
MoveToEx(hdc,xp1,yp1, 0)
LineTo(hdc,xp2,yp1)
LineTo(hdc,xp2,yp2)
lineto(hdc,xp1,yp2)
lineto(hdc,xp1,yp1)
SelectObject(hdc, hOldPen)
DeleteObject(hPen)
For Pix = FromPix To ToPix
hPen = CreatePen(PS_SOLID, 0, RGB(255,255,255))
hOldPen = SelectObject(hdc, hPen)
MoveToEx(hdc, Pix , ast_rect.top + 1 , 0)
LineTo(hdc, Pix , ast_rect.Bottom )
SelectObject(hdc, hOldPen)
DeleteObject(hPen)
Next
end if
end if
else // Draw normal state
if 背景颜色 <> 0 then
FillRect(hdc,ast_rect,背景颜色刷子)
else
FillRect(hdc,ast_rect,系统颜色刷子)
end if
if 边框 = true then
hnewPen = CreatePen(PS_SOLID, 1, 边框颜色)
hOldPen = SelectObject(hdc, hNewPen)
if 背景颜色 <> 0 then
holdBrush =SelectObject(hdc, 背景颜色刷子)
else
holdBrush =SelectObject(hdc, 系统颜色刷子)
end if
rectangle(hdc,ast_rect.left,ast_rect.top,ast_rect.right,ast_rect.bottom)
SelectObject(hdc, hOldPen)
SelectObject(hdc, holdBrush)
deleteObject(hnewPen)
end if
if 渐进色背景 = true then
Of_DrawGradient(hdc, ast_rect , colorfrom, colorto, lbo_jj)
//用纯色画个边框
if 边框 = true then
FrameRect(hdc, ast_rect, ll_hbrush)
DeleteObject(ll_hbrush)
end if
end if
//设置凸起效果
if 凸起效果=true then
hNewBrush =CreateSolidBrush(凸起效果颜色)
FillRect(hdc,ast_rect,hNewBrush)
DeleteObject(hNewBrush)
DrawEdge(hdc,ast_rect, 4, 1+2+4+8)
if 凸起效果渐进色背景=true then
Of_DrawGradient(hdc, ast_rect , 凸起效果渐进色开始, 凸起效果渐进色结束, lbo_jj)
DrawEdge(hdc,ast_rect, 4, 1+2+4+8)
end if
end if
//设置按钮形状
if 椭圆形状 then
of_makeregion(handle(this))
end if
end if
end subroutine
public subroutine of_drawxp (long hdc, boolean normal, boolean mousemove, boolean ab_focus, boolean mousedown, tagrect rcsep);///////////////////////////////////////////
//绘制XP风格按钮
//XP风格类型:1,橙色边框风格 2,蓝色边框风格
//pcm add 2003.11.14
//////////////////////////////////////////
of_makeregion(handle(this))
Long i , ll_XPface , ll_Width , ll_Height
Dec{7} ll_StepXP1
Long ll_StartColor , ll_EndColor
ll_Width = (rcSep.Right - rcSep.Left)
ll_Height = (rcSep.Bottom - rcSep.Top)
If mousedown Then
ll_StepXP1 = 15 / ll_Height
ll_XPface = Of_ShiftColor(XP风格背景颜色, 48 , True)
ll_XPface = Of_ShiftColor(ll_XPface, -32, True)
For i = 0 To (ll_Height - 1)
Of_DrawLine(hdc , 0, ll_Height - i, ll_Width, ll_Height - i, Of_ShiftColor(ll_XPface, - ll_StepXP1 * i, True))
Next
Of_DrawLine(hdc , 2, 0, ll_Width - 2, 0, 7552000)
Of_DrawLine(hdc , 2, ll_Height - 1, ll_Width - 2, ll_Height - 1, 7552000)
Of_DrawLine(hdc , 0, 2, 0, ll_Height - 2, 7552000)
Of_DrawLine(hdc , ll_Width - 1, 2, ll_Width - 1, ll_Height - 2, 7552000)
SetPixel(hdc ,1, 1, 8080656)
SetPixel(hdc ,1, ll_Height - 2, 8080656)
SetPixel(hdc ,ll_Width - 2, 1, 8080656)
SetPixel(hdc ,ll_Width - 2, ll_Height - 2, 8080656)
Of_DrawLine(hdc , 2, ll_Height - 2, ll_Width - 2, ll_Height - 2, Of_ShiftColor(ll_XPface, 16, True))
Of_DrawLine(hdc , 1, ll_Height - 3, ll_Width - 2, ll_Height - 3, Of_ShiftColor(ll_XPface, 10, True))
Of_DrawLine(hdc , ll_Width - 2, 2, ll_Width - 2, ll_Height - 2, Of_ShiftColor(ll_XPface, 5, True))
Of_DrawLine(hdc , ll_Width - 3, 3, ll_Width - 3, ll_Height - 3, ll_XPface)
Of_DrawLine(hdc , 2, 1, ll_Width - 2, 1, Of_ShiftColor(ll_XPface, -32, True))
Of_DrawLine(hdc , 1, 2, ll_Width - 2, 2, Of_ShiftColor(ll_XPface, -24, True))
Of_DrawLine(hdc , 1, 2, 1, ll_Height - 2, Of_ShiftColor(ll_XPface, -32, True))
Of_DrawLine(hdc , 2, 2, 2, ll_Height - 2, Of_ShiftColor(ll_XPface, -22, True))
Else
ll_StepXP1 = 25 / ll_Height
ll_XPface = Of_ShiftColor(XP风格背景颜色, 48, True)
For i = 0 To (ll_Height - 1)
Of_DrawLine(hdc , 0 , i, ll_Width, i, Of_ShiftColor(ll_XPface, - ll_StepXP1 * i , True))
Next
Of_DrawLine(hdc , 2, 0, ll_Width - 2, 0, 7552000)
Of_DrawLine(hdc , 2, ll_Height - 1, ll_Width - 2, ll_Height - 1, 7552000)
Of_DrawLine(hdc , 0, 2, 0, ll_Height - 2, 7552000)
Of_DrawLine(hdc , ll_Width - 1, 2, ll_Width - 1, ll_Height - 2, 7552000)
SetPixel(hdc , 1, 1, 8080656)
SetPixel(hdc , 1, ll_Height - 2, 8080656)
SetPixel(hdc , ll_Width - 2, 1, 8080656)
SetPixel(hdc , ll_Width - 2, ll_Height - 2, 8080656)
If ab_focus Then
if XP风格类型=2 then //蓝色边框风格
Of_DrawRectangle(hdc , 1, 2, ll_Width - 2, ll_Height - 4, 15183500, True)
Of_DrawLine(hdc , 2, ll_Height - 2, ll_Width - 2, ll_Height - 2, 15696491)
Of_DrawLine(hdc , 2, 1, ll_Width - 2, 1, 16771022)
Of_DrawLine(hdc , 1, 2, ll_Width - 1, 2, 16242621)
Of_DrawLine(hdc , 2, 3, 2, ll_Height - 3, 15782325)
Of_DrawLine(hdc , ll_Width - 3, 3, ll_Width - 3, ll_Height - 3, 15782325)
elseif XP风格类型=1 then //橙色边框风格
Of_DrawRectangle(hdc , 1, 2, ll_Width - 2, ll_Height - 4, rgb(255,198,0), True)
Of_DrawLine(hdc , 2, ll_Height - 2, ll_Width - 2, ll_Height - 2, rgb(247,160,0))
Of_DrawLine(hdc , 2, 1, ll_Width - 2, 1, rgb(255,215,128))
Of_DrawLine(hdc , 1, 2, ll_Width - 1, 2, rgb(255,189,91))
Of_DrawLine(hdc , 2, 3, 2, ll_Height - 3, rgb(255,200,96))
Of_DrawLine(hdc , ll_Width - 3, 3, ll_Width - 3, ll_Height - 3, rgb(255,200,96))
end if
//还原焦点状态
焦点 = false
if not ib_MouseOnButton then
goto lab
end if
Else
lab:
Of_DrawLine(hdc , 2, ll_Height - 2, ll_Width - 2, ll_Height - 2, Of_ShiftColor(ll_XPface, -48 , True))
Of_DrawLine(hdc , 1, ll_Height - 3, ll_Width - 2, ll_Height - 3, Of_ShiftColor(ll_XPface, -32, True))
Of_DrawLine(hdc , ll_Width - 2, 2, ll_Width - 2, ll_Height - 2, Of_ShiftColor(ll_XPface, -36, True))
Of_DrawLine(hdc , ll_Width - 3, 3, ll_Width - 3, ll_Height - 3, Of_ShiftColor(ll_XPface, -24, True))
Of_DrawLine(hdc , 2, 1, ll_Width - 2, 1, Of_ShiftColor(ll_XPface, 16, True))
Of_DrawLine(hdc , 1, 2, ll_Width - 2, 2, Of_ShiftColor(ll_XPface, 10, True))
Of_DrawLine(hdc ,1, 2, 1, ll_Height - 2, Of_ShiftColor(ll_XPface, -5, True))
Of_DrawLine(hdc ,2, 3, 2, ll_Height - 3, Of_ShiftColor(ll_XPface, -10, True))
End If
End If
end subroutine
public function integer controlregister (dragobject controlobject, string tip, integer flag);//提示信息显示
TOOLINFO ToolInfo
ToolInfo.cbSize = 40
ToolInfo.uFlags = Flag
ToolInfo.hWnd = Handle(ControlObject)
ToolInfo.hInstance = 0
ToolInfo.uID = ToolID
ToolID++
ToolInfo.lpszText = LocalAlloc(0,80)
POST LocalFree(ToolInfo.lpszText)
lStrCpy(ToolInfo.lpszText,Left(tip,80))
Rect lrect
lrect.Left = 0
lrect.top = 0
lrect.right = UnitsToPixels(ControlObject.Width,XUnitsToPixels!)
lrect.bottom = UnitsToPixels(ControlObject.Height,YUnitsToPixels!)
ToolInfo.Rect = lrect
If ToolTipMsg(hWndTT,TTM_ADDTOOL, 0, ToolInfo) = 0 Then
// MessageBox("出错","不能注册对象!",StopSign!,Ok!)
Return(-1)
End If
Return(ToolID - 1)
end function
public function integer localalloc (dragobject controlobject, string tip, integer flag);TOOLINFO ToolInfo
ToolInfo.cbSize = 40
ToolInfo.uFlags = Flag
ToolInfo.hWnd = Handle(ControlObject)
ToolInfo.hInstance = 0
ToolInfo.uID = ToolID
ToolID++
ToolInfo.lpszText = LocalAlloc(0,80)
POST LocalFree(ToolInfo.lpszText)
lStrCpy(ToolInfo.lpszText,Left(tip,80))
Rect lrect
lrect.Left = 0
lrect.top = 0
lrect.right = UnitsToPixels(ControlObject.Width,XUnitsToPixels!)
lrect.bottom = UnitsToPixels(ControlObject.Height,YUnitsToPixels!)
ToolInfo.Rect = lrect
If ToolTipMsg(hWndTT,TTM_ADDTOOL, 0, ToolInfo) = 0 Then
// MessageBox("出错","不能注册对象!",StopSign!,Ok!)
Return(-1)
End If
Return(ToolID - 1)
end function
public subroutine showtip (dragobject controlobject);//显示提示信息
MSG Msg
Msg.hWnd = Handle(ControlObject)
Msg.Message = 512 // WM_MOUSEMOVE
Msg.WParam = Message.WordParm
Msg.Lparam = Message.LongParm
RelayMsg(hWndTT,TTM_RELAYEVENT,0,Msg)
end subroutine
event constructor;/*显示提示信息开始*/
if 显示提示信息 then
InitCommonControls()
hWndTT = CreateWindowExA(WS_EX_TOPMOST,TOOLTIPS_CLASS,0, TTF_CENTERTIP + TTS_BALLOON + 2, &
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, &
0, 0, Handle(GetApplication()),0)
end if
/*显示提示信息结束*/
constant long BS_OWNERDRAW = 11
constant long GWL_STYLE = -16
constant long BS_GROUPBOX = 7
constant long BS_PUSHBUTTON = 0
//BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP
constant long WS_CHILD =1073741824
constant long WS_TABSTOP = 65536
constant long WS_VISIBLE = 268435456
long nStyle
nStyle = GetWindowuLong(handle(this), GWL_STYLE)
nStyle = nStyle + BS_OWNERDRAW
SetWindowuLong(handle(this), GWL_STYLE, nStyle)
背景颜色刷子 = CreateSolidBrush(背景颜色)
系统颜色刷子 = GetSysColorbrush(color_btnface)
of_init_draw()
end event
on uo_supperbutton.create
end on
on uo_supperbutton.destroy
end on
event rbuttondown;//guo_gdi.of_drawico("pic\key2.ico",guo_gdi.getdc(handle(this)),10,10)
end event
event destructor;/*显示提示信息开始*/
if 显示提示信息 then
DestroyWindow(hWndTT)
end if
/*显示提示信息结束*/
of_destroyRC() //释放资源
end event
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -