Добавлено изменение цвета панели определенного автомобиля

This commit is contained in:
MisterMLiL 2024-10-10 13:47:29 +03:00
parent 5dc3e6269c
commit 7f178888a5
42 changed files with 644 additions and 399 deletions

Binary file not shown.

Binary file not shown.

2
Car.cs
View File

@ -12,6 +12,7 @@ namespace GtaVUsersInfo
public string Manufacturer { get; set; } public string Manufacturer { get; set; }
public string Class { get; set; } public string Class { get; set; }
public string Model { get; set; } public string Model { get; set; }
public Color color { get; set; }
public Car() { } public Car() { }
@ -23,6 +24,7 @@ namespace GtaVUsersInfo
Manufacturer = car.Manufacturer; Manufacturer = car.Manufacturer;
Class = car.Class; Class = car.Class;
Model = car.Model; Model = car.Model;
color = car.color;
} }
public static List<Car> ConvertToCarList(List<CarControl> cars) public static List<Car> ConvertToCarList(List<CarControl> cars)

View File

@ -28,255 +28,270 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); components = new System.ComponentModel.Container();
this.MainPanel = new System.Windows.Forms.Panel(); MainPanel = new Panel();
this.PhotoPanel = new System.Windows.Forms.Panel(); PhotoPanel = new Panel();
this.PhotoBox = new System.Windows.Forms.PictureBox(); PhotoBox = new PictureBox();
this.MoneyPanel = new System.Windows.Forms.Panel(); MoneyPanel = new Panel();
this.MoneyTextBox = new System.Windows.Forms.TextBox(); MoneyTextBox = new TextBox();
this.MoneyLabel = new System.Windows.Forms.Label(); MoneyLabel = new Label();
this.ClassPanel = new System.Windows.Forms.Panel(); ClassPanel = new Panel();
this.ClassTextBox = new System.Windows.Forms.TextBox(); ClassTextBox = new TextBox();
this.ClassLabel = new System.Windows.Forms.Label(); ClassLabel = new Label();
this.NamePanel = new System.Windows.Forms.Panel(); NamePanel = new Panel();
this.ManufacturerLabel = new System.Windows.Forms.Label(); ManufacturerLabel = new Label();
this.NameLabel = new System.Windows.Forms.Label(); NameLabel = new Label();
this.ModelPanel = new System.Windows.Forms.Panel(); ModelPanel = new Panel();
this.ModelTextBox = new System.Windows.Forms.TextBox(); ModelTextBox = new TextBox();
this.ModelLabel = new System.Windows.Forms.Label(); ModelLabel = new Label();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); contextMenuStrip1 = new ContextMenuStrip(components);
this.MainPanel.SuspendLayout(); MainPanel.SuspendLayout();
this.PhotoPanel.SuspendLayout(); PhotoPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PhotoBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)PhotoBox).BeginInit();
this.MoneyPanel.SuspendLayout(); MoneyPanel.SuspendLayout();
this.ClassPanel.SuspendLayout(); ClassPanel.SuspendLayout();
this.NamePanel.SuspendLayout(); NamePanel.SuspendLayout();
this.ModelPanel.SuspendLayout(); ModelPanel.SuspendLayout();
this.SuspendLayout(); SuspendLayout();
// //
// MainPanel // MainPanel
// //
this.MainPanel.Controls.Add(this.PhotoPanel); MainPanel.Controls.Add(PhotoPanel);
this.MainPanel.Controls.Add(this.MoneyPanel); MainPanel.Controls.Add(MoneyPanel);
this.MainPanel.Controls.Add(this.ClassPanel); MainPanel.Controls.Add(ClassPanel);
this.MainPanel.Controls.Add(this.NamePanel); MainPanel.Controls.Add(NamePanel);
this.MainPanel.Controls.Add(this.ModelPanel); MainPanel.Controls.Add(ModelPanel);
this.MainPanel.Dock = System.Windows.Forms.DockStyle.Fill; MainPanel.Dock = DockStyle.Fill;
this.MainPanel.Location = new System.Drawing.Point(0, 0); MainPanel.Location = new Point(0, 0);
this.MainPanel.Name = "MainPanel"; MainPanel.Margin = new Padding(4, 3, 4, 3);
this.MainPanel.Size = new System.Drawing.Size(210, 204); MainPanel.Name = "MainPanel";
this.MainPanel.TabIndex = 0; MainPanel.Size = new Size(245, 235);
MainPanel.TabIndex = 0;
// //
// PhotoPanel // PhotoPanel
// //
this.PhotoPanel.Controls.Add(this.PhotoBox); PhotoPanel.Controls.Add(PhotoBox);
this.PhotoPanel.Dock = System.Windows.Forms.DockStyle.Fill; PhotoPanel.Dock = DockStyle.Fill;
this.PhotoPanel.Location = new System.Drawing.Point(0, 18); PhotoPanel.Location = new Point(0, 18);
this.PhotoPanel.Name = "PhotoPanel"; PhotoPanel.Margin = new Padding(4, 3, 4, 3);
this.PhotoPanel.Size = new System.Drawing.Size(210, 135); PhotoPanel.Name = "PhotoPanel";
this.PhotoPanel.TabIndex = 4; PhotoPanel.Size = new Size(245, 166);
PhotoPanel.TabIndex = 4;
// //
// PhotoBox // PhotoBox
// //
this.PhotoBox.Dock = System.Windows.Forms.DockStyle.Fill; PhotoBox.Dock = DockStyle.Fill;
this.PhotoBox.Location = new System.Drawing.Point(0, 0); PhotoBox.Location = new Point(0, 0);
this.PhotoBox.Name = "PhotoBox"; PhotoBox.Margin = new Padding(4, 3, 4, 3);
this.PhotoBox.Size = new System.Drawing.Size(210, 135); PhotoBox.Name = "PhotoBox";
this.PhotoBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; PhotoBox.Size = new Size(245, 166);
this.PhotoBox.TabIndex = 0; PhotoBox.SizeMode = PictureBoxSizeMode.Zoom;
this.PhotoBox.TabStop = false; PhotoBox.TabIndex = 0;
PhotoBox.TabStop = false;
// //
// MoneyPanel // MoneyPanel
// //
this.MoneyPanel.AutoSize = true; MoneyPanel.AutoSize = true;
this.MoneyPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; MoneyPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.MoneyPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; MoneyPanel.BorderStyle = BorderStyle.FixedSingle;
this.MoneyPanel.Controls.Add(this.MoneyTextBox); MoneyPanel.Controls.Add(MoneyTextBox);
this.MoneyPanel.Controls.Add(this.MoneyLabel); MoneyPanel.Controls.Add(MoneyLabel);
this.MoneyPanel.Dock = System.Windows.Forms.DockStyle.Bottom; MoneyPanel.Dock = DockStyle.Bottom;
this.MoneyPanel.Location = new System.Drawing.Point(0, 153); MoneyPanel.Location = new Point(0, 184);
this.MoneyPanel.Name = "MoneyPanel"; MoneyPanel.Margin = new Padding(4, 3, 4, 3);
this.MoneyPanel.Size = new System.Drawing.Size(210, 17); MoneyPanel.Name = "MoneyPanel";
this.MoneyPanel.TabIndex = 3; MoneyPanel.Size = new Size(245, 17);
MoneyPanel.TabIndex = 3;
// //
// MoneyTextBox // MoneyTextBox
// //
this.MoneyTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; MoneyTextBox.BorderStyle = BorderStyle.None;
this.MoneyTextBox.Dock = System.Windows.Forms.DockStyle.Top; MoneyTextBox.Dock = DockStyle.Top;
this.MoneyTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); MoneyTextBox.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point);
this.MoneyTextBox.Location = new System.Drawing.Point(56, 0); MoneyTextBox.Location = new Point(56, 0);
this.MoneyTextBox.Name = "MoneyTextBox"; MoneyTextBox.Margin = new Padding(4, 3, 4, 3);
this.MoneyTextBox.Size = new System.Drawing.Size(152, 15); MoneyTextBox.Name = "MoneyTextBox";
this.MoneyTextBox.TabIndex = 1; MoneyTextBox.Size = new Size(187, 15);
this.MoneyTextBox.Enter += new System.EventHandler(this.carPrice_Enter); MoneyTextBox.TabIndex = 1;
this.MoneyTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.carPrice_KeyPress); MoneyTextBox.Enter += carPrice_Enter;
this.MoneyTextBox.Leave += new System.EventHandler(this.carPrice_Leave); MoneyTextBox.KeyPress += carPrice_KeyPress;
MoneyTextBox.Leave += carPrice_Leave;
// //
// MoneyLabel // MoneyLabel
// //
this.MoneyLabel.AutoSize = true; MoneyLabel.AutoSize = true;
this.MoneyLabel.Dock = System.Windows.Forms.DockStyle.Left; MoneyLabel.Dock = DockStyle.Left;
this.MoneyLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); MoneyLabel.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point);
this.MoneyLabel.Location = new System.Drawing.Point(0, 0); MoneyLabel.Location = new Point(0, 0);
this.MoneyLabel.Name = "MoneyLabel"; MoneyLabel.Margin = new Padding(4, 0, 4, 0);
this.MoneyLabel.Size = new System.Drawing.Size(56, 16); MoneyLabel.Name = "MoneyLabel";
this.MoneyLabel.TabIndex = 0; MoneyLabel.Size = new Size(56, 16);
this.MoneyLabel.Text = "Деньги:"; MoneyLabel.TabIndex = 0;
MoneyLabel.Text = "Деньги:";
// //
// ClassPanel // ClassPanel
// //
this.ClassPanel.AutoSize = true; ClassPanel.AutoSize = true;
this.ClassPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; ClassPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.ClassPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; ClassPanel.BorderStyle = BorderStyle.FixedSingle;
this.ClassPanel.Controls.Add(this.ClassTextBox); ClassPanel.Controls.Add(ClassTextBox);
this.ClassPanel.Controls.Add(this.ClassLabel); ClassPanel.Controls.Add(ClassLabel);
this.ClassPanel.Dock = System.Windows.Forms.DockStyle.Bottom; ClassPanel.Dock = DockStyle.Bottom;
this.ClassPanel.Location = new System.Drawing.Point(0, 170); ClassPanel.Location = new Point(0, 201);
this.ClassPanel.Name = "ClassPanel"; ClassPanel.Margin = new Padding(4, 3, 4, 3);
this.ClassPanel.Size = new System.Drawing.Size(210, 17); ClassPanel.Name = "ClassPanel";
this.ClassPanel.TabIndex = 2; ClassPanel.Size = new Size(245, 17);
ClassPanel.TabIndex = 2;
// //
// ClassTextBox // ClassTextBox
// //
this.ClassTextBox.BackColor = System.Drawing.Color.White; ClassTextBox.BackColor = SystemColors.Window;
this.ClassTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; ClassTextBox.BorderStyle = BorderStyle.None;
this.ClassTextBox.Dock = System.Windows.Forms.DockStyle.Top; ClassTextBox.Dock = DockStyle.Top;
this.ClassTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); ClassTextBox.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point);
this.ClassTextBox.Location = new System.Drawing.Point(48, 0); ClassTextBox.Location = new Point(48, 0);
this.ClassTextBox.Name = "ClassTextBox"; ClassTextBox.Margin = new Padding(4, 3, 4, 3);
this.ClassTextBox.ReadOnly = true; ClassTextBox.Name = "ClassTextBox";
this.ClassTextBox.Size = new System.Drawing.Size(160, 15); ClassTextBox.ReadOnly = true;
this.ClassTextBox.TabIndex = 3; ClassTextBox.Size = new Size(195, 15);
ClassTextBox.TabIndex = 3;
// //
// ClassLabel // ClassLabel
// //
this.ClassLabel.AutoSize = true; ClassLabel.AutoSize = true;
this.ClassLabel.Dock = System.Windows.Forms.DockStyle.Left; ClassLabel.Dock = DockStyle.Left;
this.ClassLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); ClassLabel.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point);
this.ClassLabel.Location = new System.Drawing.Point(0, 0); ClassLabel.Location = new Point(0, 0);
this.ClassLabel.Name = "ClassLabel"; ClassLabel.Margin = new Padding(4, 0, 4, 0);
this.ClassLabel.Size = new System.Drawing.Size(48, 16); ClassLabel.Name = "ClassLabel";
this.ClassLabel.TabIndex = 0; ClassLabel.Size = new Size(48, 16);
this.ClassLabel.Text = "Класс:"; ClassLabel.TabIndex = 0;
ClassLabel.Text = "Класс:";
// //
// NamePanel // NamePanel
// //
this.NamePanel.AutoSize = true; NamePanel.AutoSize = true;
this.NamePanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; NamePanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.NamePanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; NamePanel.BorderStyle = BorderStyle.FixedSingle;
this.NamePanel.Controls.Add(this.ManufacturerLabel); NamePanel.Controls.Add(ManufacturerLabel);
this.NamePanel.Controls.Add(this.NameLabel); NamePanel.Controls.Add(NameLabel);
this.NamePanel.Dock = System.Windows.Forms.DockStyle.Top; NamePanel.Dock = DockStyle.Top;
this.NamePanel.Location = new System.Drawing.Point(0, 0); NamePanel.Location = new Point(0, 0);
this.NamePanel.Name = "NamePanel"; NamePanel.Margin = new Padding(4, 3, 4, 3);
this.NamePanel.Size = new System.Drawing.Size(210, 18); NamePanel.Name = "NamePanel";
this.NamePanel.TabIndex = 1; NamePanel.Size = new Size(245, 18);
NamePanel.TabIndex = 1;
// //
// ManufacturerLabel // ManufacturerLabel
// //
this.ManufacturerLabel.AutoSize = true; ManufacturerLabel.AutoSize = true;
this.ManufacturerLabel.Dock = System.Windows.Forms.DockStyle.Right; ManufacturerLabel.Dock = DockStyle.Right;
this.ManufacturerLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); ManufacturerLabel.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point);
this.ManufacturerLabel.Location = new System.Drawing.Point(159, 0); ManufacturerLabel.Location = new Point(194, 0);
this.ManufacturerLabel.Name = "ManufacturerLabel"; ManufacturerLabel.Margin = new Padding(4, 0, 4, 0);
this.ManufacturerLabel.Size = new System.Drawing.Size(49, 16); ManufacturerLabel.Name = "ManufacturerLabel";
this.ManufacturerLabel.TabIndex = 1; ManufacturerLabel.Size = new Size(49, 16);
this.ManufacturerLabel.Text = "Марка"; ManufacturerLabel.TabIndex = 1;
ManufacturerLabel.Text = "Марка";
// //
// NameLabel // NameLabel
// //
this.NameLabel.AutoSize = true; NameLabel.AutoSize = true;
this.NameLabel.Dock = System.Windows.Forms.DockStyle.Fill; NameLabel.Dock = DockStyle.Fill;
this.NameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); NameLabel.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point);
this.NameLabel.Location = new System.Drawing.Point(0, 0); NameLabel.Location = new Point(0, 0);
this.NameLabel.Name = "NameLabel"; NameLabel.Margin = new Padding(4, 0, 4, 0);
this.NameLabel.Size = new System.Drawing.Size(73, 16); NameLabel.Name = "NameLabel";
this.NameLabel.TabIndex = 0; NameLabel.Size = new Size(73, 16);
this.NameLabel.Text = "Название"; NameLabel.TabIndex = 0;
NameLabel.Text = "Название";
// //
// ModelPanel // ModelPanel
// //
this.ModelPanel.AutoSize = true; ModelPanel.AutoSize = true;
this.ModelPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; ModelPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.ModelPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; ModelPanel.BorderStyle = BorderStyle.FixedSingle;
this.ModelPanel.Controls.Add(this.ModelTextBox); ModelPanel.Controls.Add(ModelTextBox);
this.ModelPanel.Controls.Add(this.ModelLabel); ModelPanel.Controls.Add(ModelLabel);
this.ModelPanel.Dock = System.Windows.Forms.DockStyle.Bottom; ModelPanel.Dock = DockStyle.Bottom;
this.ModelPanel.Location = new System.Drawing.Point(0, 187); ModelPanel.Location = new Point(0, 218);
this.ModelPanel.Name = "ModelPanel"; ModelPanel.Margin = new Padding(4, 3, 4, 3);
this.ModelPanel.Size = new System.Drawing.Size(210, 17); ModelPanel.Name = "ModelPanel";
this.ModelPanel.TabIndex = 0; ModelPanel.Size = new Size(245, 17);
ModelPanel.TabIndex = 0;
// //
// ModelTextBox // ModelTextBox
// //
this.ModelTextBox.BackColor = System.Drawing.Color.White; ModelTextBox.BackColor = SystemColors.Window;
this.ModelTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; ModelTextBox.BorderStyle = BorderStyle.None;
this.ModelTextBox.Dock = System.Windows.Forms.DockStyle.Top; ModelTextBox.Dock = DockStyle.Top;
this.ModelTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); ModelTextBox.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point);
this.ModelTextBox.Location = new System.Drawing.Point(60, 0); ModelTextBox.Location = new Point(60, 0);
this.ModelTextBox.Name = "ModelTextBox"; ModelTextBox.Margin = new Padding(4, 3, 4, 3);
this.ModelTextBox.ReadOnly = true; ModelTextBox.Name = "ModelTextBox";
this.ModelTextBox.Size = new System.Drawing.Size(148, 15); ModelTextBox.ReadOnly = true;
this.ModelTextBox.TabIndex = 2; ModelTextBox.Size = new Size(183, 15);
ModelTextBox.TabIndex = 2;
// //
// ModelLabel // ModelLabel
// //
this.ModelLabel.AutoSize = true; ModelLabel.AutoSize = true;
this.ModelLabel.Dock = System.Windows.Forms.DockStyle.Left; ModelLabel.Dock = DockStyle.Left;
this.ModelLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); ModelLabel.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Regular, GraphicsUnit.Point);
this.ModelLabel.Location = new System.Drawing.Point(0, 0); ModelLabel.Location = new Point(0, 0);
this.ModelLabel.Name = "ModelLabel"; ModelLabel.Margin = new Padding(4, 0, 4, 0);
this.ModelLabel.Size = new System.Drawing.Size(60, 16); ModelLabel.Name = "ModelLabel";
this.ModelLabel.TabIndex = 0; ModelLabel.Size = new Size(60, 16);
this.ModelLabel.Text = "Модель:"; ModelLabel.TabIndex = 0;
ModelLabel.Text = "Модель:";
// //
// contextMenuStrip1 // contextMenuStrip1
// //
this.contextMenuStrip1.Name = "contextMenuStrip1"; contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4); contextMenuStrip1.Size = new Size(61, 4);
// //
// CarControl // CarControl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); AutoScaleDimensions = new SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White; BackColor = Color.White;
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; BorderStyle = BorderStyle.FixedSingle;
this.Controls.Add(this.MainPanel); Controls.Add(MainPanel);
this.Name = "CarControl"; Margin = new Padding(4, 3, 4, 3);
this.Size = new System.Drawing.Size(210, 204); Name = "CarControl";
this.MainPanel.ResumeLayout(false); Size = new Size(245, 235);
this.MainPanel.PerformLayout(); MainPanel.ResumeLayout(false);
this.PhotoPanel.ResumeLayout(false); MainPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.PhotoBox)).EndInit(); PhotoPanel.ResumeLayout(false);
this.MoneyPanel.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)PhotoBox).EndInit();
this.MoneyPanel.PerformLayout(); MoneyPanel.ResumeLayout(false);
this.ClassPanel.ResumeLayout(false); MoneyPanel.PerformLayout();
this.ClassPanel.PerformLayout(); ClassPanel.ResumeLayout(false);
this.NamePanel.ResumeLayout(false); ClassPanel.PerformLayout();
this.NamePanel.PerformLayout(); NamePanel.ResumeLayout(false);
this.ModelPanel.ResumeLayout(false); NamePanel.PerformLayout();
this.ModelPanel.PerformLayout(); ModelPanel.ResumeLayout(false);
this.ResumeLayout(false); ModelPanel.PerformLayout();
ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.Panel MainPanel; private Panel MainPanel;
private System.Windows.Forms.Panel MoneyPanel; private Panel MoneyPanel;
private System.Windows.Forms.Label MoneyLabel; private Label MoneyLabel;
private System.Windows.Forms.Panel ClassPanel; private Panel ClassPanel;
private System.Windows.Forms.Label ClassLabel; private Label ClassLabel;
private System.Windows.Forms.Panel NamePanel; private Panel NamePanel;
private System.Windows.Forms.Label NameLabel; private Label NameLabel;
private System.Windows.Forms.Panel ModelPanel; private Panel ModelPanel;
private System.Windows.Forms.Label ModelLabel; private Label ModelLabel;
private System.Windows.Forms.Panel PhotoPanel; private Panel PhotoPanel;
private System.Windows.Forms.PictureBox PhotoBox; private PictureBox PhotoBox;
private System.Windows.Forms.Label ManufacturerLabel; private Label ManufacturerLabel;
private System.Windows.Forms.TextBox MoneyTextBox; private TextBox MoneyTextBox;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.TextBox ModelTextBox; private TextBox ModelTextBox;
private System.Windows.Forms.TextBox ClassTextBox; private TextBox ClassTextBox;
} }
} }

