Italic, it does not consider a false value to be a set value. So, if the existing
Style instance has Font.Italic explicitly set to false, MergeStyle() will set Font.Italic to true if
the style to be copied has it set to true, as a value of true is considered to be set.
PrepareControlHierachy() uses ApplyStyle() for the custom style properties to load all
their attributes. This ensures that the TextBox is decorated with its TextBoxStyle properties and
the Label is decorated with its LabelStyle properties. The parent InputBox ControlStyle style is
then merged using MergeStyle() to fill in any style properties that are not set by the custom
styles. If there aren??™t any custom style properties selected, the ControlStyle properties will be
the default for the two custom controls. Listing 4-6 shows the full listing for InputBox.
Listing 4-6. The InputBox Custom Control Class File
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Specialized;
namespace ControlsBook2Lib.Ch04
{
[ToolboxData("<{0}:inputbox runat=server>{0}:inputbox>")]
public class InputBox : WebControl
{
public InputBox()
: base(HtmlTextWriterTag.Div)
{
}
public string LabelText
{
get
{
EnsureChildControls();
ControlsBook2Lib.
Pages:
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251