internal SaveWidgetDialog(SaveConfigWidget widget, SaveConfigToken defaultToken) { this.SuspendLayout(); SaveConfigWidget configWidget = widget; configWidget.Location = new Point(7, 7); configWidget.Width = 180; Button defaultsButton = new Button(); defaultsButton.AutoSize = true; defaultsButton.FlatStyle = FlatStyle.System; defaultsButton.Text = "Defaults"; defaultsButton.Click += (object sender, EventArgs e) => configWidget.Token = defaultToken; this.IconName = "Save"; this.Text = "Save Configuration"; this.Controls.AddRange(new Control[] { configWidget, defaultsButton }); this.ResumeLayout(false); defaultsButton.Location = new Point((configWidget.Right - configWidget.Left) / 2 + configWidget.Left - defaultsButton.Width / 2, configWidget.Bottom + 16); this.ClientSize = new Size(configWidget.Right + 7, defaultsButton.Bottom + 7); }
private void format_SelectedIndexChanged(object sender, EventArgs e) { this.fileType = ((ExtensionsCBoxHelper)this.format.SelectedItem).FileType; this.config.SuspendLayout(); this.config.Controls.Remove(this.widget); this.widget = this.fileType.CreateSaveConfigWidget(); this.widget.Token = this.fileType.CreateDefaultSaveConfigToken(); if (this.fileType.SupportsConfiguration) { this.widget.Margin = new Padding(this.widget.Margin.Left + 10, this.widget.Margin.Top, this.widget.Margin.Right, this.widget.Margin.Bottom); this.widget.Dock = DockStyle.Fill; this.config.Controls.Add(this.widget, 0, 1); this.config.Visible = true; } else { this.config.Visible = false; } this.config.ResumeLayout(); }
internal SaveConfigDialog(FileType fileType, Surface src) { this.fileType = fileType; this.srcSurface = src; this.imageSize = src.Size; this.SuspendLayout(); this.canvas = new PictureBox(); using (Surface backImage = new Surface(16, 16)) { backImage.ClearWithCheckerboardPattern(); canvas.BackgroundImage = new Bitmap(backImage.CreateAliasedBitmap()); } this.canvas.Image = src.CreateAliasedBitmap(); this.canvas.Size = this.imageSize; this.viewPort = new Panel(); this.viewPort.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left; this.viewPort.AutoScroll = true; this.viewPort.Size = new Size(551, 548); this.viewPort.Location = new Point(225, 7); this.viewPort.Controls.Add(canvas); this.testLayersCheckBox = new CheckBox(); this.testLayersCheckBox.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; this.testLayersCheckBox.AutoSize = true; this.testLayersCheckBox.Text = "Add a test layer"; this.testLayersCheckBox.Location = new Point(16, 495); this.testLayersCheckBox.CheckedChanged += (object sender, EventArgs e) => UpdatePreview(); this.widget = fileType.CreateSaveConfigWidget(); this.widget.Location = new Point(7, 7); this.widget.Width = 180; this.widget.TokenChanged += (object sender, EventArgs e) => UpdatePreview(); this.saveButton = new Button(); this.saveButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; this.saveButton.AutoSize = true; this.saveButton.FlatStyle = FlatStyle.System; this.saveButton.Text = "Save"; this.saveButton.Location = new Point(14, 525); this.saveButton.Click += (object sender, EventArgs e) => SaveToFile(); this.defaultsButton = new Button(); this.defaultsButton.AutoSize = true; this.defaultsButton.FlatStyle = FlatStyle.System; this.defaultsButton.Text = "Defaults"; this.defaultsButton.Click += (object sender, EventArgs e) => ResetToken(); this.IconName = "Save"; this.FormBorderStyle = FormBorderStyle.Sizable; this.MaximizeBox = true; this.MinimumSize = new Size(600, 380); this.Size = new Size(800, 600); this.Text = "Save Configuration"; this.Controls.AddRange(new Control[] { widget, defaultsButton, testLayersCheckBox, saveButton, viewPort }); this.ResumeLayout(false); this.defaultsButton.Location = new Point((widget.Right - widget.Left) / 2 + widget.Left - defaultsButton.Width / 2, widget.Bottom + 16); }
private void InitializeComponent() { this.saveConfigPanel = new Panel(); this.defaultsButton = new PdnPushButton(); this.saveConfigWidget = new SaveConfigWidget(); this.previewHeader = new HeadingLabel(); this.canvasControl = new ScrollableCanvasControl(); this.settingsHeader = new HeadingLabel(); this.footerSeparator = new PaintDotNet.Controls.SeparatorLine(); base.SuspendLayout(); base.baseOkButton.Anchor = AnchorStyles.Right | AnchorStyles.Bottom; base.baseOkButton.Name = "baseOkButton"; base.baseOkButton.TabIndex = 2; base.baseOkButton.Click += new EventHandler(this.OnBaseOkButtonClick); base.baseCancelButton.Anchor = AnchorStyles.Right | AnchorStyles.Bottom; base.baseCancelButton.Name = "baseCancelButton"; base.baseCancelButton.TabIndex = 3; base.baseCancelButton.Click += new EventHandler(this.OnBaseCancelButtonClick); this.footerSeparator.Name = "footerSeparator"; this.saveConfigPanel.AutoScroll = true; this.saveConfigPanel.Name = "saveConfigPanel"; this.saveConfigPanel.TabIndex = 0; this.saveConfigPanel.TabStop = false; this.defaultsButton.Name = "defaultsButton"; this.defaultsButton.AutoSize = true; this.defaultsButton.TabIndex = 1; this.defaultsButton.Click += new EventHandler(this.OnDefaultsButtonClick); this.saveConfigWidget.Name = "saveConfigWidget"; this.saveConfigWidget.TabIndex = 9; this.saveConfigWidget.Token = null; this.previewHeader.Name = "previewHeader"; this.previewHeader.RightMargin = 0; this.previewHeader.TabIndex = 11; this.previewHeader.TabStop = false; this.previewHeader.Text = "Header"; this.canvasControl.Name = "documentView"; this.canvasControl.CanvasControl.MouseDown += new MouseEventHandler(this.OnCanvasViewMouseDown); this.canvasControl.CanvasControl.MouseMove += new MouseEventHandler(this.OnCanvasViewMouseMove); this.canvasControl.CanvasControl.MouseUp += new MouseEventHandler(this.OnCanvasViewMouseUp); this.canvasControl.CanvasView.IsCanvasFrameEnabled = false; this.settingsHeader.Name = "settingsHeader"; this.settingsHeader.TabIndex = 13; this.settingsHeader.TabStop = false; this.settingsHeader.Text = "Header"; base.AutoScaleDimensions = new SizeF(96f, 96f); base.AutoScaleMode = AutoScaleMode.Dpi; base.Controls.Add(this.defaultsButton); base.Controls.Add(this.settingsHeader); base.Controls.Add(this.previewHeader); base.Controls.Add(this.canvasControl); base.Controls.Add(this.footerSeparator); base.Controls.Add(this.saveConfigPanel); base.FormBorderStyle = FormBorderStyle.Sizable; base.MinimizeBox = false; base.MaximizeBox = true; base.Name = "SaveConfigDialog"; base.StartPosition = FormStartPosition.Manual; base.Controls.SetChildIndex(this.saveConfigPanel, 0); base.Controls.SetChildIndex(this.canvasControl, 0); base.Controls.SetChildIndex(base.baseOkButton, 0); base.Controls.SetChildIndex(base.baseCancelButton, 0); base.Controls.SetChildIndex(this.previewHeader, 0); base.Controls.SetChildIndex(this.settingsHeader, 0); base.Controls.SetChildIndex(this.defaultsButton, 0); base.ResumeLayout(false); }