📄 uo_supperbutton.sru
字号:
end if
elseif 图片排列方式 = alignatright! then
if PB自带图片 = false then
li_y = (picRect.bottom - picRect.top - ii_picsize) /2
li_x = picRect.left - li_y
else
li_y = (picRect.bottom - picRect.top - ll_IconHeight) /2
li_x = picRect.left - li_y
end if
elseif 图片排列方式 = alignattop! then
if PB自带图片 = false then
li_x = (picRect.right - picRect.left - ii_picsize) /2
li_y = li_x
else
li_x = (picRect.right - picRect.left - ll_IconWidth) /2
li_y = li_x
end if
elseif 图片排列方式 = alignatbottom! then
if PB自带图片 = false then
li_x = (picRect.right - picRect.left - ii_picsize) /2
li_y = picRect.Top - li_x
else
li_x = (picRect.right - picRect.left - ll_IconWidth) /2
li_y = picRect.Top - li_x
end if
end if
if ib_pushDown then
li_y ++
li_x ++
offsetRect(textRect,1,1)
end if
焦点=true
of_drawbkandborder(hdc,winRect,焦点)
if (ib_captured or ib_pushDown) and h_MovePic >0 then
if PB自带图片 = false then
DrawIconEx(hdc,li_x,li_y,h_MovePic,ii_picsize,ii_picsize,0,0,DST_ICON )
else
DrawIconEx(hdc,li_x,li_y,h_MovePic,ll_IconWidth,ll_IconHeight,0,0,DST_ICON )
end if
elseif h_normalPic>0 then
if PB自带图片 = false then
DrawIconEx(hdc,li_x,li_y,h_normalPic,ii_picsize,ii_picsize,0,0,DST_ICON )
else
DrawIconEx(hdc,li_x,li_y,h_normalPic,ll_IconWidth,ll_IconHeight,0,0,DST_ICON )
end if
end if
SetBkMode(hdc,TRANSPARENT)
// Get the font in use on the Button
ll_hFont = Send(Handle(this), WM_GETFONT, 0, 0)
//DrawState(hdc, 0, 0, h_normalPic, 0, li_x, li_y, 0 , 0, DST_ICON + DSS_DISABLED)
// Select it into the device context
ll_oldFont = SelectObject(Hdc, ll_hFont)
if ib_captured then
SetTextColor(hdc,鼠标移入字体颜色)
else
if this.Enabled THEN
SetTextColor(hdc,字体颜色)
else
SetTextColor(hdc,不可用状态字体颜色)
end if
end if
DrawText(hdc,text,- 1,textRect,DT_CENTER+DT_VCENTER+DT_SINGLELINE)
SelectObject(Hdc, ll_oldFont)
releaseDC(handle(this),hdc)
end subroutine
public function integer of_makeregion (unsignedlong al_hwnd);/*========================================================================*/
// 函数名: defwindowproc in uo_imflatbutton (mybutton) inherited from commandbutton
//
// 作用范围: public
/*------------------------------------------------------------------------*/
// 描述: 把窗口修改成指定的椭圆形
/*------------------------------------------------------------------------*/
// 参数:
//
// [value] unsignedlong al_hwnd
// <description> 窗口句柄
/*------------------------------------------------------------------------*/
// 返回值: INTEGER
/*------------------------------------------------------------------------*/
// 作者: pcm 日期: 2003-11-11
/*========================================================================*/
Long ll_RgnNorm, ll_Rgn1, ll_Rgn2
Long ll_Height, ll_Width
Long ll_rc
tagRect lr_winRect
GetWindowRect(al_Hwnd, lr_winRect)
ll_Width = lr_winRect.Right - lr_winRect.Left
ll_Height = lr_winRect.Bottom - lr_winRect.Top
ll_RgnNorm = CreateRectRgn(0, 0, ll_Width, ll_Height)
ll_Rgn2 = CreateRectRgn(0, 0, 0, 0)
ll_Rgn1 = CreateRectRgn(0, 0, 2, 1)
CombineRgn(ll_Rgn2, ll_RgnNorm, ll_Rgn1, RGN_DIFF)
DeleteObject(ll_Rgn1)
ll_Rgn1 = CreateRectRgn(0, ll_Height, 2, ll_Height - 1)
CombineRgn(ll_RgnNorm, ll_Rgn2, ll_Rgn1, RGN_DIFF)
DeleteObject(ll_Rgn1)
ll_Rgn1 = CreateRectRgn(ll_Width, 0, ll_Width - 2, 1)
CombineRgn(ll_Rgn2, ll_RgnNorm, ll_Rgn1, RGN_DIFF)
DeleteObject(ll_Rgn1)
ll_Rgn1 = CreateRectRgn(ll_Width, ll_Height, ll_Width - 2, ll_Height - 1)
CombineRgn(ll_RgnNorm, ll_Rgn2, ll_Rgn1, RGN_DIFF)
DeleteObject(ll_Rgn1)
ll_Rgn1 = CreateRectRgn(0, 1, 1, 2)
CombineRgn(ll_Rgn2, ll_RgnNorm, ll_Rgn1, RGN_DIFF)
DeleteObject(ll_Rgn1)
ll_Rgn1 = CreateRectRgn(0, ll_Height - 1, 1, ll_Height - 2)
CombineRgn(ll_RgnNorm, ll_Rgn2, ll_Rgn1, RGN_DIFF)
DeleteObject(ll_Rgn1)
ll_Rgn1 = CreateRectRgn(ll_Width, 1, ll_Width - 1, 2)
CombineRgn(ll_Rgn2, ll_RgnNorm, ll_Rgn1, RGN_DIFF)
DeleteObject(ll_Rgn1)
ll_Rgn1 = CreateRectRgn(ll_Width, ll_Height - 1, ll_Width - 1, ll_Height - 2)
CombineRgn(ll_RgnNorm, ll_Rgn2, ll_Rgn1, RGN_DIFF)
DeleteObject(ll_Rgn1)
ll_rc = SetWindowRgn(al_Hwnd, ll_RgnNorm, True)
DeleteObject(ll_RgnNorm)
Return ll_rc
end function
public subroutine of_drawgradient (unsignedlong al_hdc, tagrect rct, long al_endcolour, long al_startcolour, boolean ab_vertical);//////////////////////////////////////////////////////////////////////////////
//
// 函数名称: Of_DrawGradient
//
//
// 访问级别: Public
//
// 参数: al_hdc 指定设备文本
// rct 包含矩形框信息结构
// al_endcolour 结束颜色值
// al_startcolour 开始颜色值
// ab_vertical 颜色渐进方式,
// 为 Ture 渐进方式为由下至上
// 为 False 渐进方式为由右至左
//
//
// 返回值: 无
//
//
//
//
// 功能描述: 为指定的设备画颜色渐进。
//
//
// 补充说明:
//
// 作者:pcm 2003 .11 .11
//
//
//////////////////////////////////////////////////////////////////////////////
Long lStep,lPos,lSize
Long bRGB[1],bRGB[2],bRGB[3],bRGBStart[1],bRGBStart[2],bRGBStart[3]
Long dR[1],dR[2],dR[3]
Double dPos,d
Long hBr
tagRect tR
CopyRect(tR,rct)
//ab_Vertical为true表示颜色垂直渐变,false表示颜色水平渐变
If ab_Vertical Then
lSize = (tR.Bottom - tR.tOp)
Else
lSize = (tR.Right - tR.left)
End If
//lSize表示高亮度区域垂直高度或者为水平的宽度
//lStep表示步长,循环255次,值越小渐变的效果越细腻
lStep = Integer(lSize / 255)
If (lStep < 3) Then
lStep = 1
End If
//红色
bRGB[1] = Mod(al_StartColour,256)
//绿色
bRGB[2] = Truncate(Mod (al_StartColour,65536)/256,0)
//兰色
bRGB[3] = Truncate(al_StartColour/65536,0)
dR[1]= Mod(al_endcolour,256) - bRGB[1]
dR[2]= Truncate(Mod (al_endcolour,65536)/256,0) - bRGB[2]
dR[3]= Truncate(al_endcolour/65536,0) - bRGB[3]
bRGBStart[1] = bRGB[1]
bRGBStart[2] = bRGB[2]
bRGBStart[3] = bRGB[3]
lPos=lSize
DO WHILE lPos>=0
lPos = lPos - lStep
If ab_Vertical Then
//从下开始
tR.tOp = tR.Bottom - lStep
Else
//从右边开始
tR.left = tR.Right - lStep
End If
If tR.tOp < rct.tOp Then
tR.tOp = rct.tOp
End If
//当tR.left的值(由于draw从右到左)小于rct.left(原始高亮度区域左边坐标)
If tR.left < rct.left Then
tR.left = rct.left
End If
//RGB函数计算公式: 颜色值 = (65536 * Blue) + (256 * Green) + (Red)
hBr = CreateSolidBrush((bRGB[3] * 65536 + bRGB[2] * 256 + bRGB[1]))
FillRect(al_hdc, tR, hBr)
DeleteObject(hBr)
//调整颜色:
dPos = ((lSize - lPos) / lSize)
If ab_Vertical Then
tR.Bottom = tR.tOp
bRGB[1] = bRGBStart[1] + dR[1] * dPos
bRGB[2] = bRGBStart[2] + dR[2] * dPos
bRGB[3] = bRGBStart[3] + dR[3] * dPos
Else
tR.Right = tR.left
bRGB[1] = bRGBStart[1] + dR[1] * dPos
bRGB[2] = bRGBStart[2] + dR[2] * dPos
bRGB[3] = bRGBStart[3] + dR[3] * dPos
End If
LOOP
end subroutine
public subroutine of_drawgradient (unsignedlong al_hwnd, long al_startcolour, long al_endcolour, boolean ab_vertical);//////////////////////////////////////////////////////////////////////////////
//
// 函数名称: Of_DrawGradient
//
//
// 访问级别: Public
//
// 参数: al_hwnd 设置颜色渐进设备句柄
// al_endcolour 结束颜色值
// al_startcolour 开始颜色值
// ab_vertical 颜色渐进方式,
// 为 Ture 渐进方式为由下至上
// 为 False 渐进方式为由右至左
//
//
// 返回值: 无
//
//
//
//
// 功能描述: 为指定的设备画颜色渐进。
//
//
// 补充说明:
//
// 作者:pcm 2003 .11 .11
//
//////////////////////////////////////////////////////////////////////////////
tagrect lpRect
GetClientRect(al_hwnd , lpRect)
Of_DrawGradient(GetDC(al_hwnd), lpRect , al_EndColour, al_StartColour, ab_Vertical)
end subroutine
public function long of_drawline (long al_hdc, long al_x1, long al_y1, long al_x2, long al_y2, long al_color);POINTAPI pt
uLong ll_newPen , ll_OldPen
ll_NewPen = CreatePen(PS_SOLID, 1 , al_Color)
ll_OldPen = SelectObject(al_hdc , ll_NewPen)
MoveToEx(al_hdc, al_x1, al_y1, pt)
LineTo(al_hdc, al_x2, al_y2)
SelectObject(al_hdc , ll_OldPen)
DeleteObject(ll_NewPen)
Return 1
end function
public function long combinergn (long al_hdc, long al_x1, long al_y1, long al_x2, long al_y2, long al_color);POINTAPI pt
uLong ll_newPen , ll_OldPen
ll_NewPen = CreatePen(PS_SOLID, 1 , al_Color)
ll_OldPen = SelectObject(al_hdc , ll_NewPen)
MoveToEx(al_hdc, al_x1, al_y1, pt)
LineTo(al_hdc, al_x2, al_y2)
SelectObject(al_hdc , ll_OldPen)
DeleteObject(ll_NewPen)
Return 1
end function
public function long of_shiftcolor (long al_color, long al_value, boolean ab_isxp);Long ll_Red , ll_Blue , ll_Green
If ab_isXP = False Then
ll_Blue = (Mod(Truncate((al_Color / 65536) , 0) , 256)) + al_Value
Else
ll_Blue = Mod(Truncate((al_Color / 65536) , 0) , 256)
ll_Blue = ll_Blue + Truncate((ll_Blue * al_Value) / 192 , 0)
End If
ll_Green = Mod(Truncate((al_Color / 256) , 0) , 256) + al_Value
ll_Red = Mod(al_Color , 256) + al_Value
//ll_Red = Of_BitAnd(al_Color , 255) + al_Value
//检查红色
If ll_Red < 0 Then
ll_Red = 0
ElseIf ll_Red > 255 Then
ll_Red = 255
End If
//检查绿色
If ll_Green < 0 Then
ll_Green = 0
ElseIf ll_Green > 255 Then
ll_Green = 255
End If
//检查蓝色
If ll_Blue < 0 Then
ll_Blue = 0
ElseIf ll_Blue > 255 Then
ll_Blue = 255
End If
Return RGB(ll_Red, ll_Green, ll_Blue)
end function
public subroutine of_drawrectangle (long al_hdc, long al_x, long al_y, long al_width, long al_height, long al_color, boolean ab_onlyborder);tagRect bRect
Long ll_hBrush , ll_Ret
bRect.Left = al_x
bRect.Top = al_y
bRect.Right = al_x + al_Width
bRect.Bottom = al_y + al_Height
ll_hBrush = CreateSolidBrush(al_Color)
If Not ab_OnlyBorder Then
ll_Ret = FillRect(al_hdc, bRect, ll_hBrush)
Else
ll_Ret = FrameRect(al_hdc, bRect, ll_hBrush)
End If
ll_Ret = DeleteObject(ll_hBrush)
end subroutine
public subroutine of_drawbkandborder (long hdc, ref tagrect ast_rect, boolean ab_focus);//此处增加XP风格模式,XP风格不参与其他属性的变化
boolean lb_normal
if XP风格 then
if ib_Captured then
elseif ib_pushDown then
else
lb_normal = true
end if
of_drawxp(hdc,lb_normal,ib_Captured,ab_focus,ib_pushDown,ast_rect)
return
end if
long hNewBrush,hnewPen,holdPen,holdBrush
uLong Pix
uLong hPen
uLong FromPix, ToPix
int i
uLong xp1,yp1,xp2,yp2
long colorfrom,colorto
colorfrom=渐进色开始
colorto=渐进色结束
uLong ColorR,ColorG,ColorB
uLong hOld
uLong ColorFromR,ColorFromG,ColorFromB
uLong ColorToR,ColorToG,ColorToB
//画边框用的刷子
long ll_hBrush
ll_hBrush = CreateSolidBrush(边框颜色)
boolean lbo_jj
if 水平渐进 = true then
lbo_jj=false
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -