Re: Panel with double buffer

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Bob, I think that is the definition.
What I'm wondering is, why would you, for example, create a Protected
property.
You make it slightly more difficult for a user to change that property, but
you don't prevent it.
(As in my example I make a new class that changes it. I suppose I could make
a new class with a public property that sets the Protected one.)
There must (I hope) be a rational for doing that.
Have you ever created a Protected property? If so why?

Thanks


"Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:%23KG0GyArHHA.3284@xxxxxxxxxxxxxxxxxxxxxxx
Well, now you're getting into aspects of architecture, which I can yack on
about all day :-)

The protected access keyword enforces the rule that class wishing to
change
or affect certain behaviours of an object must derive from the base class
in
question.

This was obviously a desire of the original design team.

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

Ramuseco Limited .NET consulting
http://www.ramuseco.com

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.


" active" <activeNOSPAM@xxxxxxxxxx> wrote in message
news:%23M$ya8lqHHA.4836@xxxxxxxxxxxxxxxxxxxxxxx
I don't think I was clear.

The question is why set ANY property to Protected.

It's a little harder to change then Public - but only a little harder (as
I illustrated below)
If the class prohibits inheritance Protected has a real effect,
but otherwise Protected and Public are basically the same.






"Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3890EBA6-7134-4E02-8D0C-897EF955B9FE@xxxxxxxxxxxxxxxx
I think this was an oversight.

Some would call it an unimplemented feature.

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

Ramuseco Limited .NET consulting
http://www.ramuseco.com

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.


" active" <activeNOSPAM@xxxxxxxxxx> wrote in message
news:uIpJhaiqHHA.4420@xxxxxxxxxxxxxxxxxxxxxxx
A Panel object does not allow DoubleBuffered to be set.



Simply creating a new control as below allows one to set that property
so it isn't that it can't be done.

It's just a little harder.

So, why did they set the property (or any property) to Protected?

What's the rational?



Thanks





Class MyPanel

Inherits System.Windows.Forms.Panel

Public Sub New()

MyBase.New()

'The reason for this class:

'The following protected property needed to be set to reduce flicker

Me.DoubleBuffered = True

End Sub

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

MyBase.Dispose(disposing)

End Sub

End Class








.



Relevant Pages

  • Re: vb.net Multipage TIFF
    ... Bob, I also contacted Michael through your US number in hopes of maybe ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... I had no idea that converting text to tiff was such a big ordeal. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Creating a graphics class on a timer and on its own thread
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... > Public Sub Draw ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Tiff compression
    ... Thanks, Bob. ... I realized after posting that a histogram would do me no good. ... > Find great Windows Forms articles in Windows Forms Tips and Tricks ... > Answer those GDI+ questions with the GDI+ FAQ ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Global variables in a project.
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... > sub Main ... > Public Shared ReadOnly Instance As New Singleton ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Reduce image file size without losing visible quality
    ... Sorry Bob. ... See the GDI+ FAQ. ... > Find great Windows Forms articles in Windows Forms Tips and Tricks ... >> Private Function GetReducedImage(ByRef image As Bitmap) As Bitmap ...
    (microsoft.public.dotnet.framework.drawing)