View File

@ -5,6 +5,7 @@ using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using GtaVUsersInfo.Helpers; using GtaVUsersInfo.Helpers;
using GtaVUsersInfo.Sources;
namespace GtaVUsersInfo.Controls namespace GtaVUsersInfo.Controls
{ {
@ -12,6 +13,7 @@ namespace GtaVUsersInfo.Controls
{ {
private static readonly HttpClient httpClient = new HttpClient(); private static readonly HttpClient httpClient = new HttpClient();
private Car car; private Car car;
public Car Car public Car Car
{ {
get { return car; } get { return car; }
@ -36,6 +38,8 @@ namespace GtaVUsersInfo.Controls
ModelTextBox.Text = Car.Model; ModelTextBox.Text = Car.Model;
MoneyTextBox.Text = '$' + Car.Price.ToString(); MoneyTextBox.Text = '$' + Car.Price.ToString();
ChangeColor();
LoadImageAsync(Car.Photo); LoadImageAsync(Car.Photo);
} }
@ -111,5 +115,25 @@ namespace GtaVUsersInfo.Controls
e.Handled = true; e.Handled = true;
} }
} }
private void ChangeColor()
{
this.BackColor = car.color;
MoneyTextBox.BackColor = car.color;
ClassTextBox.BackColor = car.color;
ModelTextBox.BackColor = car.color;
}
public void ChangeColor(object sender, EventArgs e)
{
using (ColorDialog colorDialog = new ColorDialog())
{
if (colorDialog.ShowDialog() == DialogResult.OK)
{
car.color = colorDialog.Color;
ChangeColor();
}
}
}
} }
} }

View File

@ -1,24 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->

View File

@ -28,57 +28,69 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); components = new System.ComponentModel.Container();
this.myMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); myMenuStrip = new ContextMenuStrip(components);
this.addNewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); addNewToolStripMenuItem = new ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); editToolStripMenuItem = new ToolStripMenuItem();
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); deleteToolStripMenuItem = new ToolStripMenuItem();
this.myMenuStrip.SuspendLayout(); colorToolStripMenuItem = new ToolStripMenuItem();
this.SuspendLayout(); toolStripSeparator1 = new ToolStripSeparator();
myMenuStrip.SuspendLayout();
SuspendLayout();
// //
// myMenuStrip // myMenuStrip
// //
this.myMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { myMenuStrip.Items.AddRange(new ToolStripItem[] { addNewToolStripMenuItem, editToolStripMenuItem, deleteToolStripMenuItem, toolStripSeparator1, colorToolStripMenuItem });
this.addNewToolStripMenuItem, myMenuStrip.Name = "contextMenuStrip";
this.editToolStripMenuItem, myMenuStrip.Size = new Size(181, 120);
this.deleteToolStripMenuItem});
this.myMenuStrip.Name = "contextMenuStrip";
this.myMenuStrip.Size = new System.Drawing.Size(181, 92);
// //
// addNewToolStripMenuItem // addNewToolStripMenuItem
// //
this.addNewToolStripMenuItem.Name = "addNewToolStripMenuItem"; addNewToolStripMenuItem.Name = "addNewToolStripMenuItem";
this.addNewToolStripMenuItem.Size = new System.Drawing.Size(180, 22); addNewToolStripMenuItem.Size = new Size(180, 22);
this.addNewToolStripMenuItem.Text = "Создать"; addNewToolStripMenuItem.Text = "Создать";
// //
// editToolStripMenuItem // editToolStripMenuItem
// //
this.editToolStripMenuItem.Name = "editToolStripMenuItem"; editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(180, 22); editToolStripMenuItem.Size = new Size(180, 22);
this.editToolStripMenuItem.Text = "Изменить"; editToolStripMenuItem.Text = "Изменить";
// //
// deleteToolStripMenuItem // deleteToolStripMenuItem
// //
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(180, 22); deleteToolStripMenuItem.Size = new Size(180, 22);
this.deleteToolStripMenuItem.Text = "Удалить"; deleteToolStripMenuItem.Text = "Удалить";
// //
// CarMenuStrip // colorToolStripMenuItem
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); colorToolStripMenuItem.Name = "colorToolStripMenuItem";
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; colorToolStripMenuItem.Size = new Size(180, 22);
this.Name = "CarMenuStrip"; colorToolStripMenuItem.Text = "Цвет";
this.Size = new System.Drawing.Size(158, 245); //
this.myMenuStrip.ResumeLayout(false); // toolStripSeparator1
this.ResumeLayout(false); //
toolStripSeparator1.Name = "toolStripSeparator1";
toolStripSeparator1.Size = new Size(177, 6);
//
// CarItemMenuStrip
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
Margin = new Padding(4, 3, 4, 3);
Name = "CarItemMenuStrip";
Size = new Size(184, 283);
myMenuStrip.ResumeLayout(false);
ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.ContextMenuStrip myMenuStrip; private ContextMenuStrip myMenuStrip;
private System.Windows.Forms.ToolStripMenuItem addNewToolStripMenuItem; private ToolStripMenuItem addNewToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; private ToolStripMenuItem editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem; private ToolStripMenuItem deleteToolStripMenuItem;
private ToolStripSeparator toolStripSeparator1;
private ToolStripMenuItem colorToolStripMenuItem;
} }
} }

View File

@ -19,19 +19,21 @@ namespace GtaVUsersInfo.Controls
public CarControl Car; public CarControl Car;
public CarItemMenuStrip(EventHandler add, EventHandler edit, EventHandler delete, CarControl car) public CarItemMenuStrip(EventHandler add, EventHandler edit, EventHandler delete, EventHandler color, CarControl car)
{ {
InitializeComponent(); InitializeComponent();
addNewToolStripMenuItem.Click += add; addNewToolStripMenuItem.Click += add;
editToolStripMenuItem.Click += edit; editToolStripMenuItem.Click += edit;
deleteToolStripMenuItem.Click += delete; deleteToolStripMenuItem.Click += delete;
colorToolStripMenuItem.Click += color;
Car = car; Car = car;
addNewToolStripMenuItem.Tag = this; addNewToolStripMenuItem.Tag = this;
editToolStripMenuItem.Tag = this; editToolStripMenuItem.Tag = this;
deleteToolStripMenuItem.Tag = this; deleteToolStripMenuItem.Tag = this;
colorToolStripMenuItem.Tag = this;
} }
} }
} }

View File

@ -1,24 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->

View File

@ -28,64 +28,67 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.namePanel = new System.Windows.Forms.Panel(); namePanel = new Panel();
this.Textbox = new System.Windows.Forms.TextBox(); Textbox = new TextBox();
this.Label = new System.Windows.Forms.Label(); Label = new Label();
this.namePanel.SuspendLayout(); namePanel.SuspendLayout();
this.SuspendLayout(); SuspendLayout();
// //
// namePanel // namePanel
// //
this.namePanel.AutoSize = true; namePanel.AutoSize = true;
this.namePanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; namePanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
this.namePanel.Controls.Add(this.Textbox); namePanel.Controls.Add(Textbox);
this.namePanel.Controls.Add(this.Label); namePanel.Controls.Add(Label);
this.namePanel.Dock = System.Windows.Forms.DockStyle.Top; namePanel.Dock = DockStyle.Top;
this.namePanel.Location = new System.Drawing.Point(0, 0); namePanel.Location = new Point(0, 0);
this.namePanel.Name = "namePanel"; namePanel.Margin = new Padding(4, 3, 4, 3);
this.namePanel.Padding = new System.Windows.Forms.Padding(2); namePanel.Name = "namePanel";
this.namePanel.Size = new System.Drawing.Size(150, 37); namePanel.Padding = new Padding(2);
this.namePanel.TabIndex = 2; namePanel.Size = new Size(175, 42);
namePanel.TabIndex = 2;
// //
// Textbox // Textbox
// //
this.Textbox.Dock = System.Windows.Forms.DockStyle.Top; Textbox.Dock = DockStyle.Top;
this.Textbox.ImeMode = System.Windows.Forms.ImeMode.NoControl; Textbox.ImeMode = ImeMode.NoControl;
this.Textbox.Location = new System.Drawing.Point(2, 15); Textbox.Location = new Point(2, 17);
this.Textbox.Name = "Textbox"; Textbox.Margin = new Padding(4, 3, 4, 3);
this.Textbox.Size = new System.Drawing.Size(146, 20); Textbox.Name = "Textbox";
this.Textbox.TabIndex = 1; Textbox.Size = new Size(171, 23);
this.Textbox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox_KeyPress); Textbox.TabIndex = 1;
Textbox.KeyPress += textBox_KeyPress;
// //
// Label // Label
// //
this.Label.AutoSize = true; Label.AutoSize = true;
this.Label.Dock = System.Windows.Forms.DockStyle.Top; Label.Dock = DockStyle.Top;
this.Label.Location = new System.Drawing.Point(2, 2); Label.Location = new Point(2, 2);
this.Label.Name = "Label"; Label.Margin = new Padding(4, 0, 4, 0);
this.Label.Size = new System.Drawing.Size(32, 13); Label.Name = "Label";
this.Label.TabIndex = 0; Label.Size = new Size(34, 15);
this.Label.Text = "Имя:"; Label.TabIndex = 0;
Label.Text = "Имя:";
// //
// ParameterControl // ParameterControl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); AutoScaleDimensions = new SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
this.AutoSize = true; AutoSize = true;
this.Controls.Add(this.namePanel); Controls.Add(namePanel);
this.Name = "ParameterControl"; Margin = new Padding(4, 3, 4, 3);
this.Size = new System.Drawing.Size(150, 37); Name = "ParameterControl";
this.namePanel.ResumeLayout(false); Size = new Size(175, 48);
this.namePanel.PerformLayout(); namePanel.ResumeLayout(false);
this.ResumeLayout(false); namePanel.PerformLayout();
this.PerformLayout(); ResumeLayout(false);
PerformLayout();
} }
#endregion #endregion
private System.Windows.Forms.Panel namePanel; private Panel namePanel;
private System.Windows.Forms.TextBox Textbox; private TextBox Textbox;
private System.Windows.Forms.Label Label; private Label Label;
} }
} }

