惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
Hacker News: Ask HN
Hacker News: Ask HN
V
Visual Studio Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
I
InfoQ
A
About on SuperTechFans
宝玉的分享
宝玉的分享
Project Zero
Project Zero
C
CXSECURITY Database RSS Feed - CXSecurity.com
量子位
The Register - Security
The Register - Security
大猫的无限游戏
大猫的无限游戏
Blog — PlanetScale
Blog — PlanetScale
Simon Willison's Weblog
Simon Willison's Weblog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
The Exploit Database - CXSecurity.com
Cyberwarzone
Cyberwarzone
L
LINUX DO - 热门话题
博客园 - 聂微东
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
P
Privacy International News Feed
T
Tenable Blog
博客园 - 叶小钗
P
Palo Alto Networks Blog
S
Securelist
F
Full Disclosure
Help Net Security
Help Net Security
爱范儿
爱范儿
Cisco Talos Blog
Cisco Talos Blog
F
Fortinet All Blogs
Google DeepMind News
Google DeepMind News
IT之家
IT之家
S
Secure Thoughts
Martin Fowler
Martin Fowler
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
G
GRAHAM CLULEY
J
Java Code Geeks
Forbes - Security
Forbes - Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
A
Arctic Wolf
L
LangChain Blog
Webroot Blog
Webroot Blog
TaoSecurity Blog
TaoSecurity Blog
月光博客
月光博客
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

博客园 - 学剑学诗两不成

VB:如何实现在代码中弹出toolbar的ButtonMenu VB:如何发送WM_KEYDOWN和WM_KEYUP消息 利用IDocHostUIHandler接口屏蔽WebBrowser的弹出菜单 VB:如何改变ComboBox自身的高度 VB:如何允许/禁止RICHTEXTBOX中的OLE对象拉伸 一个很有用的自定义函数 - 学剑学诗两不成 - 博客园 VB:如何隐藏/显示treeview的ToolTips - 学剑学诗两不成 - 博客园 VB:如何启用/禁用本地连接 VB:如何选定文件或文件夹 - 学剑学诗两不成 - 博客园 一个远程调用api函数的模块(转贴) VB:如何用需要身份验证的SMTP邮件服务器发信 - 学剑学诗两不成 - 博客园 VB:如何监听打开的窗口和程序 VB:如何隐藏ListView的某一列 vb:如何禁止鼠标指针进入某个区域 如何使frame控件的caption居中显示 - 学剑学诗两不成 - 博客园 怎样去掉窗体上的图标 - 学剑学诗两不成 - 博客园 VB中对string array快速插入、删除某个元素的办法 - 学剑学诗两不成 - 博客园 bug:在windows xp下用ImageList_GetImageCount返回值不正确(VB) - 学剑学诗两不成 - 博客园 VB中字符串数组快速复制的一种方法 - 学剑学诗两不成 - 博客园
VB:如何设置Richtextbox的行间距
学剑学诗两不成 · 2006-02-20 · via 博客园 - 学剑学诗两不成

        随着vb6几个补丁的退出,事实上richtextbox正悄悄发生变化,它已经支持richedit2.0了,所以我们可以设置结构体PARAFORMAT2的dyLineSpacing成员,然后将PARAFORMAT2结构体作为lparam参数,对richtextbox发送EM_SETPARAFORMAT消息,即可实现我们的要求,具体代码如下:
Option Explicit

Private Declare Function SendMessage& Lib "user32" Alias "SendMessageA" _
    (ByVal hwnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Long, lParam As Any)

Private Const WM_USER& = &H400
Private Const EM_GETPARAFORMAT = (WM_USER + 61)
Private Const EM_SETPARAFORMAT = (WM_USER + 71)
Private Const MAX_TAB_STOPS = 32&

