473,387 Members | 1,516 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,387 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 1362
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: 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:
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.