CSDN博客

img hzhxxx

改变工具栏字体

发表于2004/10/31 23:14:00  2052人阅读


通过自己加工,定义出来对应的界面,可以由用户设置工具栏的字体类型和大小.

以下是我的用户对象 nvo_app 实现自定义工具栏字体的关键函数.其中

1 . 函数申明:
private :
Function ULong CreateMutexA(ULong lpsa, Boolean fInitialOwner, String lpszMutexName) Library 'kernel32.dll'
Function uint GetModuleFileNameA(ulong hModule,ref string lpFilename,ulong nSize) Library "kernel32.dll"


//出错 API
Function Long GetLastError() Library 'kernel32.dll'
//设置本机系统时间
Function boolean SetSystemDateTime(integer wYear,integer wMonth,integer wDay,integer wHour,integer wMinute,integer wSecond) Library "mHand.dll"

//窗口关系
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_ToolBarSetFont6(long unknown,string fontname,long fontsize,long unknown1,string str) LIBRARY "pbvm60.dll" ALIAS FOR 'FN_ToolBarSetFont'
FUNCTION Long FN_ToolBarSetFont7(long unknown,string fontname,long fontsize,long unknown1,string str) LIBRARY "pbvm70.dll" ALIAS FOR 'FN_ToolBarSetFont'
FUNCTION Long FN_ToolBarSetFont8(long unknown,string fontname,long fontsize,long unknown1,string str) LIBRARY "pbvm80.dll" ALIAS FOR 'FN_ToolBarSetFont'
FUNCTION Long FN_ToolBarSetFont9(long unknown,string fontname,long fontsize,long unknown1,string str) LIBRARY "pbvm90.dll" ALIAS FOR 'FN_ToolBarSetFont'

2. 函数定义

/**********************************************************/
//Function                  : 得到Toolbar的HANDLE
//name                        : uf_gettoolbarhandle
//access                      : private
//parm                        :
//             1.  aw_frame : 有 toolbar 的窗口
//return                    : 对应Toolbar的HANDLE
//Author                    : hzh
//date                      : 2002.11.15
/**********************************************************/

Long   l_null, l_hwndtoolbarhwnd
String  s_classname, s_windowname
Environment lEnv

IF IsValid(aw_Frame) AND (GetEnvironment(lEnv) = 1) THEN
 CHOOSE CASE lEnv.PBMajorRevision
  CASE 6
   s_classname = "FNFIXEDBAR60"
  CASE 7
   s_classname = "FNFIXEDBAR70"
  CASE 8
   s_classname = "FNFIXEDBAR80"
  CASE 9
   s_classname = "FNFIXEDBAR90"
 END CHOOSE
 SetNull(s_windowname)
 SetNull(l_null)
 l_hwndtoolbarhwnd = FindWindowEXA(Handle(aw_Frame),l_null,s_classname,s_windowname)
END IF

RETURN l_hwndtoolbarhwnd



/************************************************************************/
//Function                        : 设置工具条的字体
//name                            : uf_settoolbarfont
//access                           :    public
//parm                            :
//                1. aw_frame     : 有 toolbar 的窗口
//                2. as_fontname  : 字体名(比如宋体)
//                3. ai_fontsize  : 字体大小
//                4. as_extent    : 扩展属性(每个分栏的宽度,可容纳字数)
//return                          : of no use
//Author                          : hzh
//date                            : 2002.11.15
/************************************************************************/

Long    l_hwndToolBar,l_unknown
Environment lEnv

l_hwndToolBar = uf_GetToolBarHandle(aw_frame)
IF l_hwndToolBar > 0 THEN
 l_unknown = GetWindowLongA(l_hwndToolBar,0)
 IF (GetEnvironment(lEnv) = 1) AND l_unknown <> 0 THEN
  CHOOSE CASE lEnv.PBMajorRevision
   CASE 6
    FN_ToolBarSetFont6(l_unknown,as_fontname,ai_fontsize,0,as_extent)
   CASE 7
    FN_ToolBarSetFont7(l_unknown,as_fontname,ai_fontsize,0,as_extent)
   CASE 8
    FN_ToolBarSetFont8(l_unknown,as_fontname,ai_fontsize,0,as_extent)
   CASE 9
    FN_ToolBarSetFont9(l_unknown,as_fontname,ai_fontsize,0,as_extent)
  END CHOOSE
 END IF
END IF

RETURN 1

 

阅读全文
0 0

相关文章推荐

img
取 消
img