technofantasy

博客园 首页 新随笔 联系 订阅 管理
  22 Posts :: 16 Stories :: 62 Comments :: 1 Trackbacks

Properties - all sizes are in twips
 xLeft - Position of the left edge of the table
 isCentered - Set to True to center the table
 Rows - Sets or returns the number of rows in the table
 Columns - Sets or returns the number of columns in the table
 Row - An Array of Rows (1 to Rows)
 Column - An Array of columns (1 to Columns)
  Column(i).xWidth - Width of the ith column
 Cell - A 2-d Array of Cells (1 to Rows, 1 to Columns)
  Cell(r, c).Contents - Sets or returns the contents of the cell

Methods
 InsertTable(RTB As RichTextBox) - Inserts the table into the RichTextBox
                         at the currrent cursor position.

代码下载地址:
http://www.applevb.com/RTFtable.zip

使用范例:

Option Explicit

Dim RTFtable As clsRTFtable
Private Declare Function LockWindowUpdate Lib "user32" ( _
    
ByVal hwndLock As Long _
As Long

Private Sub Command1_Click()
  
Dim i As Integer
  
Set RTFtable = New clsRTFtable
  
'stop flicker
  Call LockWindowUpdate(RichTextBox1.hWnd)
  
  
For i = 1 To 5
  
With RTFtable
    
'set the size of the table
    .Columns = 3
    .Rows 
= 2
    
'fill the cells
    'Row 1
    .Cell(11).Contents = "Row 1"
    .Cell(
12).Contents = "Column2"
    .Cell(
13).Contents = "Column3"

    
'Row 2
    .Cell(21).Contents = "Row2"
    .Cell(
22).Contents = "R2C2"
    .Cell(
23).Contents = "R2C3"
    
'do we want to center it on the page?
    .isCentered = True
    
    
'insert the table at the current cursor postion
    .InsertTable RichTextBox1
  
End With
  
Next i
    
Call LockWindowUpdate(0)

End Sub
posted on 2006-09-06 17:17 陈锐 阅读(688) 评论(1)  编辑 收藏 所属分类: RichTextBox技巧

Feedback

不错。。
  回复  引用    


标题  
姓名  
主页
Email (只有博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
 
另存  打印