473,395 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

RichTextBox/Protected Question

Hi,

Im fairly new to C# but have som experience in the C++/MFC world and I am a bit confused as I cant find some information that I am used to having.

I am trying to use the RichTextBox control and specifically the Protected event. In C# I get no arguments to this event (well I do but the EventArgs object contains no usefull information). If I was to receive this as a message in C++, by receiveing the EN_PROTECTED notification, I would get this structure

typedef struct _enprotected {
NMHDR nmhdr;
UINT msg;
WPARAM wParam;
LPARAM lParam;
CHARRANGE chrg;
} ENPROTECTED;

as well as the notification. This contains lots of useful information. Whats happening here, how do i get hold of this information in C#? I assume I am missing something fairly obvious...

Thanks,
Jesper
Nov 16 '05 #1
1 1766
Yep. That's C#!

I'm finding out these things the hard way. I have stumbled across the
information, somewhere, that the EventArgs parameter is empty by design,
i.e. that is the default!

You have to arrange for the sender object to put something in there. Which
means that you have to write the code yourself. You have to derive your own
EventArgs class from the built-in System. But there again, the different
'controls', have different pre-built 'events handlers'.
Although the 'handlers' all having the same 'signature' - they return
'void' and have those two parameters - the names, e.g. the event handler
built into the built-in 'timer' object is named 'Elapsed', and its event arg
is named 'ElapsedEventArgs' - their contents, are not.

This information from two differrent (expensive!) Microsoft books - I have
five such, including a famous O'Reilly brand - many more person-to-person
(i.e. pirated) e-books, 'help' files etc.etc. and two months on, I still
can't find out how to stop a simple double-click from defaulting to blueing
up a selected word. It is that easy with JavaScript ('return true'!) in
html.

Encapsulation? ArrRRRRRRRRRrrrrgh!

Eddie
"Jesper" <Je****@discussions.microsoft.com> wrote in message
news:4D**********************************@microsof t.com...
Hi,

Im fairly new to C# but have som experience in the C++/MFC world and I am a bit confused as I cant find some information that I am used to having.
I am trying to use the RichTextBox control and specifically the Protected event. In C# I get no arguments to this event (well I do but the EventArgs
object contains no usefull information). If I was to receive this as a
message in C++, by receiveing the EN_PROTECTED notification, I would get
this structure
typedef struct _enprotected {
NMHDR nmhdr;
UINT msg;
WPARAM wParam;
LPARAM lParam;
CHARRANGE chrg;
} ENPROTECTED;

as well as the notification. This contains lots of useful information. Whats happening here, how do i get hold of this information in C#? I assume
I am missing something fairly obvious...
Thanks,
Jesper

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: user | last post by:
Hello When i add new lines of text to my RichTextBox, and when vertical scroll bar appear (there is more text than RichTextBox can display), RichTextBox always display "the oldest text" (vertical...
2
by: Leon Friesema | last post by:
Hiyall! I have a RichTextBox inside a UserControl which should be able to indent a block off text (or UnIndent for that matter) like the SourceEditor of VS2003 or WinWord does. All controls on...
2
by: chrisben | last post by:
Hi, I am using .NET 1.1. I put a web address to a RichTextBox and set its DetectUrls property as true. After the app starts, it underline the link automatically but I cannot click it. How can I...
3
by: Rachel Suddeth | last post by:
I want to react to scrolls in a RichTextBox (I want to let the user know when he has changed to a new printable page.) I have handled the VScroll() event, but that only responds to scrollbar...
0
by: Claudiu | last post by:
Is posible that erase protected areas in RichTextBox and press undo the protected area to remain protected, not to be added to the richtextbox plain text
3
by: michael sorens | last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a very simple task but I cannot find information on this. I am using a RichTextBox as an output window. Some text I want to...
0
by: Vivien Parlat | last post by:
Hello, I searched hard but couldn't find an answer to that question : what's wrong in my code (see below), I'm trying to create an extended RichTextBox, adding new "things" to be painted into...
2
by: MLM450 | last post by:
I need to programmatically delete protected text in a RichTextBox. The problem is that I can't find a way to do it without getting undesirable results in the undo buffer. If I unprotect the text...
1
by: Andrus | last post by:
I need to save font selected by user by Ctrl+MouseWheel in Winforms RichTextBox. I tried override below but this does not remember font: in this method Font.Size property seems to be always...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.