高手们,VFP怎么能显示修改字符间距

qq_37754406 2017-03-04 02:04:32
高手们,怎么能显示修改字符间距?比如:
@ 3,5 say “ ABCDEFGH”
想显示的时候来开字符之间的距离。谢卡
...全文
810 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
kangss 2017-03-16
  • 打赏
  • 举报
回复
只能收藏了。谢谢!
十豆三 2017-03-15
  • 打赏
  • 举报
回复
引用 8 楼 zyg8108 的回复:

*!*	函数名称:GetTextCharacterExtra
*!*	函数功能:获取指定设备环境中当前字符间隔

Clear
Do Decl
#Define TRANSPARENT  1
#Define OPAQUE       2

#Define TA_LEFT      0
#Define TA_CENTER    6
#Define TA_RIGHT     2

Private hWindow, hDC
hWindow = GetActiveWindow()
hDC = GetWindowDC(hWindow)

= SetBkMode (hDC, TRANSPARENT)

Do PrintText With Rgb(192,  0,  0), 600, 100, 0, 0
Do PrintText With Rgb(  0,192,  0), 600, 120, 6, 1
Do PrintText With Rgb(  0,  0,192), 600, 140, 2, 2
Do PrintText With Rgb(192,  0,192), 600, 160, 2, 3
Do PrintText With Rgb(192,192,  0), 600, 180, 0, 1
Do PrintText With Rgb(  0,192,192), 600, 200, 6, 0

= ReleaseDC(hWindow, hDC)

Procedure PrintText (lnColor, lnX, lnY, lnAlign, lnInterChar)
    Local lcText, lcFont, lnBufsize

    lcFont = Space(250)
    lnBufsize = GetTextFace(hDC, Len(lcFont), @lcFont)
    lcFont = Left(lcFont, lnBufsize)

    = SetTextAlign (hDC, lnALign)
    = SetTextCharacterExtra (hDC, lnInterChar)
    = SetTextColor (hDC, lnColor)

    lcText = ;
        "字体名: " + lcFont + ;
        ", 颜色值: " + Ltrim(Str(GetTextColor(hDC))) + ;
        ", 字对齐: " + Ltrim(Str(GetTextAlign(hDC))) + ;
        ", 字间距: " + Ltrim(Str(GetTextCharacterExtra(hDC)))

    = TextOut (hDC, lnX, lnY, lcText, Len(lcText))

Procedure Decl
    Declare Integer GetActiveWindow In user32
    Declare Integer GetWindowDC In user32 Integer HWnd
    Declare Integer ReleaseDC In user32 Integer HWnd, Integer hDC
    Declare Integer GetTextAlign In gdi32 Integer hdc
    Declare Integer SetTextAlign In gdi32 Integer hdc, Integer fMode
    Declare Integer SetTextCharacterExtra In gdi32 Integer hdc, Integer nCharExtra
    Declare Integer GetTextCharacterExtra In gdi32 Integer hdc
    Declare Integer GetTextColor In gdi32 Integer hdc
    Declare Integer SetTextColor In gdi32 Integer hdc, Integer crColor
    Declare Integer SetBkMode In gdi32 Integer hdc, Integer iBkMode

    Declare Integer TextOut In gdi32;
        INTEGER hdc, Integer x, Integer Y,;
        STRING lpString, Integer nCount

    Declare Integer GetTextFace In gdi32;
        INTEGER hdc, Integer nCount, String @lpFaceName
Endproc

qq_37754406 2017-03-07
  • 打赏
  • 举报
回复
再次感谢大家回复。
回马枪 2017-03-05
  • 打赏
  • 举报
回复

*!*	函数名称:GetTextCharacterExtra
*!*	函数功能:获取指定设备环境中当前字符间隔

Clear
Do Decl
#Define TRANSPARENT  1
#Define OPAQUE       2

#Define TA_LEFT      0
#Define TA_CENTER    6
#Define TA_RIGHT     2

Private hWindow, hDC
hWindow = GetActiveWindow()
hDC = GetWindowDC(hWindow)

= SetBkMode (hDC, TRANSPARENT)

