//</Snippet3>

            // Function for the callbacks to call
            public bool DoFormat(object arg)
            {
                // Get a reference to the designer's associated component
                SampleControl ctl = (SampleControl)_parent.Component;

                // Get the format name from the arg
                string fmt = (string)arg;

                // Create property descriptors
                PropertyDescriptor widthProp     = TypeDescriptor.GetProperties(ctl)["BoxWidth"];
                PropertyDescriptor backColorProp = TypeDescriptor.GetProperties(ctl)["BackColor"];

                // For the selected format, set two properties
                switch (fmt)
                {
                case "FormatWide":
                    widthProp.SetValue(ctl, Unit.Pixel(250));
                    backColorProp.SetValue(ctl, Color.LightBlue);
                    break;

                case "FormatNarrow":
                    widthProp.SetValue(ctl, Unit.Pixel(100));
                    backColorProp.SetValue(ctl, Color.LightCoral);
                    break;

                case "FormatMedium":
                    widthProp.SetValue(ctl, Unit.Pixel(150));
                    backColorProp.SetValue(ctl, Color.White);
                    break;
                }
                _parent.UpdateDesignTimeHtml();

                // Return an indication of success
                return(true);
            }
            // Callback for the narrow format
            public void FormatNarrow()
            {
                SampleControl ctrl = (SampleControl)_parent.Component;

                // Create the callback
                TransactedChangeCallback toCall = new TransactedChangeCallback(DoFormat);

                // Create the transacted change in the control
                ControlDesigner.InvokeTransactedChange(ctrl, toCall, "FormatNarrow", "Use a narrow format");
            }