Yes,
As you stated, you can see that the designer adds its own code to set
the properties.
And you can do the same. It just might not be as efficient as the code
the designer makes due to the reasons I made. (Don't directly edit the
designer code unless you know what you are doing as there's a good
chance your changes will be lost)
We have come across speed issues in our application due to runtime
setting of properties. Our solution was to follow the pattern used by
the designer and implement and use the IInitializable interface
(BeginInit, EndInit) for our own runtime code.
We also had problems with the gui re-drawing as you change properties,
which can be very slow. These issues can be quite complex to solve at
times.
However, I don't think the Title property is one that will suffer from
any speed issues.
Tigger
Cor Ligthert [MVP] wrote:
Quote:
Tigger,
>
Maybe is that your intention, but it can be readed in another way.
>
The so called design time properties can also be used by code yourself.
>
Cor
>
"Tigger" <tony@grunt.tvschreef in bericht
news:1160352827.687585.170030@e3g2000cwe.googlegro ups.com...
Quote:
There can be a differences to designer and runtime setting of
properties.
If you look at the designer generated code it sometimes wraps
BeginInit() and EndInit() around the setting of a controls properties.
This is so the control can optimise the initialising of properties,
generally by delaying any actions on the property until the EndInit.
Also, setting at run time could be done too late thus causing something
like the title to be drawn twice.
I would recommend using the design time setting if possible.
Tigger
Cor Ligthert [MVP] wrote:
Quote:
Hi Op.
>
If you click on the designer generated code on the + in version 1.x or
look
in the designer class if you put in top of the Solution Explorer "Show
all
files" in the class with the name xx.designer.cs than you see the
generated
code. That is mostly better than that you or I would do it by hand.
>
I thought Tom was pretty clear, but before somebode doubt in that.
>
:-))))))
>
Cor
>
>
"Tom Shelton" <tom@mtogden.comschreef in bericht
news:1160276666.661973.181100@e3g2000cwe.googlegro ups.com...
Robbe Morris [C# MVP] wrote:
The designer simply writes the code for you. There
is no real difference.
>
That is what I was trying to say... Perhaps I was unclear.
--
Tom Shelton