View File

@ -12,8 +12,8 @@ namespace GtaVUsersInfo.Controls
{ {
public partial class ParameterControl : UserControl public partial class ParameterControl : UserControl
{ {
public string ParamName public string ParamName
{ {
get { return Label.Text.TrimEnd(':'); } get { return Label.Text.TrimEnd(':'); }
set { Label.Text = value + ':'; } set { Label.Text = value + ':'; }
} }

View File

@ -1,24 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->

60
MainForm.Designer.cs generated
View File

@ -29,9 +29,9 @@
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
panel1 = new Panel(); upPanel = new Panel();
debugCheck = new CheckBox(); debugCheck = new CheckBox();
panel2 = new Panel(); downPanel = new Panel();
buttonsPanel = new Panel(); buttonsPanel = new Panel();
readJsonButton = new Button(); readJsonButton = new Button();
addParameter = new Button(); addParameter = new Button();
@ -63,22 +63,22 @@
splitterRigth = new Splitter(); splitterRigth = new Splitter();
carsPanel = new Panel(); carsPanel = new Panel();
carsItems = new FlowLayoutPanel(); carsItems = new FlowLayoutPanel();
panel1.SuspendLayout(); upPanel.SuspendLayout();
buttonsPanel.SuspendLayout(); buttonsPanel.SuspendLayout();
menuStrip.SuspendLayout(); menuStrip.SuspendLayout();
carsPanel.SuspendLayout(); carsPanel.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// panel1 // upPanel
// //
panel1.BorderStyle = BorderStyle.FixedSingle; upPanel.BorderStyle = BorderStyle.FixedSingle;
panel1.Controls.Add(debugCheck); upPanel.Controls.Add(debugCheck);
panel1.Dock = DockStyle.Top; upPanel.Dock = DockStyle.Top;
panel1.Location = new Point(0, 24); upPanel.Location = new Point(0, 24);
panel1.Margin = new Padding(4, 3, 4, 3); upPanel.Margin = new Padding(4, 3, 4, 3);
panel1.Name = "panel1"; upPanel.Name = "upPanel";
panel1.Size = new Size(891, 23); upPanel.Size = new Size(891, 23);
panel1.TabIndex = 0; upPanel.TabIndex = 0;
// //
// debugCheck // debugCheck
// //
@ -92,15 +92,15 @@
debugCheck.UseVisualStyleBackColor = true; debugCheck.UseVisualStyleBackColor = true;
debugCheck.CheckedChanged += debugCheck_CheckedChanged; debugCheck.CheckedChanged += debugCheck_CheckedChanged;
// //
// panel2 // downPanel
// //
panel2.BorderStyle = BorderStyle.FixedSingle; downPanel.BorderStyle = BorderStyle.FixedSingle;
panel2.Dock = DockStyle.Bottom; downPanel.Dock = DockStyle.Bottom;
panel2.Location = new Point(0, 534); downPanel.Location = new Point(0, 534);
panel2.Margin = new Padding(4, 3, 4, 3); downPanel.Margin = new Padding(4, 3, 4, 3);
panel2.Name = "panel2"; downPanel.Name = "downPanel";
panel2.Size = new Size(891, 23); downPanel.Size = new Size(891, 23);
panel2.TabIndex = 1; downPanel.TabIndex = 1;
// //
// buttonsPanel // buttonsPanel
// //
@ -325,24 +325,28 @@
buttonPanelToolStripMenuItem.Name = "buttonPanelToolStripMenuItem"; buttonPanelToolStripMenuItem.Name = "buttonPanelToolStripMenuItem";
buttonPanelToolStripMenuItem.Size = new Size(188, 22); buttonPanelToolStripMenuItem.Size = new Size(188, 22);
buttonPanelToolStripMenuItem.Text = "Левая панель"; buttonPanelToolStripMenuItem.Text = "Левая панель";
buttonPanelToolStripMenuItem.Click += buttonPanelToolStripMenuItem_Click;
// //
// parameterPanelToolStripMenuItem // parameterPanelToolStripMenuItem
// //
parameterPanelToolStripMenuItem.Name = "parameterPanelToolStripMenuItem"; parameterPanelToolStripMenuItem.Name = "parameterPanelToolStripMenuItem";
parameterPanelToolStripMenuItem.Size = new Size(188, 22); parameterPanelToolStripMenuItem.Size = new Size(188, 22);
parameterPanelToolStripMenuItem.Text = "Правая панель"; parameterPanelToolStripMenuItem.Text = "Правая панель";
parameterPanelToolStripMenuItem.Click += parameterPanelToolStripMenuItem_Click;
// //
// carPanelToolStripMenuItem // carPanelToolStripMenuItem
// //
carPanelToolStripMenuItem.Name = "carPanelToolStripMenuItem"; carPanelToolStripMenuItem.Name = "carPanelToolStripMenuItem";
carPanelToolStripMenuItem.Size = new Size(188, 22); carPanelToolStripMenuItem.Size = new Size(188, 22);
carPanelToolStripMenuItem.Text = "Центральная панель"; carPanelToolStripMenuItem.Text = "Центральная панель";
carPanelToolStripMenuItem.Click += carPanelToolStripMenuItem_Click;
// //
// top_downPanelToolStripMenuItem // top_downPanelToolStripMenuItem
// //
top_downPanelToolStripMenuItem.Name = "top_downPanelToolStripMenuItem"; top_downPanelToolStripMenuItem.Name = "top_downPanelToolStripMenuItem";
top_downPanelToolStripMenuItem.Size = new Size(188, 22); top_downPanelToolStripMenuItem.Size = new Size(188, 22);
top_downPanelToolStripMenuItem.Text = "Верх/низ"; top_downPanelToolStripMenuItem.Text = "Верх/низ";
top_downPanelToolStripMenuItem.Click += top_downPanelToolStripMenuItem_Click;
// //
// splitterLeft // splitterLeft
// //
@ -352,7 +356,6 @@
splitterLeft.Size = new Size(6, 487); splitterLeft.Size = new Size(6, 487);
splitterLeft.TabIndex = 6; splitterLeft.TabIndex = 6;
splitterLeft.TabStop = false; splitterLeft.TabStop = false;
splitterLeft.SplitterMoved += SplitterMoved;
// //
// splitterRigth // splitterRigth
// //
@ -363,7 +366,6 @@
splitterRigth.Size = new Size(6, 487); splitterRigth.Size = new Size(6, 487);
splitterRigth.TabIndex = 7; splitterRigth.TabIndex = 7;
splitterRigth.TabStop = false; splitterRigth.TabStop = false;
splitterRigth.SplitterMoved += SplitterMoved;
// //
// carsPanel // carsPanel
// //
@ -379,6 +381,7 @@
// carsItems // carsItems
// //
carsItems.AutoScroll = true; carsItems.AutoScroll = true;
carsItems.BackColor = Color.White;
carsItems.Dock = DockStyle.Fill; carsItems.Dock = DockStyle.Fill;
carsItems.Location = new Point(0, 0); carsItems.Location = new Point(0, 0);
carsItems.Margin = new Padding(4, 3, 4, 3); carsItems.Margin = new Padding(4, 3, 4, 3);
@ -397,8 +400,8 @@
Controls.Add(splitterLeft); Controls.Add(splitterLeft);
Controls.Add(parametersPanel); Controls.Add(parametersPanel);
Controls.Add(buttonsPanel); Controls.Add(buttonsPanel);
Controls.Add(panel2); Controls.Add(downPanel);
Controls.Add(panel1); Controls.Add(upPanel);
Controls.Add(menuStrip); Controls.Add(menuStrip);
Icon = (Icon)resources.GetObject("$this.Icon"); Icon = (Icon)resources.GetObject("$this.Icon");
MainMenuStrip = menuStrip; MainMenuStrip = menuStrip;
@ -409,9 +412,8 @@
Text = "null"; Text = "null";
FormClosing += MainForm_FormClosing; FormClosing += MainForm_FormClosing;
Load += MainForm_Load; Load += MainForm_Load;
Resize += MainForm_Resize; upPanel.ResumeLayout(false);
panel1.ResumeLayout(false); upPanel.PerformLayout();
panel1.PerformLayout();
buttonsPanel.ResumeLayout(false); buttonsPanel.ResumeLayout(false);
buttonsPanel.PerformLayout(); buttonsPanel.PerformLayout();
menuStrip.ResumeLayout(false); menuStrip.ResumeLayout(false);
@ -423,8 +425,8 @@
#endregion #endregion
private Panel panel1; private Panel upPanel;
private Panel panel2; private Panel downPanel;
private Panel buttonsPanel; private Panel buttonsPanel;
private Panel parametersPanel; private Panel parametersPanel;
private MenuStrip menuStrip; private MenuStrip menuStrip;

View File

@ -33,14 +33,16 @@ namespace GtaVUsersInfo
private List<ParameterControl> parameters; private List<ParameterControl> parameters;
private List<CarControl> cars; private List<CarControl> cars;
private FontSettings fontSettings;
private Font defaultFont; private Font defaultFont;
private Color defaultColor; private Color defaultColor;
private Color defaultPanelColor;
private List<Control> dtControls; private List<Control> dtControls;
private FontSettings fontSettings;
private WindowParameters window; private WindowParameters window;
private PanelColorSettings panelColorSettings;
private bool isUser; private bool isUser;
@ -98,13 +100,43 @@ namespace GtaVUsersInfo
} }
else else
{ {
window = new WindowParameters(new Size(this.Width, this.Height), new Size(this.splitterLeft.SplitPosition, this.splitterRigth.SplitPosition)); window = new WindowParameters(new Size(this.Width, this.Height), new Size(this.splitterLeft.SplitPosition, this.splitterRigth.SplitPosition), IsFormFullscreen());
WindowParameters.SaveWindowParameters(window); WindowParameters.SaveWindowParameters(window);
WindowResize(); WindowResize();
} }
isUser = true; isUser = true;
panelColorSettings = PanelColorSettings.LoadPanelSettings();
if (panelColorSettings != null)
{
ChangePanelColor();
}
else
{
panelColorSettings = new PanelColorSettings(defaultPanelColor, defaultPanelColor, defaultPanelColor, defaultPanelColor);
ChangePanelColor();
}
} }
private bool IsFormFullscreen()
{
if (this.WindowState == FormWindowState.Maximized)
{
return true;
}
return false;
}
private void SetFullscreen(bool fullscreen)
{
if (fullscreen)
{
this.WindowState = FormWindowState.Maximized;
}
}
private void MainForm_Load(object sender, EventArgs e) private void MainForm_Load(object sender, EventArgs e)
{ {
AllPanelCreate(); AllPanelCreate();
@ -124,6 +156,7 @@ namespace GtaVUsersInfo
this.Height = window.height; this.Height = window.height;
this.splitterLeft.SplitPosition = window.leftPos; this.splitterLeft.SplitPosition = window.leftPos;
this.splitterRigth.SplitPosition = window.rightPos; this.splitterRigth.SplitPosition = window.rightPos;
SetFullscreen(window.isFullScreen);
} }
private void ParameterPanelCreate() private void ParameterPanelCreate()
@ -145,7 +178,7 @@ namespace GtaVUsersInfo
foreach (CarControl car in cars) foreach (CarControl car in cars)
{ {
car.MenuStrip = new CarItemMenuStrip(addCar_Click, editCar, deleteCar, car).Menu; car.MenuStrip = new CarItemMenuStrip(addCar_Click, editCar, deleteCar, car.ChangeColor, car).Menu;
carsItems.Controls.Add(car); carsItems.Controls.Add(car);
} }
} }
@ -429,7 +462,6 @@ namespace GtaVUsersInfo
var split = openFileDialog.FileName.Split('\\'); var split = openFileDialog.FileName.Split('\\');
this.Text = split[split.Length - 1]; this.Text = split[split.Length - 1];
window.prevFile = openFileDialog.FileName; window.prevFile = openFileDialog.FileName;
SaveWindowSize();
return data; return data;
} }
return null; // Если пользователь отменил выбор файла return null; // Если пользователь отменил выбор файла
@ -473,7 +505,6 @@ namespace GtaVUsersInfo
this.Text = "null"; this.Text = "null";
window.prevFile = null; window.prevFile = null;
SaveWindowSize();
AllPanelCreate(); AllPanelCreate();
} }
@ -497,6 +528,8 @@ namespace GtaVUsersInfo
e.Cancel = true; e.Cancel = true;
return; return;
} }
SaveWindowSize();
} }
#endregion #endregion
@ -549,19 +582,85 @@ namespace GtaVUsersInfo
{ {
if (isUser) if (isUser)
{ {
window = new WindowParameters(new Size(this.Width, this.Height), new Size(this.splitterLeft.SplitPosition, this.splitterRigth.SplitPosition), window.prevFile); window = new WindowParameters(new Size(this.Width, this.Height), new Size(this.splitterLeft.SplitPosition, this.splitterRigth.SplitPosition), IsFormFullscreen(), window.prevFile);
WindowParameters.SaveWindowParameters(window); WindowParameters.SaveWindowParameters(window);
} }
} }
private void MainForm_Resize(object sender, EventArgs e) private void SaveColorPanel()
{ {
SaveWindowSize(); PanelColorSettings.SavePanelSettings(panelColorSettings);
} }
private void SplitterMoved(object sender, SplitterEventArgs e) private void ChangePanelColor()
{ {
SaveWindowSize(); this.buttonsPanel.BackColor = panelColorSettings.leftPanel;
this.parametersPanel.BackColor = panelColorSettings.rightPanel;
this.carsPanel.BackColor = panelColorSettings.centerPanel;
this.carsItems.BackColor = panelColorSettings.centerPanel;
this.upPanel.BackColor = panelColorSettings.upDownPanel;
this.downPanel.BackColor = panelColorSettings.upDownPanel;
this.menuStrip.BackColor = panelColorSettings.upDownPanel;
}
private void buttonPanelToolStripMenuItem_Click(object sender, EventArgs e)
{
using (ColorDialog colorDialog = new ColorDialog())
{
if (colorDialog.ShowDialog() == DialogResult.OK)
{
panelColorSettings.leftPanel = colorDialog.Color;
ChangePanelColor();
SaveColorPanel();
}
}
}
private void parameterPanelToolStripMenuItem_Click(object sender, EventArgs e)
{
using (ColorDialog colorDialog = new ColorDialog())
{
if (colorDialog.ShowDialog() == DialogResult.OK)
{
panelColorSettings.rightPanel = colorDialog.Color;
ChangePanelColor();
SaveColorPanel();
}
}
}
private void carPanelToolStripMenuItem_Click(object sender, EventArgs e)
{
using (ColorDialog colorDialog = new ColorDialog())
{
if (colorDialog.ShowDialog() == DialogResult.OK)
{
panelColorSettings.centerPanel = colorDialog.Color;
ChangePanelColor();
SaveColorPanel();
}
}
}
private void top_downPanelToolStripMenuItem_Click(object sender, EventArgs e)
{
using (ColorDialog colorDialog = new ColorDialog())
{
if (colorDialog.ShowDialog() == DialogResult.OK)
{
panelColorSettings.upDownPanel = colorDialog.Color;
ChangePanelColor();
SaveColorPanel();
}
}
} }
} }
} }

