标题:菜单的高度
只看楼主
aaaaaa
Rank: 8Rank: 8
等 级:贵宾
威 望:21
帖 子:796
专家分:937
注 册:2012-9-4
得分:0 
Owner Drawn 菜单,纯 VFP 代码,可以设置菜单的字体、大小、颜色,包括 PAD 也可以设置。
所有的设置与系统无关。
网站在:https://vfpx.

民工子弟学校22班团小组长阳光模特队长冲锋篮球队前锋小苹果合唱队领唱蓝天舞蹈队编舞
2016-04-20 13:52
aaaaaa
Rank: 8Rank: 8
等 级:贵宾
威 望:21
帖 子:796
专家分:937
注 册:2012-9-4
得分:0 
*!*    修改 Windows 系统的:字体、字形、大小、颜色等设置
*!*    请慎用!请慎用!请慎用!(重要事情说三遍)

Declare integer SystemParametersInfo in win32api integer uiAction, integer uiParam, string@ pvParam, integer fWinIni      
#Define SPI_GETNONCLIENTMETRICS 41
#Define SPI_SETNONCLIENTMETRICS 42   
#Define SPIF_SENDCHANGE          2
#Define NCM_SIZE         10*4+5*60

#Define FW_ULTRALIGHT 200
#Define FW_REGULAR 400
#Define FW_BOLD 700
#Define FW_HEAVY 900

* 或者当前的设置
ncm_current = Padr(BinToC(NCM_SIZE,"4RS"),NCM_SIZE,Chr(0))
SystemParametersInfo(SPI_GETNONCLIENTMETRICS,NCM_SIZE, @ncm_current, 0)

ncm_changed = m.ncm_current
* 获取 logfont 结构
lcFontStr = SUBSTR(m.ncm_current,161,60)
lcFontStrChanged = lcFontStr
* 获取当前的值
nheight = CTOBIN(LEFT(m.lcFontStr,4),"4RS")
nweight = CTOBIN(SUBSTR(m.lcFontStr,17,4),"4RS")
nitalic = CTOBIN(SUBSTR(m.lcFontStr,21,1),"1RS")
nunderline = CTOBIN(SUBSTR(m.lcFontStr,22,1),"1RS")
nstrike =  CTOBIN(SUBSTR(m.lcFontStr,23,1),"1RS")
cfontname = SUBSTR(lcFontStr,29)

* Fontname = Arial  && 字体名
lcFont = "Arial"
lcFontStrChanged = STUFF(m.lcFontStrChanged,29,32,m.lcFont + REPLICATE(CHR(0), 32 - LEN(m.lcFont)))
ncm_changed = STUFF(m.ncm_changed,161,60,m.lcFontStrChanged)
SystemParametersInfo(SPI_SETNONCLIENTMETRICS,NCM_SIZE, ncm_changed,SPIF_SENDCHANGE)
MESSAGEBOX("Arial")
* Fontsize = 14  && 字体大小
lnFontSize = 14
lcFontStrChanged = STUFF(m.lcFontStrChanged,1,4,BINTOC(getheight(m.lnFontSize),"4RS"))
ncm_changed = STUFF(m.ncm_changed,161,60,m.lcFontStrChanged)
SystemParametersInfo(SPI_SETNONCLIENTMETRICS,NCM_SIZE, ncm_changed,SPIF_SENDCHANGE)
MESSAGEBOX("Fontsize = 14")
* Bold  && 粗体字
lcFontStrChanged = STUFF(m.lcFontStrChanged,17,4,BINTOC(FW_BOLD ,"4RS"))
ncm_changed = STUFF(m.ncm_changed,161,60,m.lcFontStrChanged)
SystemParametersInfo(SPI_SETNONCLIENTMETRICS,NCM_SIZE, ncm_changed,SPIF_SENDCHANGE)
MESSAGEBOX("Bold")
* Italic  && 斜体字
lcFontStrChanged = STUFF(m.lcFontStrChanged,21,1,BINTOC(1 ,"1RS"))
ncm_changed = STUFF(m.ncm_changed,161,60,m.lcFontStrChanged)
SystemParametersInfo(SPI_SETNONCLIENTMETRICS,NCM_SIZE, ncm_changed,SPIF_SENDCHANGE)
MESSAGEBOX("Italic")
* Underline  && 下划线
lcFontStrChanged = STUFF(m.lcFontStrChanged,22,1,BINTOC(1 ,"1RS"))
ncm_changed = STUFF(m.ncm_changed,161,60,m.lcFontStrChanged)
SystemParametersInfo(SPI_SETNONCLIENTMETRICS,NCM_SIZE, ncm_changed,SPIF_SENDCHANGE)
MESSAGEBOX("Underline")
* Strikethrough  && 删除线
lcFontStrChanged = STUFF(m.lcFontStrChanged,23,1,BINTOC(1 ,"1RS"))
ncm_changed = STUFF(m.ncm_changed,161,60,m.lcFontStrChanged)
SystemParametersInfo(SPI_SETNONCLIENTMETRICS,NCM_SIZE, ncm_changed,SPIF_SENDCHANGE)
MESSAGEBOX("Strikethrough")

* Change Back  && 更改背景
ncm_changed = STUFF(m.ncm_changed,161,60,m.lcFontStr)
SystemParametersInfo(SPI_SETNONCLIENTMETRICS,NCM_SIZE, ncm_changed,SPIF_SENDCHANGE)

FUNCTION getheight
    LPARAMETERS tnPointSize
    DECLARE INTEGER GetDC IN USER32 INTEGER hwnd
    DECLARE INTEGER ReleaseDC IN USER32 INTEGER hwnd, INTEGER hdc  
    DECLARE INTEGER GetDeviceCaps IN GDI32 INTEGER hdc, INTEGER nIndex
    DECLARE integer MulDiv IN Kernel32 INTEGER, INTEGER, INTEGER
    LOCAL lnhDC, lnfHeight, LOGPIXELSY
    LOGPIXELSY = 90
    lnhDC = GetDC(0)
    lnfHeight = -MulDiv(tnPointSize, GetDeviceCaps(lnhDC, LOGPIXELSY), 72)
    lnhDC = ReleaseDC(0, lnhDC)
    CLEAR DLLS "GetCD", "ReleaseDC", "GetDeviceCaps", "MulDiv"
RETURN lnfHeight

民工子弟学校22班团小组长阳光模特队长冲锋篮球队前锋小苹果合唱队领唱蓝天舞蹈队编舞
2016-04-20 14:45
aaaaaa
Rank: 8Rank: 8
等 级:贵宾
威 望:21
帖 子:796
专家分:937
注 册:2012-9-4
得分:0 
举一反三,VFP 调用 Net 控件的菜单,仿 Office 2010 风格
Hosting a .NET ActiveX Control in Visual FoxPro
http://www.


民工子弟学校22班团小组长阳光模特队长冲锋篮球队前锋小苹果合唱队领唱蓝天舞蹈队编舞
2016-04-20 15:13
csl591
Rank: 4
等 级:贵宾
威 望:10
帖 子:78
专家分:92
注 册:2009-2-5
得分:0 
学习了
2016-05-06 15:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-463841-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.295816 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved