Example #1
0
        /// <summary>
        ///   Raises the <see cref = "E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name = "e">The <see cref = "T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                // Assign field values
                FontNameDropDownList.SelectedValue = FontName;
                CustomFontPathTextBox.Text         = CustomFontPath;
                FontSizeTextBox.Text = FontSize.ToString();
                foreach (var fontStyle in FontStyles.Where(fontStyle => fontStyle != FontStyle.Regular))
                {
                    FontStyleCheckBoxList.Items.FindByText(fontStyle.ToString()).Selected = true;
                }
                ForegroundColorPicker.Value = ForegroundColor;
                BackgroundColorPicker.Value = BackgroundColor;
                ShadowColorPicker.Value     = ShadowColor;
                HorizontalAlignmentDropDownList.SelectedValue = HorizontalAlignment.ToString();
                VerticalAlignmentDropDownList.SelectedValue   = VerticalAlignment.ToString();
                ImageHeightTextBox.Text               = ImageHeight.ToString();
                ImageWidthTextBox.Text                = ImageWidth.ToString();
                _dataExtractor.Value                  = BackgroundMediaId;
                BackgroundMediaChooser.Value          = _dataExtractor.Value.ToString();
                ImageFormatDropDownList.SelectedValue = OutputFormat.ToString();

                // Image Preview
                //var image = System.Drawing.Image.FromFile(IOHelper.MapPath(ImagePreviewUrl));
                ImagePreview.Height   = ImageHeight < 1 ? Unit.Empty : Unit.Pixel(ImageHeight);
                ImagePreview.Width    = ImageWidth < 1 ? Unit.Empty : Unit.Pixel(ImageWidth);
                ImagePreview.ImageUrl = ImagePreviewUrl;
            }
            catch (Exception exception)
            {
                SetErrorMessage(exception);
            }
        }