9
Resources.Designer.cs generated
View File

@ -115,6 +115,15 @@ namespace GtaVUsersInfo {
} }
} }
/// <summary>
/// Ищет локализованную строку, похожую на data/panelColor.json.
/// </summary>
public static string paneColorlSettingsJsonPath {
get {
return ResourceManager.GetString("paneColorlSettingsJsonPath", resourceCulture);
}
}
/// <summary> /// <summary>
/// Ищет локализованную строку, похожую на data/window.json. /// Ищет локализованную строку, похожую на data/window.json.
/// </summary> /// </summary>

View File

@ -136,6 +136,9 @@
<data name="icon" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>Resources\icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="paneColorlSettingsJsonPath" xml:space="preserve">
<value>data/panelColor.json</value>
</data>
<data name="windowParametersJsonPath" xml:space="preserve"> <data name="windowParametersJsonPath" xml:space="preserve">
<value>data/window.json</value> <value>data/window.json</value>
</data> </data>

View File

@ -0,0 +1,64 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GtaVUsersInfo.Sources
{
[Serializable]
public class PanelColorSettings
{
public Color leftPanel;
public Color rightPanel;
public Color centerPanel;
public Color upDownPanel;
public PanelColorSettings() { }
public PanelColorSettings(Color left, Color right, Color center, Color upDown)
{
leftPanel = left;
rightPanel = right;
centerPanel = center;
upDownPanel = upDown;
}
public static void SavePanelSettings(PanelColorSettings color)
{
string json = JsonConvert.SerializeObject(color, Formatting.Indented);
if (!Directory.Exists(Path.GetDirectoryName(Resources.paneColorlSettingsJsonPath)))
{
Directory.CreateDirectory(Path.GetDirectoryName(Resources.paneColorlSettingsJsonPath));
}
File.WriteAllText(Resources.paneColorlSettingsJsonPath, json);
}
public static PanelColorSettings LoadPanelSettings()
{
try
{
string json = File.ReadAllText(Resources.paneColorlSettingsJsonPath);
return JsonConvert.DeserializeObject<PanelColorSettings>(json);
}
catch (FileNotFoundException)
{
Console.WriteLine($"Файл с цветами панелей не найден: {Resources.paneColorlSettingsJsonPath}");
return null;
}
catch (JsonException ex)
{
Console.WriteLine($"Ошибка при десериализации JSON с цветами панелей: {ex.Message}");
return null;
}
catch (Exception ex)
{
Console.WriteLine($"Произошла неожиданная ошибка при открытии файла с цветами панелей: {ex.Message}");
return null;
}
}
}
}

