PB中轻松实现真正意义上的大字体工具栏

将以下代码保存为:uo_toolbarfont.sru文件,再在PB中导入,按照constructor()事件中的说明写上两行代码就可以轻松实现真正意义上的大字体工具栏.

请注意在PB11中的不同.

forward
global type uo_toolbarfont from nonvisualobject
end type
end forward

global type uo_toolbarfont from nonvisualobject
end type
global uo_toolbarfont uo_toolbarfont

type prototypes
function long FindWindowExA( long hParent, long hChildAfter, String lpszClass, String lpszWindow ) Library "user32.dll"
function long GetWindowLongA( long hWnd, integer index) Library "user32.dll"
function long FN_ToolBarSetFont(long unknown,string fontname,long fontsize,long unknown1,string str) library "pbvm90.dll"

end prototypes

type variables

end variables

forward prototypes
public function integer of_gettoolbarhandle (window aw_frame)
public subroutine of_settoolbarfont (window aw_frame, string as_fontname, integer ai_fontsize, string as_extent)
end prototypes

public function integer of_gettoolbarhandle (window aw_frame);long            ll_NULL, ll_hwndToolBar
string        ls_ClassName, ls_WindowName
Environment    lEnv

IF IsValid( aw_Frame ) AND (GetEnvironment(lEnv) = 1) THEN
        CHOOSE CASE lEnv.PBMajorRevision
            CASE 6
                ls_ClassName = "FNFIXEDBAR60"
            case 7
                ls_ClassName = "FNFIXEDBAR70"
            case 8
                ls_ClassName = "FNFIXEDBAR80"
            case 9
                ls_ClassName = "FNFIXEDBAR90"
            case 11
                ls_ClassName = "FNFIXEDBAR110"
            END CHOOSE
        SetNull(ls_WindowName)
        SetNull(ll_NULL)
        ll_hwndToolBar = FindWindowEXA( Handle(aw_Frame), ll_NULL, ls_ClassName, ls_WindowName )
END IF

RETURN ll_hwndToolBar
end function

public subroutine of_settoolbarfont (window aw_frame, string as_fontname, integer ai_fontsize, string as_extent);long ll_hwndToolBar,ll_unknown
ll_hwndToolBar = of_GetToolBarHandle( aw_frame)
if ll_hwndToolBar>0 then
    ll_unknown = GetWindowLongA(ll_hwndToolBar,0)
    //ll_unknown = GetWindowLongA(ll_hwndToolBar,-21)//PB11用
    FN_ToolBarSetFont(ll_unknown,as_fontname,ai_fontsize,0,as_extent)
end if

end subroutine

on uo_toolbarfont.create
call super::create
TriggerEvent( this, "constructor" )
end on

on uo_toolbarfont.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on

event constructor;/*
在MDI窗口的窗口变量声明中声明
//大字体工具栏
uo_toolbarfont iuo_toolbarfont
在open事件中调用:
iuo_toolbarfont.of_settoolbarfont (this,'宋体',-12,"1234567")
*/
end event

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值