Промежуточное.

This commit is contained in:
ElEgEv 2023-09-13 12:53:53 +04:00
parent 8666b365b0
commit bf736e563d
6 changed files with 190 additions and 56 deletions

View File

@ -28,10 +28,58 @@
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
dataGridView = new DataGridView();
buttonAdd = new Button();
buttonClear = new Button();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// dataGridView
//
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Location = new Point(3, 3);
dataGridView.Name = "dataGridView";
dataGridView.RowTemplate.Height = 25;
dataGridView.Size = new Size(417, 459);
dataGridView.TabIndex = 0;
//
// buttonAdd
//
buttonAdd.Location = new Point(446, 23);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(123, 23);
buttonAdd.TabIndex = 1;
buttonAdd.Text = "Добавить значение";
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// buttonClear
//
buttonClear.Location = new Point(446, 76);
buttonClear.Name = "buttonClear";
buttonClear.Size = new Size(123, 23);
buttonClear.TabIndex = 2;
buttonClear.Text = "Очистить всё";
buttonClear.UseVisualStyleBackColor = true;
buttonClear.Click += ButtonClear_Click;
//
// UserDataGridView
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(buttonClear);
Controls.Add(buttonAdd);
Controls.Add(dataGridView);
Name = "UserDataGridView";
Size = new Size(598, 465);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView;
private Button buttonAdd;
private Button buttonClear;
}
}

View File

@ -12,9 +12,22 @@ namespace VisualComponentsLib
{
public partial class UserDataGridView : UserControl
{
public UserDataGridView()
{
InitializeComponent();
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
}
//полная очистка
private void ButtonClear_Click(object sender, EventArgs e)
{
dataGridView.Rows.Clear();
}
}
}

View File

@ -18,7 +18,7 @@
<resheader name="reader">System.Resources.ResXResourceReader, 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="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">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>

View File

@ -28,10 +28,42 @@
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
checkBox = new CheckBox();
textBox = new TextBox();
SuspendLayout();
//
// checkBox
//
checkBox.AutoSize = true;
checkBox.Location = new Point(14, 52);
checkBox.Name = "checkBox";
checkBox.Size = new Size(104, 19);
checkBox.TabIndex = 0;
checkBox.Text = "Включить null";
checkBox.UseVisualStyleBackColor = true;
//
// textBox
//
textBox.Location = new Point(14, 12);
textBox.Name = "textBox";
textBox.Size = new Size(182, 23);
textBox.TabIndex = 2;
//
// UserTextBox
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(textBox);
Controls.Add(checkBox);
Name = "UserTextBox";
Size = new Size(210, 80);
ResumeLayout(false);
PerformLayout();
}
#endregion
private CheckBox checkBox;
private TextBox textBox;
}
}

View File

@ -12,9 +12,50 @@ namespace VisualComponentsLib
{
public partial class UserTextBox : UserControl
{
public string inputString
{
get => textBox.Text;
set => textBox.Text = value;
}
public new event EventHandler? TextChanged
{
add => textBox.Text = value.ToString();
remove => textBox.Text = string.Empty;
}
public UserTextBox()
{
InitializeComponent();
}
public void clickCheckBox()
{
if(checkBox.Checked)
{
textBox.ReadOnly = true;
inputString = string.Empty;
textBox.Text = string.Empty;
}
if(!checkBox.Checked)
{
try
{
double support;
if (Double.TryParse(textBox.Text, out support))
{
inputString = textBox.Text;
}
}
catch (Exception ex)
{
MessageBox.Show("Введённое значение не является вещественным числом.");
}
}
}
}
}

View File

@ -18,7 +18,7 @@
<resheader name="reader">System.Resources.ResXResourceReader, 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="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">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>