Do PrintText With Rgb(192,  0,  0), 600, 100, 0, 0
Do PrintText With Rgb(  0,192,  0), 600, 120, 6, 1
Do PrintText With Rgb(  0,  0,192), 600, 140, 2, 2
Do PrintText With Rgb(192,  0,192), 600, 160, 2, 3
Do PrintText With Rgb(192,192,  0), 600, 180, 0, 1
Do PrintText With Rgb(  0,192,192), 600, 200, 6, 0

= ReleaseDC(hWindow, hDC)

Procedure PrintText (lnColor, lnX, lnY, lnAlign, lnInterChar)
    Local lcText, lcFont, lnBufsize

    lcFont = Space(250)
    lnBufsize = GetTextFace(hDC, Len(lcFont), @lcFont)
    lcFont = Left(lcFont, lnBufsize)

    = SetTextAlign (hDC, lnALign)
    = SetTextCharacterExtra (hDC, lnInterChar)
    = SetTextColor (hDC, lnColor)

    lcText = ;
        "字体名: " + lcFont + ;
        ", 颜色值: " + Ltrim(Str(GetTextColor(hDC))) + ;
        ", 字对齐: " + Ltrim(Str(GetTextAlign(hDC))) + ;
        ", 字间距: " + Ltrim(Str(GetTextCharacterExtra(hDC)))

    = TextOut (hDC, lnX, lnY, lcText, Len(lcText))

Procedure Decl
    Declare Integer GetActiveWindow In user32
    Declare Integer GetWindowDC In user32 Integer HWnd
    Declare Integer ReleaseDC In user32 Integer HWnd, Integer hDC
    Declare Integer GetTextAlign In gdi32 Integer hdc
    Declare Integer SetTextAlign In gdi32 Integer hdc, Integer fMode
    Declare Integer SetTextCharacterExtra In gdi32 Integer hdc, Integer nCharExtra
    Declare Integer GetTextCharacterExtra In gdi32 Integer hdc
    Declare Integer GetTextColor In gdi32 Integer hdc
    Declare Integer SetTextColor In gdi32 Integer hdc, Integer crColor
    Declare Integer SetBkMode In gdi32 Integer hdc, Integer iBkMode

    Declare Integer TextOut In gdi32;
        INTEGER hdc, Integer x, Integer Y,;
        STRING lpString, Integer nCount

    Declare Integer GetTextFace In gdi32;
        INTEGER hdc, Integer nCount, String @lpFaceName
Endproc

qq_37754406 2017-03-04
  • 打赏
  • 举报
回复
别人问的,我以为现在的VFP能一个函数就能解决,也感谢你的回答,复杂就算了。以前在UCDOS下,一个控制符就能解决啦。再次感谢。
十豆三 2017-03-04
  • 打赏
  • 举报
回复
引用 5 楼 qq_37754406 的回复:
平常显示是这样 ABCDEFGH 就是想字符之间拉开一点距离显示 A B C D E F G H 你的第一个回答就是直接加一个空格拉开,我是想按照我的尺寸拉开
不用这么纠结吧,做成图片拉伸
引用 5 楼 qq_37754406 的回复:
平常显示是这样 ABCDEFGH 就是想字符之间拉开一点距离显示 A B C D E F G H 你的第一个回答就是直接加一个空格拉开,我是想按照我的尺寸拉开
有难度,@ 语句肯定不支持,也不知道 GDI+ 能实现不 不知楼主为什么要这样,意义很重要?
qq_37754406 2017-03-04
  • 打赏
  • 举报
回复
平常显示是这样 ABCDEFGH 就是想字符之间拉开一点距离显示 A B C D E F G H 你的第一个回答就是直接加一个空格拉开,我是想按照我的尺寸拉开
十豆三 2017-03-04
  • 打赏
  • 举报
回复
你想实现什么效果,或者说你什么目的? 来个效果图
qq_37754406 2017-03-04
  • 打赏
  • 举报
回复
高手,不行啊,你这命令不起作用。是VFP6.0
十豆三 2017-03-04
  • 打赏
  • 举报
回复
@ 3,5 say "A B C D E F G H" or @ 3,5 say Strconv("ABCDEFGH",1)
十豆三 2017-03-04
  • 打赏
  • 举报
回复
这是Foxbase时代码代码

2,728

社区成员

发帖
与我相关
我的任务
社区描述
VFP,是Microsoft公司推出的数据库开发软件,用它来开发数据库,既简单又方便。
社区管理员
  • VFP社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