473,382 Members | 1,377 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,382 software developers and data experts.

Overriding Controls

Good day,

I need to override many different types of controls: RichTextBox, Image,
TextBox, among others. I'm override just a few event handling methods for
them so they all have common event handling code. Basicaly I'm just adding
some event handling code that allows the control to be dragged and dropped
all over the form.

What class do I need to extend to do so? I tried extending
Windows.Forms.Controls but this doesn't work as RichTextBox, Image, etc are
all part of the Windows.Forms namespace.

I don't want to create a UserControl because then I'll have to create a
seperate class for each control.
Nov 17 '05 #1
3 1361
Please correct me if I'm wrong, but it seems that you want to somehow
inherit from one of the common base classes for all Windows controls,
implement some sort of even handling there, and then make that class a
base class for windows controls. Correct?

If it is, then it can't be done. Not in .NET at least, not as far as I
know. Perhaps you could look into the Decorator pattern for a solution.

Nov 17 '05 #2
Please correct me if I'm wrong, but it seems that you want to somehow
inherit from one of the common base classes for all Windows controls,
implement some sort of even handling there, and then make that class a
base class for windows controls. Correct?

If it is, then it can't be done. Not in .NET at least, not as far as I
know. Perhaps you could look into the Decorator pattern for a solution.

Nov 17 '05 #3
Mohammad,

I pretty much want to do the same thing. I want to write one set of code
and then hook this code into the Load event of all controls. I thought there
would be some way to hook into the Load event of the 'Control' class but, if
I understand you correctly, there is no way to do this in C#.net.

Or is there?

Robert W.

"Mohammad" wrote:
Please correct me if I'm wrong, but it seems that you want to somehow
inherit from one of the common base classes for all Windows controls,
implement some sort of even handling there, and then make that class a
base class for windows controls. Correct?

If it is, then it can't be done. Not in .NET at least, not as far as I
know. Perhaps you could look into the Decorator pattern for a solution.

Nov 17 '05 #4

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

Similar topics

17
by: Bob Weiner | last post by:
What is the purpose of hiding intead of overriding a method? I have googled the question but haven't found anything that makes any sense of it. In the code below, the only difference is that...
6
by: Mike | last post by:
Hi, I have such problem: On my form I have TabControl. I want to move from one tab to another using "Next" and "Prev" button. This part works fine. But control also supports switching between...
6
by: Mike | last post by:
Hi, I have such problem: On my form I have TabControl. I want to move from one tab to another using "Next" and "Prev" button. This part works fine. But control also supports switching between...
4
by: Phill. W | last post by:
Here's a knotty little problem. I have some nasty little controls that needs to behave in a non- windows-Standard way - don't ask why; it's a large application being converted from some older...
0
by: alwayssmiling | last post by:
Hi, In my application, In the main form tab control is there. For this im adding a tabpage which contains a user control, this usercontrol contains many windows controls and other userdefined...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.