VB编程 在richtextbox 内,如何通过按钮或其他事件,复制、粘贴带格式的文本(比如字体、字号、颜色)。
在百度知道中搜到一段代码:PrivateDeclareFunctionSendMessageLib"user32"Alias"SendMessageA"(ByValhwn...
在百度知道中搜到一段代码:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_COPY = &H301
Private Sub Command1_Click()
With RichTextBox1
.Text = "this is a VB妮可's test!!"
.SelStart = 10
.SelLength = 6
.SelColor = vbRed
.SelFontName = "黑体"
.SelFontSize = 18
End With
RichTextBox1.SetFocus
SendMessage RichTextBox1.hwnd, WM_COPY, 0, ByVal 0
End Sub
这段代码我虽然看不懂(新手),但可以实现用按钮复制。
如何实现粘贴,是不是 &H301是个《复制》的常数,另外还有《粘贴》的常数?
请高手指教,谢谢!!! 展开
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_COPY = &H301
Private Sub Command1_Click()
With RichTextBox1
.Text = "this is a VB妮可's test!!"
.SelStart = 10
.SelLength = 6
.SelColor = vbRed
.SelFontName = "黑体"
.SelFontSize = 18
End With
RichTextBox1.SetFocus
SendMessage RichTextBox1.hwnd, WM_COPY, 0, ByVal 0
End Sub
这段代码我虽然看不懂(新手),但可以实现用按钮复制。
如何实现粘贴,是不是 &H301是个《复制》的常数,另外还有《粘贴》的常数?
请高手指教,谢谢!!! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询