Добавлено изменение цвета

This commit is contained in:
Arklightning 2022-11-07 23:45:44 +04:00
parent 79b94442ae
commit 2d6108c489
3 changed files with 72 additions and 69 deletions

View File

@ -136,8 +136,9 @@ namespace Trolleybus
} }
Pen pen = new Pen(Color.Black); Pen pen = new Pen(Color.Black);
Brush brBlue = new SolidBrush(Color.LightBlue); Brush brBlue = new SolidBrush(Color.LightBlue);
Brush dBlue = new SolidBrush(Color.DarkBlue);
Brush bWhite = new SolidBrush(Color.White); Brush bWhite = new SolidBrush(Color.White);
Brush br = new SolidBrush(Trolleybus?.BodyColor ?? Color.Black);
g.FillRectangle(br, _startPosX, _startPosY, 200, 50);
g.DrawRectangle(pen, _startPosX, _startPosY, 200, 50); g.DrawRectangle(pen, _startPosX, _startPosY, 200, 50);
g.DrawRectangle(pen, _startPosX + 100, _startPosY + 10, 20, 40); g.DrawRectangle(pen, _startPosX + 100, _startPosY + 10, 20, 40);
Pen WinBlue = new Pen(Color.Blue); Pen WinBlue = new Pen(Color.Blue);

View File

@ -29,6 +29,12 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.buttonDeleteMap = new System.Windows.Forms.Button();
this.listBoxMaps = new System.Windows.Forms.ListBox();
this.buttonAddMap = new System.Windows.Forms.Button();
this.textBoxNewMapName = new System.Windows.Forms.TextBox();
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
this.buttonLeft = new System.Windows.Forms.Button(); this.buttonLeft = new System.Windows.Forms.Button();
this.buttonRight = new System.Windows.Forms.Button(); this.buttonRight = new System.Windows.Forms.Button();
this.buttonDown = new System.Windows.Forms.Button(); this.buttonDown = new System.Windows.Forms.Button();
@ -38,16 +44,10 @@
this.buttonRemoveTrolleybus = new System.Windows.Forms.Button(); this.buttonRemoveTrolleybus = new System.Windows.Forms.Button();
this.maskedTextBoxPosition = new System.Windows.Forms.MaskedTextBox(); this.maskedTextBoxPosition = new System.Windows.Forms.MaskedTextBox();
this.buttonAddTrolleybus = new System.Windows.Forms.Button(); this.buttonAddTrolleybus = new System.Windows.Forms.Button();
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
this.pictureBox = new System.Windows.Forms.PictureBox(); this.pictureBox = new System.Windows.Forms.PictureBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.textBoxNewMapName = new System.Windows.Forms.TextBox();
this.buttonAddMap = new System.Windows.Forms.Button();
this.listBoxMaps = new System.Windows.Forms.ListBox();
this.buttonDeleteMap = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // groupBox1
@ -70,6 +70,67 @@
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Инструменты"; this.groupBox1.Text = "Инструменты";
// //
// groupBox2
//
this.groupBox2.Controls.Add(this.buttonDeleteMap);
this.groupBox2.Controls.Add(this.listBoxMaps);
this.groupBox2.Controls.Add(this.buttonAddMap);
this.groupBox2.Controls.Add(this.textBoxNewMapName);
this.groupBox2.Controls.Add(this.comboBoxSelectorMap);
this.groupBox2.Location = new System.Drawing.Point(6, 19);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(181, 287);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Карты";
//
// buttonDeleteMap
//
this.buttonDeleteMap.Location = new System.Drawing.Point(7, 204);
this.buttonDeleteMap.Name = "buttonDeleteMap";
this.buttonDeleteMap.Size = new System.Drawing.Size(168, 23);
this.buttonDeleteMap.TabIndex = 4;
this.buttonDeleteMap.Text = "Удалить Карту";
this.buttonDeleteMap.UseVisualStyleBackColor = true;
this.buttonDeleteMap.Click += new System.EventHandler(this.ButtonDeleteMap_Click);
//
// listBoxMaps
//
this.listBoxMaps.FormattingEnabled = true;
this.listBoxMaps.Location = new System.Drawing.Point(7, 102);
this.listBoxMaps.Name = "listBoxMaps";
this.listBoxMaps.Size = new System.Drawing.Size(168, 95);
this.listBoxMaps.TabIndex = 3;
//
// buttonAddMap
//
this.buttonAddMap.Location = new System.Drawing.Point(7, 72);
this.buttonAddMap.Name = "buttonAddMap";
this.buttonAddMap.Size = new System.Drawing.Size(168, 23);
this.buttonAddMap.TabIndex = 2;
this.buttonAddMap.Text = "Добавить Карту";
this.buttonAddMap.UseVisualStyleBackColor = true;
this.buttonAddMap.Click += new System.EventHandler(this.ButtonAddMap_Click);
//
// textBoxNewMapName
//
this.textBoxNewMapName.Location = new System.Drawing.Point(7, 18);
this.textBoxNewMapName.Name = "textBoxNewMapName";
this.textBoxNewMapName.Size = new System.Drawing.Size(168, 20);
this.textBoxNewMapName.TabIndex = 1;
//
// comboBoxSelectorMap
//
this.comboBoxSelectorMap.FormattingEnabled = true;
this.comboBoxSelectorMap.Items.AddRange(new object[] {
"Простая карта",
"Сложная карта"});
this.comboBoxSelectorMap.Location = new System.Drawing.Point(6, 44);
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
this.comboBoxSelectorMap.Size = new System.Drawing.Size(169, 21);
this.comboBoxSelectorMap.TabIndex = 0;
this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged);
//
// buttonLeft // buttonLeft
// //
this.buttonLeft.BackgroundImage = global::Trolleybus.Properties.Resources.left30; this.buttonLeft.BackgroundImage = global::Trolleybus.Properties.Resources.left30;
@ -161,18 +222,6 @@
this.buttonAddTrolleybus.UseVisualStyleBackColor = true; this.buttonAddTrolleybus.UseVisualStyleBackColor = true;
this.buttonAddTrolleybus.Click += new System.EventHandler(this.ButtonAddTrolleybus_Click); this.buttonAddTrolleybus.Click += new System.EventHandler(this.ButtonAddTrolleybus_Click);
// //
// comboBoxSelectorMap
//
this.comboBoxSelectorMap.FormattingEnabled = true;
this.comboBoxSelectorMap.Items.AddRange(new object[] {
"Простая карта",
"Сложная карта"});
this.comboBoxSelectorMap.Location = new System.Drawing.Point(6, 44);
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
this.comboBoxSelectorMap.Size = new System.Drawing.Size(169, 21);
this.comboBoxSelectorMap.TabIndex = 0;
this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged);
//
// pictureBox // pictureBox
// //
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
@ -182,53 +231,6 @@
this.pictureBox.TabIndex = 1; this.pictureBox.TabIndex = 1;
this.pictureBox.TabStop = false; this.pictureBox.TabStop = false;
// //
// groupBox2
//
this.groupBox2.Controls.Add(this.buttonDeleteMap);
this.groupBox2.Controls.Add(this.listBoxMaps);
this.groupBox2.Controls.Add(this.buttonAddMap);
this.groupBox2.Controls.Add(this.textBoxNewMapName);
this.groupBox2.Controls.Add(this.comboBoxSelectorMap);
this.groupBox2.Location = new System.Drawing.Point(6, 19);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(181, 287);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Карты";
//
// textBoxNewMapName
//
this.textBoxNewMapName.Location = new System.Drawing.Point(7, 18);
this.textBoxNewMapName.Name = "textBoxNewMapName";
this.textBoxNewMapName.Size = new System.Drawing.Size(168, 20);
this.textBoxNewMapName.TabIndex = 1;
//
// buttonAddMap
//
this.buttonAddMap.Location = new System.Drawing.Point(7, 72);
this.buttonAddMap.Name = "buttonAddMap";
this.buttonAddMap.Size = new System.Drawing.Size(168, 23);
this.buttonAddMap.TabIndex = 2;
this.buttonAddMap.Text = "Добавить Карту";
this.buttonAddMap.UseVisualStyleBackColor = true;
//
// listBoxMaps
//
this.listBoxMaps.FormattingEnabled = true;
this.listBoxMaps.Location = new System.Drawing.Point(7, 102);
this.listBoxMaps.Name = "listBoxMaps";
this.listBoxMaps.Size = new System.Drawing.Size(168, 95);
this.listBoxMaps.TabIndex = 3;
//
// buttonDeleteMap
//
this.buttonDeleteMap.Location = new System.Drawing.Point(7, 204);
this.buttonDeleteMap.Name = "buttonDeleteMap";
this.buttonDeleteMap.Size = new System.Drawing.Size(168, 23);
this.buttonDeleteMap.TabIndex = 4;
this.buttonDeleteMap.Text = "Удалить Карту";
this.buttonDeleteMap.UseVisualStyleBackColor = true;
//
// FormMapWithSetTrolleybus // FormMapWithSetTrolleybus
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -240,9 +242,9 @@
this.Text = "FormMapWithSetTrolleybus"; this.Text = "FormMapWithSetTrolleybus";
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout(); this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }

View File

@ -169,7 +169,7 @@ namespace Trolleybus
{ {
if (countInRow >= _pictureWidth / (_placeSizeWidth + 30)) if (countInRow >= _pictureWidth / (_placeSizeWidth + 30))
{ {
xForLocomotive = _pictureWidth - _placeSizeWidth + 40; xForLocomotive = _pictureWidth - 2 * _placeSizeWidth + 60;
yForLocomotive += _placeSizeHeight; yForLocomotive += _placeSizeHeight;
countInRow = 0; countInRow = 0;
} }