473,387 Members | 1,463 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.

accessing protected members of inherited classes

JH
I am attempting to enable double buffering for a panel
control. The SetStyle method of the panel control is
protected, so I am attempting to access it by writing a
special panel class that inherits from
System.Windows.Forms.Panel.

But from there I am not sure how to access the protected
member SetStyle to set DoubleBuffer to true. Can anyone
point me in the right direction? Some code example would
be extremely helpful to me.

Thanks

JH
Nov 15 '05 #1
2 4292
All you have to do is derive your class from Panel:

class SpecialPanel: System.Windows.Forms.Panel
{
}

from MSDN Control.SetStyle:

public void EnableDoubleBuffering()
{
// Set the value of the double-buffering style bits to true.
this.SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
this.UpdateStyles();
}
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"JH" <jh******@netzero.net> wrote in message
news:08****************************@phx.gbl...
I am attempting to enable double buffering for a panel
control. The SetStyle method of the panel control is
protected, so I am attempting to access it by writing a
special panel class that inherits from
System.Windows.Forms.Panel.

But from there I am not sure how to access the protected
member SetStyle to set DoubleBuffer to true. Can anyone
point me in the right direction? Some code example would
be extremely helpful to me.

Thanks

JH

Nov 15 '05 #2
Hi Machin,

Thats really Great. But I still have a doubt on how do you access EnableDoubleBufering in your main file.

I have a similar issue over here.
In panel1_paint() I am drawing a circle and shrinking/expanding it using Mouse. But this is having lot of flickering on the screen. As it is said in the below reply I wrote a class and created EnableDoubleBufering() function. But after that how shd I use this in the mail file so that my existing panel1 will have a no-flickering impact.

Regards,
Yeshwanth


All you have to do is derive your class from Panel:

class SpecialPanel: System.Windows.Forms.Panel
{
}

from MSDN Control.SetStyle:

public void EnableDoubleBuffering()
{
// Set the value of the double-buffering style bits to true.
this.SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
this.UpdateStyles();
}


Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"JH" <jhirsch3@netzero.net> wrote in message
news:086a01c36146$f72a85f0$a401280a@phx.gbl...[color=blue]
> I am attempting to enable double buffering for a panel
> control. The SetStyle method of the panel control is
> protected, so I am attempting to access it by writing a
> special panel class that inherits from
> System.Windows.Forms.Panel.
>
> But from there I am not sure how to access the protected
> member SetStyle to set DoubleBuffer to true. Can anyone
> point me in the right direction? Some code example would
> be extremely helpful to me.
>
> Thanks
>
> JH[/color]
Jun 21 '06 #3

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

Similar topics

2
by: Simon White | last post by:
Hi, I have code that looks legal to me and has compiled for years and on latest VC, etc compilers. Just recently gcc made a change to their compiler (3.4) that broke it. I don't have access to...
2
by: Steven T. Hatton | last post by:
I find the surprising. If I derive Rectangle from Point, I can access the members of Point inherited by Rectangle _IF_ they are actually members of a Rectangle. If I have a member of type Point...
13
by: Adam H. Peterson | last post by:
I just made an observation and I wondered if it's generally known (or if I'm missing something). My observation is that static protected members are essentially useless, only a hint to the user. ...
11
by: Kevin Prichard | last post by:
Hi all, I've recently been following the object-oriented techiques discussed here and have been testing them for use in a web application. There is problem that I'd like to discuss with you...
2
by: Mr Dyl | last post by:
There's probably a simple explanation for this and it's just too late for my brain to work. Does anybody know a good reason why class B2 compiles but class B1 doesn't? class A { public: class...
3
by: Joe | last post by:
Hello All: I have two webforms (WebForm1.aspx and WebForm2.aspx) that inherit from BasePage.aspx. BasePage.aspx inherits System.Web.UI.Page and has one hidden field (hdnSessionId) that I want...
14
by: lovecreatesbea... | last post by:
Could you tell me how many class members the C++ language synthesizes for a class type? Which members in a class aren't derived from parent classes? I have read the book The C++ Programming...
6
by: Rick | last post by:
Hi, Can anyone explain to me why the below fails to compile - seeing otherA->f(); as a call to a inaccessible function, while otherB->f(); is ok? It seems you can happily access protected...
3
by: Neal | last post by:
Hi all Why do I get a compiler error with the following code. Friend Class SomeClass End Class Public Class SomePublicClass Protected Friend Function AMethod As SomeClass
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: 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
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: 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:
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
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,...

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.