|
VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
|
上一篇主題 :: 下一篇主題 |
發表人 |
內容 |
sheuok
註冊時間: 2004-11-20 文章: 63 來自: Taiwan
第 1 樓
|
發表於: 星期五 十二月 07, 2007 2:35 pm 文章主題: 可修改VFP的_Msysmenu的背景顏色的程序(已完成!需要的狐友請取用!) |
|
|
Declare Integer GetMenu In user32 Integer HWnd
Declare Integer CreateSolidBrush In gdi32 Integer crColor
Declare Integer DrawMenuBar In user32 Integer HWnd
Declare Integer SetMenuInfo In user32 Integer hmenu, string @mi
****
*menuinfo_styles
mns_nocheck = 0x80000000
mns_modeless = 0x40000000
mns_dragdrop = 0x20000000
mns_autodismiss = 0x10000000
mns_notifybypos = 0x8000000
mns_checkorbmp =0x4000000
mim_maxheight = 0x1
mim_background = 0x2
mim_helpid = 0x4
mim_menudata = 0x8
mim_style = 0x10
mim_applytosubmenus = 0x80000000
****
*Private Type MENUINFO
* cbSize As Long
* fMask As Long
* dwStyle As Long
* cyMax As Long
* hbrBack As Long
* dwContextHelpID As Long
* dwMenuData As Long
*End Type
uc_hwnd=_vfp.HWnd
uc_menuh=getmenu(uc_hwnd)
*Messagebox(Padl("Thisform.hwnd=",20," ")+Ltrim(Str(getactivewindow()))+Chr(13)+Padl("_Screen.hwnd=",20," ")+Ltrim(Str(_Screen.HWnd))+Chr(13)+Padl("_Vfp.hwnd=",20," ")+Ltrim(Str(_vfp.HWnd))+Chr(13)+Chr(13)+Padl("Thisform.menuh=",20," ")+Ltrim(Str(getmenu(Thisform.HWnd)))+Chr(13)+Padl("_Screen.menuh=",20," ")+Ltrim(Str(getmenu(_Screen.HWnd)))+Chr(13)+Padl("_Vfp.menuh=",20," ")+Ltrim(Str(uc_menuh)))
uc_fmask=mim_background &&+mim_applytosubmenus
uc_dwstyle=mns_nocheck
uc_cymax=0
uc_hbrback=createsolidbrush(Rgb(255,0,0)) &&-此行為背景色的設定
uc_dwcontexthelpid=0
uc_dwmenudata=0
uc_len=28
menuinfo=num2dword(uc_len)+num2dword(uc_fmask)+num2dword(uc_dwstyle)+num2dword(uc_cymax)+num2dword(uc_hbrback)+num2dword(uc_dwcontexthelpid)+num2dword(uc_dwmenudata)
=setmenuinfo(uc_menuh,@menuinfo)
=drawmenubar(uc_hwnd)
Function num2dword(lnvalue)
#Define m0 0x0000100
#Define m1 0x0010000
#Define m2 0x1000000
If lnvalue < 0
lnvalue = 0x100000000 + lnvalue
Endif
Local b0, b1, b2, b3
b3 = Int(lnvalue/m2)
b2 = Int((lnvalue - b3*m2)/m1)
b1 = Int((lnvalue - b3*m2 - b2*m1)/m0)
b0 = Mod(lnvalue, m0)
Return Chr(b0)+Chr(b1)+Chr(b2)+Chr(b3) |
|
回頂端 |
|
|
jeff25
註冊時間: 2004-10-22 文章: 76 來自: taiwan
第 2 樓
|
發表於: 星期五 十二月 07, 2007 3:14 pm 文章主題: |
|
|
提供一個比較簡單的作法
DECLARE INTEGER SetSysColors IN "user32";
INTEGER nChanges,;
INTEGER @ lpSysColor,;
INTEGER @ lpColorValues
nChanges = 1
lpSysColor = 4 && 要改變的項目
lpColorValues = RGB (255, 0, 255) && 要改變成的顏色
SetSysColors (nChanges, @lpSysColor, @lpColorValues)
&& 這個一改是所有 WINDOW 視窗都一起改, 當然改完,你也可以用SetSysColors 來回復
==========================================
lpSysColor && 要改變的項目如下
COLOR_SCROLLBAR 0 Scroll-bar gray area
COLOR_BACKGROUND 1 Desktop
COLOR_ACTIVECAPTION 2 Active window caption
COLOR_INACTIVECAPTION 3 Inactive window caption
COLOR_MENU 4 Menu background
COLOR_WINDOW 5 Window background
COLOR_WINDOWFRAME 6 Window frame
COLOR_MENUTEXT 7 Text in menus
COLOR_WINDOWTEXT 8 Text in windows
COLOR_CAPTIONTEXT 9 Text in caption, size box, scroll bar arrow box
COLOR_ACTIVEBORDER 10 Active window border
COLOR_INACTIVEBORDER 11 Inactive window border
COLOR_APPWORKSPACE 12 Background color of multiple document interface (MDI)
applications
COLOR_HIGHLIGHT 13 Items selected item in a control
COLOR_HIGHLIGHTTEXT 14 Text of item selected in a control
COLOR_BTNFACE 15 Face shading on push button
COLOR_BTNSHADOW 16 Edge shading on push button
COLOR_GRAYTEXT 17 Grayed (disabled) text. This color is set to 0 if the current display driver does not support a solid gray color.
COLOR_BTNTEXT 18 Text on push buttons _________________ jeff |
|
回頂端 |
|
|
|
|
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
|
|