Private Type PARAFORMAT2
    'Los primeros campos coinciden con PARAFORMAT y se usan igual
    cbSize As Integer
    wPad1 As Integer
    dwMask As Long
    wNumbering As Integer
    wEffects As Integer 'No usado en PARAFORMAT
    dxStartIndent As Long
    dxRightIndent As Long
    dxOffset As Long
    wAlignment As Integer
    cTabCount As Integer
    lTabStops(0 To MAX_TAB_STOPS - 1) As Long
    ' Desde aquí lo a?adido por PARAFORMAT2
    dySpaceBefore As Long '/* Vertical spacing before para */
    dySpaceAfter As Long '/* Vertical spacing after para */
    dyLineSpacing As Long '/* Line spacing depending on Rule */
    sStyle As Integer ' /* Style handle */
    bLineSpacingRule As Byte '/* Rule for line spacing (see tom.doc) */
    bOutlineLevel As Byte '/* Outline Level*/'antes bCRC As Byte
    wShadingWeight As Integer '/* Shading in hundredths of a per cent */
    wShadingStyle As Integer '/* Byte 0: style, nib 2: cfpat, 3: cbpat*/
    wNumberingStart As Integer '/* Starting value for numbering */
    wNumberingStyle As Integer ' /* Alignment, Roman/Arabic, (), ), ., etc.*/
    wNumberingTab As Integer '/* Space bet 1st indent and 1st-line text*/
    wBorderSpace As Integer ' /* Border-text spaces (nbl/bdr in pts) */
    wBorderWidth As Integer '/* Pen widths (nbl/bdr in half twips) */
    wBorders As Integer '/* Border styles (nibble/border) */
End Type

' /* PARAFORMAT mask values */
Private Const PFM_STARTINDENT = &H1&
Private Const PFM_RIGHTINDENT = &H2&
Private Const PFM_OFFSET = &H4&
Private Const PFM_ALIGNMENT = &H8&
Private Const PFM_TABSTOPS = &H10&
Private Const PFM_NUMBERING = &H20&
Private Const PFM_OFFSETINDENT = &H80000000

' /* PARAFORMAT numbering options */
Private Const PFN_BULLET = &H1&

' /* PARAFORMAT alignment options */
Private Const PFA_LEFT = &H1&
Private Const PFA_RIGHT = &H2&
Private Const PFA_CENTER = &H3&

'/* PARAFORMAT 2.0 masks */
Private Const PFM_SPACEBEFORE = &H40&
Private Const PFM_SPACEAFTER = &H80&
Private Const PFM_LINESPACING = &H100&
Private Const PFM_STYLE = &H400&
Private Const PFM_NUMBERINGSTYLE = &H2000& ' /* RE 3.0 */
Private Const PFM_NUMBERINGTAB = &H4000& ' /* RE 3.0 */
Private Const PFM_NUMBERINGSTART = &H8000& ' /* RE 3.0 */
Private Const PFM_TABLE = &HC0000000 ' /* RE 3.0 */
'// The following three properties are read only
Private Const PFM_COLLAPSED = &H1000000 '/* RE 3.0 */
Private Const PFM_OUTLINELEVEL = &H2000000 '/* RE 3.0 */
Private Const PFM_BOX = &H4000000 '/* RE 3.0 */

'/* PARAFORMAT2 wNumbering options (see also PFN_BULLET) */
Private Const PFN_ARABIC = 2 '/* tomListNumberAsArabic: 0, 1, 2, ...*/
Private Const PFN_LCLETTER = 3 '/* tomListNumberAsLCLetter: a, b, c, ...*/
Private Const PFN_UCLETTER = 4 '/* tomListNumberAsUCLetter: A, B, C, ...*/
Private Const PFN_LCROMAN = 5 '/* tomListNumberAsLCRoman: i, ii, iii, ...*/
Private Const PFN_UCROMAN = 6 '/* tomListNumberAsUCRoman: I, II, III, ...*/

'/* PARAFORMAT2 wNumberingStyle options */
Private Const PFNS_PAREN = &H0 '/* default, e.g., 1) */
Private Const PFNS_PARENS = &H100 '/* tomListParentheses/256, e.g., (1) */
Private Const PFNS_PERIOD = &H200 '/* tomListPeriod/256, e.g., 1. */
Private Const PFNS_PLAIN = &H300 '/* tomListPlain/256, e.g., 1 */
Private Const PFNS_NONUMBER = &H400 '/* Used for continuation w/o number

Private Sub Form_Load()
    Dim pf As PARAFORMAT2
    With pf
    .cbSize = LenB(pf)
    pf.dwMask = PFM_LINESPACING
    .bLineSpacingRule = 4
    .dyLineSpacing = 40 * 15
    End With
    Dim i As Long
    i = SendMessage(RichTextBox1.hwnd, EM_SETPARAFORMAT, 0, ByVal VarPtr(pf))
End Sub