예제 #1
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Form.Load" /> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (DesignMode)
            {
                return;
            }

            try
            {
                Localize();

                // Force to the first tab page.
                tabBrushEditor.SelectedTab = pageSolid;

                colorSolidBrush.PrimaryAttribute = _primaryAttr;
                colorSolidBrush.OldColor         = SolidBrush.Color;
                colorSolidBrush.SelectedColor    = SolidBrush.Color;

                panelTextureEditor.ImageEditor = _currentContent.ImageEditor;

                _originalBrushType = BrushType;

                switch (BrushType)
                {
                case GlyphBrushType.LinearGradient:
                    comboBrushType.Text = Resources.GORFNT_TEXT_GRADIENT_BRUSH;

                    panelGradEditor.Angle = GradientBrush.Angle;
                    panelGradEditor.UseGammaCorrection = GradientBrush.GammaCorrection;
                    panelGradEditor.ScaleAngle         = GradientBrush.ScaleAngle;
                    panelGradEditor.SetInterpolation(GradientBrush.Interpolation);

                    tabBrushEditor.SelectedTab = pageGradient;
                    break;

                case GlyphBrushType.Hatched:
                    comboBrushType.Text = Resources.GORFNT_TEXT_PATTERN_BRUSH;

                    panelHatchEditor.HatchForegroundColor = PatternBrush.ForegroundColor;
                    panelHatchEditor.HatchBackgroundColor = PatternBrush.BackgroundColor;
                    panelHatchEditor.HatchStyle           = PatternBrush.HatchStyle;

                    tabBrushEditor.SelectedTab = pagePattern;
                    break;

                case GlyphBrushType.Texture:
                    if (_currentContent.ImageEditor == null)
                    {
                        GorgonDialogs.WarningBox(this, Resources.GORFNT_WARN_NO_IMG_EDITOR);
                        comboBrushType.SelectedIndex = 0;
                        break;
                    }

                    comboBrushType.Text        = Resources.GORFNT_TEXT_TEXTURE_BRUSH;
                    tabBrushEditor.SelectedTab = pageTexture;

                    panelTextureEditor.Texture       = TextureBrush.Texture;
                    panelTextureEditor.WrapMode      = TextureBrush.WrapMode;
                    panelTextureEditor.TextureRegion = TextureBrush.TextureRegion;
                    break;

                default:
                    comboBrushType.Text = Resources.GORFNT_TEXT_SOLID_BRUSH;
                    break;
                }
            }
            catch (Exception ex)
            {
                GorgonDialogs.ErrorBox(this, ex);
                Close();
            }
            finally
            {
                ValidateCommands();
            }
        }