diff --git a/Common/MapWriter.cs b/Common/MapWriter.cs index 063207f..b1ff69e 100644 --- a/Common/MapWriter.cs +++ b/Common/MapWriter.cs @@ -13,8 +13,8 @@ public MapWriter(ResourceManager resources) this.resources = resources; } - public Image? BaseOverlay => resources.GetObject("BaseOverlay") as Image; - public Image? BossOverlay => resources.GetObject("BossOverlay") as Image; + public Bitmap? BaseOverlay => resources.GetObject("BaseOverlay") as Bitmap; + public Bitmap? BossOverlay => resources.GetObject("BossOverlay") as Bitmap; public void Draw(Graphics g, Map map, bool drawCritRooms = false, bool drawDeadEnds = true) { @@ -43,9 +43,9 @@ public void Draw(Graphics g, Map map, bool drawCritRooms = false, bool drawDeadE } if (BaseOverlay != null) - g.DrawImage(BaseOverlay, 32 * map.Base.X, 32 * (map.Height - 1 - map.Base.Y)); + g.DrawImage(BaseOverlay, 32 * map.Base.X, 32 * (map.Height - 1 - map.Base.Y), 32, 32); if (BossOverlay != null) - g.DrawImage(BossOverlay, 32 * map.Boss.X, 32 * (map.Height - 1 - map.Boss.Y)); + g.DrawImage(BossOverlay, 32 * map.Boss.X, 32 * (map.Height - 1 - map.Boss.Y), 32, 32); } public Bitmap WriteToImage(Map map, bool drawCritRooms = false, bool drawDeadEnds = false) diff --git a/MapGenerator/Form1.Designer.cs b/MapGenerator/Form1.Designer.cs index 6f3d0fd..10eafb4 100644 --- a/MapGenerator/Form1.Designer.cs +++ b/MapGenerator/Form1.Designer.cs @@ -29,348 +29,309 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); - this.pictureBox = new System.Windows.Forms.PictureBox(); - this.generateButton = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.rcUpDown = new System.Windows.Forms.NumericUpDown(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.copyButton = new System.Windows.Forms.Button(); - this.deleteDeadEndButton = new System.Windows.Forms.Button(); - this.logTextBox = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.seedUpDown = new System.Windows.Forms.NumericUpDown(); - this.randomSeedCheckbox = new System.Windows.Forms.CheckBox(); - this.randomRcCheckbox = new System.Windows.Forms.CheckBox(); - this.drawCritCheckBox = new System.Windows.Forms.CheckBox(); - this.drawDeadEndsCheckBox = new System.Windows.Forms.CheckBox(); - this.openStatsWindowButton = new System.Windows.Forms.Button(); - this.algorithmComboBox = new System.Windows.Forms.ComboBox(); - this.browseButton = new System.Windows.Forms.Button(); - this.sizeComboBox = new System.Windows.Forms.ComboBox(); - this.sizeUpDown = new System.Windows.Forms.NumericUpDown(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.rcUpDown)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.seedUpDown)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.sizeUpDown)).BeginInit(); - this.SuspendLayout(); + pictureBox = new PictureBox(); + generateButton = new Button(); + label1 = new Label(); + rcUpDown = new NumericUpDown(); + textBox1 = new TextBox(); + copyButton = new Button(); + deleteDeadEndButton = new Button(); + logTextBox = new TextBox(); + label2 = new Label(); + seedUpDown = new NumericUpDown(); + randomSeedCheckbox = new CheckBox(); + randomRcCheckbox = new CheckBox(); + drawCritCheckBox = new CheckBox(); + drawDeadEndsCheckBox = new CheckBox(); + openStatsWindowButton = new Button(); + algorithmComboBox = new ComboBox(); + browseButton = new Button(); + sizeComboBox = new ComboBox(); + sizeUpDown = new NumericUpDown(); + ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit(); + ((System.ComponentModel.ISupportInitialize)rcUpDown).BeginInit(); + ((System.ComponentModel.ISupportInitialize)seedUpDown).BeginInit(); + ((System.ComponentModel.ISupportInitialize)sizeUpDown).BeginInit(); + SuspendLayout(); // // pictureBox // - this.pictureBox.BackColor = System.Drawing.Color.Black; - this.pictureBox.Location = new System.Drawing.Point(10, 62); - this.pictureBox.Margin = new System.Windows.Forms.Padding(2); - this.pictureBox.MaximumSize = new System.Drawing.Size(664, 664); - this.pictureBox.Name = "pictureBox"; - this.pictureBox.Padding = new System.Windows.Forms.Padding(12); - this.pictureBox.Size = new System.Drawing.Size(280, 280); - this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBox.TabIndex = 0; - this.pictureBox.TabStop = false; + pictureBox.BackColor = Color.Black; + pictureBox.BorderStyle = BorderStyle.FixedSingle; + pictureBox.Location = new Point(10, 62); + pictureBox.Margin = new Padding(2); + pictureBox.MaximumSize = new Size(664, 664); + pictureBox.Name = "pictureBox"; + pictureBox.Padding = new Padding(12); + pictureBox.Size = new Size(280, 279); + pictureBox.SizeMode = PictureBoxSizeMode.StretchImage; + pictureBox.TabIndex = 0; + pictureBox.TabStop = false; + pictureBox.DpiChangedAfterParent += pictureBox_DpiChangedAfterParent; // // generateButton // - this.generateButton.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.generateButton.Location = new System.Drawing.Point(281, 7); - this.generateButton.Margin = new System.Windows.Forms.Padding(2); - this.generateButton.Name = "generateButton"; - this.generateButton.Size = new System.Drawing.Size(75, 23); - this.generateButton.TabIndex = 4; - this.generateButton.Text = "&Generate"; - this.generateButton.UseVisualStyleBackColor = true; - this.generateButton.Click += new System.EventHandler(this.GenerateButton_Click); + generateButton.FlatStyle = FlatStyle.System; + generateButton.Location = new Point(281, 7); + generateButton.Margin = new Padding(2); + generateButton.Name = "generateButton"; + generateButton.Size = new Size(75, 23); + generateButton.TabIndex = 4; + generateButton.Text = "&Generate"; + generateButton.UseVisualStyleBackColor = true; + generateButton.Click += GenerateButton_Click; // // label1 // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(10, 11); - this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(73, 15); - this.label1.TabIndex = 0; - this.label1.Text = "Roomcount:"; + label1.AutoSize = true; + label1.Location = new Point(10, 11); + label1.Margin = new Padding(2, 0, 2, 0); + label1.Name = "label1"; + label1.Size = new Size(73, 15); + label1.TabIndex = 0; + label1.Text = "Roomcount:"; // // rcUpDown // - this.rcUpDown.Location = new System.Drawing.Point(87, 9); - this.rcUpDown.Margin = new System.Windows.Forms.Padding(2); - this.rcUpDown.Maximum = new decimal(new int[] { - 2147483647, - 0, - 0, - 0}); - this.rcUpDown.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.rcUpDown.Name = "rcUpDown"; - this.rcUpDown.Size = new System.Drawing.Size(54, 23); - this.rcUpDown.TabIndex = 1; - this.rcUpDown.Value = new decimal(new int[] { - 50, - 0, - 0, - 0}); + rcUpDown.Location = new Point(87, 9); + rcUpDown.Margin = new Padding(2); + rcUpDown.Maximum = new decimal(new int[] { int.MaxValue, 0, 0, 0 }); + rcUpDown.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + rcUpDown.Name = "rcUpDown"; + rcUpDown.Size = new Size(54, 23); + rcUpDown.TabIndex = 1; + rcUpDown.Value = new decimal(new int[] { 50, 0, 0, 0 }); // // textBox1 // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.textBox1.Location = new System.Drawing.Point(428, 62); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.ReadOnly = true; - this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.textBox1.Size = new System.Drawing.Size(431, 279); - this.textBox1.TabIndex = 4; - this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; + textBox1.Font = new Font("Consolas", 12F, FontStyle.Regular, GraphicsUnit.Point); + textBox1.Location = new Point(428, 62); + textBox1.Multiline = true; + textBox1.Name = "textBox1"; + textBox1.ReadOnly = true; + textBox1.ScrollBars = ScrollBars.Both; + textBox1.Size = new Size(431, 279); + textBox1.TabIndex = 4; + textBox1.TextAlign = HorizontalAlignment.Center; // // copyButton // - this.copyButton.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.copyButton.Location = new System.Drawing.Point(451, 7); - this.copyButton.Margin = new System.Windows.Forms.Padding(2); - this.copyButton.Name = "copyButton"; - this.copyButton.Size = new System.Drawing.Size(75, 23); - this.copyButton.TabIndex = 6; - this.copyButton.Text = "&Copy"; - this.copyButton.UseVisualStyleBackColor = true; - this.copyButton.Click += new System.EventHandler(this.CopyButton_Click); + copyButton.FlatStyle = FlatStyle.System; + copyButton.Location = new Point(451, 7); + copyButton.Margin = new Padding(2); + copyButton.Name = "copyButton"; + copyButton.Size = new Size(75, 23); + copyButton.TabIndex = 6; + copyButton.Text = "&Copy"; + copyButton.UseVisualStyleBackColor = true; + copyButton.Click += CopyButton_Click; // // deleteDeadEndButton // - this.deleteDeadEndButton.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.deleteDeadEndButton.Location = new System.Drawing.Point(530, 7); - this.deleteDeadEndButton.Margin = new System.Windows.Forms.Padding(2); - this.deleteDeadEndButton.Name = "deleteDeadEndButton"; - this.deleteDeadEndButton.Size = new System.Drawing.Size(110, 23); - this.deleteDeadEndButton.TabIndex = 7; - this.deleteDeadEndButton.Text = "&Delete Bonus DEs"; - this.deleteDeadEndButton.UseVisualStyleBackColor = true; - this.deleteDeadEndButton.Click += new System.EventHandler(this.DeleteDeadEndButton_Click); + deleteDeadEndButton.FlatStyle = FlatStyle.System; + deleteDeadEndButton.Location = new Point(530, 7); + deleteDeadEndButton.Margin = new Padding(2); + deleteDeadEndButton.Name = "deleteDeadEndButton"; + deleteDeadEndButton.Size = new Size(110, 23); + deleteDeadEndButton.TabIndex = 7; + deleteDeadEndButton.Text = "&Delete Bonus DEs"; + deleteDeadEndButton.UseVisualStyleBackColor = true; + deleteDeadEndButton.Click += DeleteDeadEndButton_Click; // // logTextBox // - this.logTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.logTextBox.Font = new System.Drawing.Font("Consolas", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.logTextBox.Location = new System.Drawing.Point(10, 347); - this.logTextBox.Multiline = true; - this.logTextBox.Name = "logTextBox"; - this.logTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.logTextBox.Size = new System.Drawing.Size(848, 276); - this.logTextBox.TabIndex = 4; - this.logTextBox.WordWrap = false; + logTextBox.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + logTextBox.Font = new Font("Consolas", 10F, FontStyle.Regular, GraphicsUnit.Point); + logTextBox.Location = new Point(10, 347); + logTextBox.Multiline = true; + logTextBox.Name = "logTextBox"; + logTextBox.ScrollBars = ScrollBars.Both; + logTextBox.Size = new Size(848, 276); + logTextBox.TabIndex = 4; + logTextBox.WordWrap = false; // // label2 // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(145, 11); - this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(35, 15); - this.label2.TabIndex = 2; - this.label2.Text = "Seed:"; + label2.AutoSize = true; + label2.Location = new Point(145, 11); + label2.Margin = new Padding(2, 0, 2, 0); + label2.Name = "label2"; + label2.Size = new Size(35, 15); + label2.TabIndex = 2; + label2.Text = "Seed:"; // // seedUpDown // - this.seedUpDown.Location = new System.Drawing.Point(184, 9); - this.seedUpDown.Margin = new System.Windows.Forms.Padding(2); - this.seedUpDown.Maximum = new decimal(new int[] { - 2147483647, - 0, - 0, - 0}); - this.seedUpDown.Name = "seedUpDown"; - this.seedUpDown.Size = new System.Drawing.Size(93, 23); - this.seedUpDown.TabIndex = 3; + seedUpDown.Location = new Point(184, 9); + seedUpDown.Margin = new Padding(2); + seedUpDown.Maximum = new decimal(new int[] { int.MaxValue, 0, 0, 0 }); + seedUpDown.Name = "seedUpDown"; + seedUpDown.Size = new Size(93, 23); + seedUpDown.TabIndex = 3; // // randomSeedCheckbox // - this.randomSeedCheckbox.AutoSize = true; - this.randomSeedCheckbox.Checked = true; - this.randomSeedCheckbox.CheckState = System.Windows.Forms.CheckState.Checked; - this.randomSeedCheckbox.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.randomSeedCheckbox.Location = new System.Drawing.Point(172, 37); - this.randomSeedCheckbox.Name = "randomSeedCheckbox"; - this.randomSeedCheckbox.Size = new System.Drawing.Size(118, 20); - this.randomSeedCheckbox.TabIndex = 10; - this.randomSeedCheckbox.Text = "&Randomize seed"; - this.randomSeedCheckbox.UseVisualStyleBackColor = true; + randomSeedCheckbox.AutoSize = true; + randomSeedCheckbox.Checked = true; + randomSeedCheckbox.CheckState = CheckState.Checked; + randomSeedCheckbox.FlatStyle = FlatStyle.System; + randomSeedCheckbox.Location = new Point(172, 37); + randomSeedCheckbox.Name = "randomSeedCheckbox"; + randomSeedCheckbox.Size = new Size(118, 20); + randomSeedCheckbox.TabIndex = 10; + randomSeedCheckbox.Text = "&Randomize seed"; + randomSeedCheckbox.UseVisualStyleBackColor = true; // // randomRcCheckbox // - this.randomRcCheckbox.AutoSize = true; - this.randomRcCheckbox.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.randomRcCheckbox.Location = new System.Drawing.Point(12, 37); - this.randomRcCheckbox.Name = "randomRcCheckbox"; - this.randomRcCheckbox.Size = new System.Drawing.Size(154, 20); - this.randomRcCheckbox.TabIndex = 9; - this.randomRcCheckbox.Text = "Randomize roomcount"; - this.randomRcCheckbox.UseVisualStyleBackColor = true; + randomRcCheckbox.AutoSize = true; + randomRcCheckbox.FlatStyle = FlatStyle.System; + randomRcCheckbox.Location = new Point(12, 37); + randomRcCheckbox.Name = "randomRcCheckbox"; + randomRcCheckbox.Size = new Size(154, 20); + randomRcCheckbox.TabIndex = 9; + randomRcCheckbox.Text = "Randomize roomcount"; + randomRcCheckbox.UseVisualStyleBackColor = true; // // drawCritCheckBox // - this.drawCritCheckBox.AutoSize = true; - this.drawCritCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.drawCritCheckBox.Location = new System.Drawing.Point(296, 37); - this.drawCritCheckBox.Name = "drawCritCheckBox"; - this.drawCritCheckBox.Size = new System.Drawing.Size(79, 20); - this.drawCritCheckBox.TabIndex = 11; - this.drawCritCheckBox.Text = "Draw &crit"; - this.drawCritCheckBox.UseVisualStyleBackColor = true; - this.drawCritCheckBox.CheckedChanged += new System.EventHandler(this.DrawBox_CheckedChanged); + drawCritCheckBox.AutoSize = true; + drawCritCheckBox.FlatStyle = FlatStyle.System; + drawCritCheckBox.Location = new Point(296, 37); + drawCritCheckBox.Name = "drawCritCheckBox"; + drawCritCheckBox.Size = new Size(79, 20); + drawCritCheckBox.TabIndex = 11; + drawCritCheckBox.Text = "Draw &crit"; + drawCritCheckBox.UseVisualStyleBackColor = true; + drawCritCheckBox.CheckedChanged += DrawBox_CheckedChanged; // // drawDeadEndsCheckBox // - this.drawDeadEndsCheckBox.AutoSize = true; - this.drawDeadEndsCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.drawDeadEndsCheckBox.Location = new System.Drawing.Point(381, 37); - this.drawDeadEndsCheckBox.Name = "drawDeadEndsCheckBox"; - this.drawDeadEndsCheckBox.Size = new System.Drawing.Size(116, 20); - this.drawDeadEndsCheckBox.TabIndex = 12; - this.drawDeadEndsCheckBox.Text = "Draw dead ends"; - this.drawDeadEndsCheckBox.UseVisualStyleBackColor = true; - this.drawDeadEndsCheckBox.CheckedChanged += new System.EventHandler(this.DrawBox_CheckedChanged); + drawDeadEndsCheckBox.AutoSize = true; + drawDeadEndsCheckBox.FlatStyle = FlatStyle.System; + drawDeadEndsCheckBox.Location = new Point(381, 37); + drawDeadEndsCheckBox.Name = "drawDeadEndsCheckBox"; + drawDeadEndsCheckBox.Size = new Size(116, 20); + drawDeadEndsCheckBox.TabIndex = 12; + drawDeadEndsCheckBox.Text = "Draw dead ends"; + drawDeadEndsCheckBox.UseVisualStyleBackColor = true; + drawDeadEndsCheckBox.CheckedChanged += DrawBox_CheckedChanged; // // openStatsWindowButton // - this.openStatsWindowButton.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.openStatsWindowButton.Location = new System.Drawing.Point(657, 7); - this.openStatsWindowButton.Name = "openStatsWindowButton"; - this.openStatsWindowButton.Size = new System.Drawing.Size(128, 23); - this.openStatsWindowButton.TabIndex = 8; - this.openStatsWindowButton.Text = "&Open Stats Window"; - this.openStatsWindowButton.UseVisualStyleBackColor = true; - this.openStatsWindowButton.Click += new System.EventHandler(this.OpenStatsWindowButton_Click); + openStatsWindowButton.FlatStyle = FlatStyle.System; + openStatsWindowButton.Location = new Point(657, 7); + openStatsWindowButton.Name = "openStatsWindowButton"; + openStatsWindowButton.Size = new Size(128, 23); + openStatsWindowButton.TabIndex = 8; + openStatsWindowButton.Text = "&Open Stats Window"; + openStatsWindowButton.UseVisualStyleBackColor = true; + openStatsWindowButton.Click += OpenStatsWindowButton_Click; // // algorithmComboBox // - this.algorithmComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.algorithmComboBox.FormattingEnabled = true; - this.algorithmComboBox.Items.AddRange(new object[] { - "Prim", - "Uniform spanning tree", - "Prim, room variant", - "Random edges"}); - this.algorithmComboBox.Location = new System.Drawing.Point(703, 36); - this.algorithmComboBox.Name = "algorithmComboBox"; - this.algorithmComboBox.Size = new System.Drawing.Size(155, 23); - this.algorithmComboBox.TabIndex = 13; + algorithmComboBox.DropDownStyle = ComboBoxStyle.DropDownList; + algorithmComboBox.FormattingEnabled = true; + algorithmComboBox.Items.AddRange(new object[] { "Prim", "Uniform spanning tree", "Prim, room variant", "Random edges" }); + algorithmComboBox.Location = new Point(703, 36); + algorithmComboBox.Name = "algorithmComboBox"; + algorithmComboBox.Size = new Size(155, 23); + algorithmComboBox.TabIndex = 13; // // browseButton // - this.browseButton.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.browseButton.Location = new System.Drawing.Point(360, 7); - this.browseButton.Margin = new System.Windows.Forms.Padding(2); - this.browseButton.Name = "browseButton"; - this.browseButton.Size = new System.Drawing.Size(75, 23); - this.browseButton.TabIndex = 5; - this.browseButton.Text = "&Browse..."; - this.browseButton.UseVisualStyleBackColor = true; - this.browseButton.Click += new System.EventHandler(this.BrowseButton_Click); + browseButton.FlatStyle = FlatStyle.System; + browseButton.Location = new Point(360, 7); + browseButton.Margin = new Padding(2); + browseButton.Name = "browseButton"; + browseButton.Size = new Size(75, 23); + browseButton.TabIndex = 5; + browseButton.Text = "&Browse..."; + browseButton.UseVisualStyleBackColor = true; + browseButton.Click += BrowseButton_Click; // // sizeComboBox // - this.sizeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.sizeComboBox.FormattingEnabled = true; - this.sizeComboBox.Items.AddRange(new object[] { - "Small (4 x 4)", - "Medium (4 x 8)", - "Large (8 x 8)", - "Huge (12 x 12)", - "Gigantic (16 x 16)", - "Custom"}); - this.sizeComboBox.Location = new System.Drawing.Point(503, 36); - this.sizeComboBox.Name = "sizeComboBox"; - this.sizeComboBox.Size = new System.Drawing.Size(125, 23); - this.sizeComboBox.TabIndex = 13; - this.sizeComboBox.SelectedIndexChanged += new System.EventHandler(this.SizeComboBox_SelectedIndexChanged); + sizeComboBox.DropDownStyle = ComboBoxStyle.DropDownList; + sizeComboBox.FormattingEnabled = true; + sizeComboBox.Items.AddRange(new object[] { "Small (4 x 4)", "Medium (4 x 8)", "Large (8 x 8)", "Huge (12 x 12)", "Gigantic (16 x 16)", "Custom" }); + sizeComboBox.Location = new Point(503, 36); + sizeComboBox.Name = "sizeComboBox"; + sizeComboBox.Size = new Size(125, 23); + sizeComboBox.TabIndex = 13; + sizeComboBox.SelectedIndexChanged += SizeComboBox_SelectedIndexChanged; // // sizeUpDown // - this.sizeUpDown.Location = new System.Drawing.Point(634, 37); - this.sizeUpDown.Maximum = new decimal(new int[] { - 512, - 0, - 0, - 0}); - this.sizeUpDown.Minimum = new decimal(new int[] { - 2, - 0, - 0, - 0}); - this.sizeUpDown.Name = "sizeUpDown"; - this.sizeUpDown.Size = new System.Drawing.Size(63, 23); - this.sizeUpDown.TabIndex = 14; - this.sizeUpDown.Value = new decimal(new int[] { - 16, - 0, - 0, - 0}); + sizeUpDown.Location = new Point(634, 37); + sizeUpDown.Maximum = new decimal(new int[] { 512, 0, 0, 0 }); + sizeUpDown.Minimum = new decimal(new int[] { 2, 0, 0, 0 }); + sizeUpDown.Name = "sizeUpDown"; + sizeUpDown.Size = new Size(63, 23); + sizeUpDown.TabIndex = 14; + sizeUpDown.Value = new decimal(new int[] { 16, 0, 0, 0 }); // // Form1 // - this.AcceptButton = this.generateButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(870, 635); - this.Controls.Add(this.sizeUpDown); - this.Controls.Add(this.algorithmComboBox); - this.Controls.Add(this.sizeComboBox); - this.Controls.Add(this.openStatsWindowButton); - this.Controls.Add(this.deleteDeadEndButton); - this.Controls.Add(this.browseButton); - this.Controls.Add(this.copyButton); - this.Controls.Add(this.logTextBox); - this.Controls.Add(this.pictureBox); - this.Controls.Add(this.textBox1); - this.Controls.Add(this.generateButton); - this.Controls.Add(this.drawDeadEndsCheckBox); - this.Controls.Add(this.drawCritCheckBox); - this.Controls.Add(this.randomSeedCheckbox); - this.Controls.Add(this.randomRcCheckbox); - this.Controls.Add(this.seedUpDown); - this.Controls.Add(this.label2); - this.Controls.Add(this.rcUpDown); - this.Controls.Add(this.label1); - this.DoubleBuffered = true; - this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(2); - this.Name = "Form1"; - this.Text = "Map Generator"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.rcUpDown)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.seedUpDown)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.sizeUpDown)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - + AcceptButton = generateButton; + AutoScaleDimensions = new SizeF(96F, 96F); + AutoScaleMode = AutoScaleMode.Dpi; + ClientSize = new Size(870, 635); + Controls.Add(sizeUpDown); + Controls.Add(algorithmComboBox); + Controls.Add(sizeComboBox); + Controls.Add(openStatsWindowButton); + Controls.Add(deleteDeadEndButton); + Controls.Add(browseButton); + Controls.Add(copyButton); + Controls.Add(logTextBox); + Controls.Add(pictureBox); + Controls.Add(textBox1); + Controls.Add(generateButton); + Controls.Add(drawDeadEndsCheckBox); + Controls.Add(drawCritCheckBox); + Controls.Add(randomSeedCheckbox); + Controls.Add(randomRcCheckbox); + Controls.Add(seedUpDown); + Controls.Add(label2); + Controls.Add(rcUpDown); + Controls.Add(label1); + DoubleBuffered = true; + Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); + Icon = (Icon)resources.GetObject("$this.Icon"); + Margin = new Padding(2); + Name = "Form1"; + Text = "Map Generator"; + ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit(); + ((System.ComponentModel.ISupportInitialize)rcUpDown).EndInit(); + ((System.ComponentModel.ISupportInitialize)seedUpDown).EndInit(); + ((System.ComponentModel.ISupportInitialize)sizeUpDown).EndInit(); + ResumeLayout(false); + PerformLayout(); } #endregion - private System.Windows.Forms.PictureBox pictureBox; - private System.Windows.Forms.Button generateButton; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.NumericUpDown rcUpDown; - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.Button copyButton; - private System.Windows.Forms.Button deleteDeadEndButton; - private System.Windows.Forms.TextBox logTextBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.NumericUpDown seedUpDown; - private System.Windows.Forms.CheckBox randomSeedCheckbox; - private System.Windows.Forms.CheckBox randomRcCheckbox; - private System.Windows.Forms.CheckBox drawCritCheckBox; - private System.Windows.Forms.CheckBox drawDeadEndsCheckBox; - private System.Windows.Forms.Button openStatsWindowButton; - private System.Windows.Forms.ComboBox algorithmComboBox; - private System.Windows.Forms.Button browseButton; - private System.Windows.Forms.ComboBox sizeComboBox; - private System.Windows.Forms.NumericUpDown sizeUpDown; + private PictureBox pictureBox; + private Button generateButton; + private Label label1; + private NumericUpDown rcUpDown; + private TextBox textBox1; + private Button copyButton; + private Button deleteDeadEndButton; + private TextBox logTextBox; + private Label label2; + private NumericUpDown seedUpDown; + private CheckBox randomSeedCheckbox; + private CheckBox randomRcCheckbox; + private CheckBox drawCritCheckBox; + private CheckBox drawDeadEndsCheckBox; + private Button openStatsWindowButton; + private ComboBox algorithmComboBox; + private Button browseButton; + private ComboBox sizeComboBox; + private NumericUpDown sizeUpDown; } } diff --git a/MapGenerator/Form1.cs b/MapGenerator/Form1.cs index 7c69853..cd382ab 100644 --- a/MapGenerator/Form1.cs +++ b/MapGenerator/Form1.cs @@ -48,6 +48,7 @@ private void RenderMap() textBox1.Text = map.ToString(); using (var g = Graphics.FromImage(pictureBox.Image)) { + Logger.Global.Log(LogLevel.Information, pictureBox.Image.Size.ToString()); mapWriter.Draw(g, map, drawCritCheckBox.Checked, drawDeadEndsCheckBox.Checked); } pictureBox.Refresh(); @@ -58,11 +59,11 @@ private void UpdateSize() var index = sizeComboBox.SelectedIndex; var size = index == sizeComboBox.Items.Count - 1 ? new FloorSize((int)sizeUpDown.Value, (int)sizeUpDown.Value) : FloorSizes[index]; + pictureBox.Width = LogicalToDeviceUnits(size.Width * MapUtils.RoomSize + 24); + pictureBox.Height = LogicalToDeviceUnits(size.Height * MapUtils.RoomSize + 24); if (map?.Size != size.Size) { map = new Map(size.Width, size.Height); - pictureBox.Width = size.Width * MapUtils.RoomSize + 24; - pictureBox.Height = size.Height * MapUtils.RoomSize + 24; pictureBox.Image = new Bitmap(size.Width * MapUtils.RoomSize, size.Height * MapUtils.RoomSize); } } @@ -141,5 +142,10 @@ private void SizeComboBox_SelectedIndexChanged(object sender, EventArgs e) { sizeUpDown.Enabled = sizeComboBox.SelectedIndex == sizeComboBox.Items.Count - 1; } + + private void pictureBox_DpiChangedAfterParent(object sender, EventArgs e) + { + UpdateSize(); + } } } diff --git a/MapGenerator/Form1.resx b/MapGenerator/Form1.resx index 789dcdc..5e71c6d 100644 --- a/MapGenerator/Form1.resx +++ b/MapGenerator/Form1.resx @@ -1,5 +1,64 @@  + @@ -58,8 +117,8 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + + AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAE AADDDgAAww4AAAAAAAAAAAAACBMczBUvQfsYM0f8HDtRxAsXIMUUKjrsFS0+7BcyRbkJFiHOESc4/A8j