View File

@ -14,24 +14,27 @@ namespace GtaVUsersInfo.Sources
public int height; public int height;
public int leftPos; public int leftPos;
public int rightPos; public int rightPos;
public bool isFullScreen;
public string? prevFile; public string? prevFile;
public WindowParameters() { } public WindowParameters() { }
public WindowParameters(Size window, Size pos) public WindowParameters(Size window, Size pos, bool isfull)
{ {
width = window.Width; width = window.Width;
height = window.Height; height = window.Height;
leftPos = pos.Width; leftPos = pos.Width;
rightPos = pos.Height; rightPos = pos.Height;
isFullScreen = isfull;
} }
public WindowParameters(Size window, Size pos, string file) public WindowParameters(Size window, Size pos, bool isfull, string file)
{ {
width = window.Width; width = window.Width;
height = window.Height; height = window.Height;
leftPos = pos.Width; leftPos = pos.Width;
rightPos = pos.Height; rightPos = pos.Height;
isFullScreen = isfull;
prevFile = file; prevFile = file;
} }

View File

@ -1,6 +1,6 @@
{ {
"FontFamily": "Segoe UI", "FontFamily": "Segoe UI",
"FontSize": 72.0, "FontSize": 15.75,
"FontStyle": 0, "FontStyle": 0,
"FontColor": "64, 0, 64" "FontColor": "Black"
} }

View File

@ -0,0 +1,6 @@
{
"leftPanel": "Silver",
"rightPanel": "Silver",
"centerPanel": "Silver",
"upDownPanel": "128, 128, 192"
}

View File

@ -3,5 +3,6 @@
"height": 1026, "height": 1026,
"leftPos": 150, "leftPos": 150,
"rightPos": 181, "rightPos": 181,
"prevFile": "C:\\Users\\eugen\\YandexDisk\\Важное\\GTAV\\Карл.json" "isFullScreen": true,
"prevFile": "C:\\Users\\eugen\\YandexDisk\\БТШ\\Карл.json"
} }

View File

@ -1 +1 @@
8a6478b13bc7a79a0338eb465c5bca8fb9e4c8be cffc69186f6bcce96c6d04f34e1dc7e20a79c6a9