473,657 Members | 2,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

overriding the Size property in Control?

ORC
How do I override the Size property in a user made Control (e.g.: public
void Graph : Control). I'll need to set gridsize etc. that is dependent of
the control size and therefore I thought that I would set these properties
in the overriden Size property., but I get an error message when trying
this:
public override Size Size
{
set
{
some code...
base.Size = value;
}
}

The compilers error message: Cannot access modifiers when overriding public
inherited member....

Any help is highly appreciated.

Thanks
Ole
Nov 16 '05 #1
3 4000
Why not just override OnSizeChanged? That's what it's there for.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"ORC" <or*@sol.dk> wrote in message
news:eV******** ******@TK2MSFTN GP09.phx.gbl...
How do I override the Size property in a user made Control (e.g.: public
void Graph : Control). I'll need to set gridsize etc. that is dependent of
the control size and therefore I thought that I would set these properties
in the overriden Size property., but I get an error message when trying
this:
public override Size Size
{
set
{
some code...
base.Size = value;
}
}

The compilers error message: Cannot access modifiers when overriding public inherited member....

Any help is highly appreciated.

Thanks
Ole

Nov 16 '05 #2
ORC
Oh sorry - I forgot to tell that I'm writing an application for the Compact
Framework and it doesn't support 'OnSizeChanged' so my question is still
very relevant.

Thanks
Ole

"Bob Powell [MVP]" <bob@_spamkille r_bobpowell.net > wrote in message
news:OL******** ******@tk2msftn gp13.phx.gbl...
Why not just override OnSizeChanged? That's what it's there for.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"ORC" <or*@sol.dk> wrote in message
news:eV******** ******@TK2MSFTN GP09.phx.gbl...
How do I override the Size property in a user made Control (e.g.: public
void Graph : Control). I'll need to set gridsize etc. that is dependent of the control size and therefore I thought that I would set these properties in the overriden Size property., but I get an error message when trying
this:
public override Size Size
{
set
{
some code...
base.Size = value;
}
}

The compilers error message: Cannot access modifiers when overriding

public
inherited member....

Any help is highly appreciated.

Thanks
Ole


Nov 16 '05 #3
ORC
But 'OnResize' is....... thankyou for your inspiration - great.

Thanks
Ole
"ORC" <or*@sol.dk> wrote in message
news:eV******** ******@TK2MSFTN GP10.phx.gbl...
Oh sorry - I forgot to tell that I'm writing an application for the Compact Framework and it doesn't support 'OnSizeChanged' so my question is still
very relevant.

Thanks
Ole

"Bob Powell [MVP]" <bob@_spamkille r_bobpowell.net > wrote in message
news:OL******** ******@tk2msftn gp13.phx.gbl...
Why not just override OnSizeChanged? That's what it's there for.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"ORC" <or*@sol.dk> wrote in message
news:eV******** ******@TK2MSFTN GP09.phx.gbl...
How do I override the Size property in a user made Control (e.g.: public void Graph : Control). I'll need to set gridsize etc. that is dependent
of
the control size and therefore I thought that I would set these properties in the overriden Size property., but I get an error message when

trying this:
public override Size Size
{
set
{
some code...
base.Size = value;
}
}

The compilers error message: Cannot access modifiers when overriding

public
inherited member....

Any help is highly appreciated.

Thanks
Ole



Nov 16 '05 #4

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

Similar topics

8
2258
by: Edward Diener | last post by:
Is it possible for a derived class to override a property and/or event of its base class ?
5
2546
by: Francois Soucy | last post by:
Hi all! I've created a personal control. This control is mainly a panel with some other stuff in. I want to know if it's possible to know the size of the container of this control? I mean that my control can be put on a form or a panel. I want to know the size of the container without knowing what will be exactly. It' possible? Thank a lot --
6
2671
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 TabPagess using combination of buttons Ctrl+Tab (forward) and Ctrl+Shift+Tab (back). I would like to suppress such possibility.
4
5950
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 code and my users are adamant that this behaviour mustn't change. Specifically, I want to be able to set myControl.Enabled = False
18
4727
by: JohnR | last post by:
From reading the documentation, this should be a relatively easy thing. I have an arraylist of custom class instances which I want to search with an"indexof" where I'm passing an instance if the class where only the "searched" property has a value. I expected to get the index into the arraylist where I could then get the entire class instance. However, the 'indexof' is never calling my overloaded, overrides Equals method. Here is the...
4
4666
by: RSH | last post by:
How do I go about overriding a Control's OnPaint Method? I would like to prevent a control's color from changing when it is disabled. I have overridden the Form's OnPaint Method but I need to do it at the control level. Thanks, Ron
4
3717
by: RSH | last post by:
I tried an implementation of overriding a ComboBox control. I am simply trying to avoid it repainting, but I can't seem to get it to work. What am I doing wrong? Please help. Thanks, Ron
3
1813
by: Iain | last post by:
I'm writing a server control which is a navigation bar. My prototype uses id based styles to control the layout and dynamics. Is there any way I can override asp.net's processing of the ID so that the ID will be the one I want regardless of the containing page and so on? Iain -- Iain Downs (DirectShow MVP)
0
1328
by: Kristopher Wragg | last post by:
I've got a control that's used as part of building blocks to create various "views" by our customers, these views are then dynamically compiled then will then be hosted in webpages for their staff to use etc... the problem I'm having is that I've created a control that has an invisble background by overriding CreateParams property, but this requires some permissions... the systems will have a CAS policy that grants full permission for...
0
8394
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7327
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6164
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.