Click here to Skip to main content
15,892,537 members
Home / Discussions / C#
   

C#

 
GeneralRe: TimeSpan Error?? Pin
Ravi Bhavnani17-Aug-15 5:24
professionalRavi Bhavnani17-Aug-15 5:24 
GeneralRe: TimeSpan Error?? Pin
Kevin Marois17-Aug-15 5:25
professionalKevin Marois17-Aug-15 5:25 
GeneralRe: TimeSpan Error?? Pin
Ravi Bhavnani17-Aug-15 5:35
professionalRavi Bhavnani17-Aug-15 5:35 
GeneralRe: TimeSpan Error?? Pin
Matt T Heffron17-Aug-15 6:55
professionalMatt T Heffron17-Aug-15 6:55 
GeneralRe: TimeSpan Error?? Pin
Richard Deeming17-Aug-15 7:10
mveRichard Deeming17-Aug-15 7:10 
QuestionWhy don't I see a VSTO template Pin
Gary Huck14-Aug-15 9:47
Gary Huck14-Aug-15 9:47 
AnswerRe: Why don't I see a VSTO template Pin
Richard MacCutchan14-Aug-15 20:49
mveRichard MacCutchan14-Aug-15 20:49 
Question(Solved) How to send a message from a rich text box control to a form Pin
Leif Simon Goodwin14-Aug-15 0:56
Leif Simon Goodwin14-Aug-15 0:56 
I have a form and want to display formatted text. I use a RichTextBox control. But I want windows message such as mouse clicks on the text to be handled by the parent form. So I disable the control. But that changes the background colour to grey, which is unacceptable as I want to set the background colour. Okay, so I override the WndProc method of the RichTextBox and use SendMessage to send messages such as mouse double click to the parent. That works, the form WndProc DOES receive the double click. But, the form's handler for a mouse double click is not invoked. Why is this? Does the system invoke Form event handlers instead of WndProc?

Note that the mouse bouble click message includs the client position in the lParam arg. I changed that from the location in the RichTextBox to the location in the parent form.

SOLVED
The problem is how to make a RichTextBox transparent to mouse events, so that it does no more than draw text on screen. Disabling the richtextbox sets a fixed background colour, which is not what I want.

The solution is to handle mouse events from the richeditbox in the form. Then in each event handler call Form.OnXXXXXX method e.g. Form.OnDoubleClick().

So in the end this is actually quite simple! Smile | :)

Thanks all for comments.

modified 14-Aug-15 11:03am.

AnswerRe: How to send a message from a rich text box control to a form Pin
Arthur V. Ratz14-Aug-15 2:08
professionalArthur V. Ratz14-Aug-15 2:08 
SuggestionRe: How to send a message from a rich text box control to a form Pin
Richard Deeming14-Aug-15 3:18
mveRichard Deeming14-Aug-15 3:18 
GeneralRe: How to send a message from a rich text box control to a form Pin
Leif Simon Goodwin14-Aug-15 3:27
Leif Simon Goodwin14-Aug-15 3:27 
GeneralRe: How to send a message from a rich text box control to a form Pin
Arthur V. Ratz14-Aug-15 3:36
professionalArthur V. Ratz14-Aug-15 3:36 
GeneralRe: How to send a message from a rich text box control to a form Pin
Arthur V. Ratz14-Aug-15 3:30
professionalArthur V. Ratz14-Aug-15 3:30 
GeneralRe: How to send a message from a rich text box control to a form Pin
Leif Simon Goodwin14-Aug-15 3:43
Leif Simon Goodwin14-Aug-15 3:43 
GeneralRe: How to send a message from a rich text box control to a form Pin
Arthur V. Ratz14-Aug-15 3:59
professionalArthur V. Ratz14-Aug-15 3:59 
GeneralRe: How to send a message from a rich text box control to a form Pin
Arthur V. Ratz14-Aug-15 6:30
professionalArthur V. Ratz14-Aug-15 6:30 
GeneralRe: How to send a message from a rich text box control to a form Pin
Member 1144608014-Aug-15 18:24
Member 1144608014-Aug-15 18:24 
QuestionRuntime Form Designer Pin
Member 1144608014-Aug-15 0:00
Member 1144608014-Aug-15 0:00 
QuestionGo to Next Items of List box using timer in C# Pin
Member 1190306213-Aug-15 20:55
Member 1190306213-Aug-15 20:55 
AnswerRe: Go to Next Items of List box using timer in C# Pin
Wendelius13-Aug-15 21:01
mentorWendelius13-Aug-15 21:01 
AnswerRe: Go to Next Items of List box using timer in C# Pin
OriginalGriff13-Aug-15 22:04
mveOriginalGriff13-Aug-15 22:04 
GeneralRe: Go to Next Items of List box using timer in C# Pin
Member 1190306214-Aug-15 0:04
Member 1190306214-Aug-15 0:04 
GeneralRe: Go to Next Items of List box using timer in C# Pin
OriginalGriff14-Aug-15 0:28
mveOriginalGriff14-Aug-15 0:28 
GeneralRe: Go to Next Items of List box using timer in C# Pin
Member 1190306214-Aug-15 2:06
Member 1190306214-Aug-15 2:06 
GeneralRe: Go to Next Items of List box using timer in C# Pin
OriginalGriff14-Aug-15 2:27
mveOriginalGriff14-Aug-15 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.