J
Joe Keller
Hello,
My CF application utilizes many custom controls that I have not yet taken
the time to place in the Visual Studio.NET toolbox so I must manually code
the creation and assignment of the various properties to the controls (e.g.
Font, Bounds, Parent, etc.).
One thing I've noticed is that if I follow the approach that the Visual
Studio designer utilizes in assigning a Font to a control is that I'm
creating a new Font object for each custom control that I display on the
screen. The code for assigning a Font to an object typically looks like the
following:
lblName.Font = new Font("Tahoma", 8F, FontStyle.Regular);
To minimize the creation of all of these Font objects, I've created an
object with a static Font property that I am using to assign to my various
custom controls. Using this new static Font property, my code looks like
the following:
lblName.Font = MyApp.Font;
Does anyone see any problems with using this approach? It seems logical to
me that this would cut down on the overhead of my application and possibly
speed up the creation of the form (though I have not yet timed it) given
that there are 10-20 custom controls on the screen at any one time.
Thoughts?
Thanks,
Joe
My CF application utilizes many custom controls that I have not yet taken
the time to place in the Visual Studio.NET toolbox so I must manually code
the creation and assignment of the various properties to the controls (e.g.
Font, Bounds, Parent, etc.).
One thing I've noticed is that if I follow the approach that the Visual
Studio designer utilizes in assigning a Font to a control is that I'm
creating a new Font object for each custom control that I display on the
screen. The code for assigning a Font to an object typically looks like the
following:
lblName.Font = new Font("Tahoma", 8F, FontStyle.Regular);
To minimize the creation of all of these Font objects, I've created an
object with a static Font property that I am using to assign to my various
custom controls. Using this new static Font property, my code looks like
the following:
lblName.Font = MyApp.Font;
Does anyone see any problems with using this approach? It seems logical to
me that this would cut down on the overhead of my application and possibly
speed up the creation of the form (though I have not yet timed it) given
that there are 10-20 custom controls on the screen at any one time.
Thoughts?
Thanks,
Joe