GtaVUsersInfo/Controls/ParameterControl.cs

67 lines
1.5 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace GtaVUsersInfo.Controls
{
public partial class ParameterControl : UserControl
{
public string ParamName
{
get { return Label.Text.TrimEnd(':'); }
set { Label.Text = value + ':'; }
}
public string ParamText
{
get { return Textbox.Text; }
set { Textbox.Text = value; }
}
public ContextMenuStrip MenuStrip
{
get { return ContextMenuStrip; }
set { ContextMenuStrip = value; }
}
public ParameterControl()
{
InitializeComponent();
Label.Text = "";
Textbox.Text = "";
}
public ParameterControl(string name, string text = "")
{
InitializeComponent();
Label.Text = name + ':';
Textbox.Text = text;
}
public ParameterControl(Parameter parameter)
{
InitializeComponent();
Label.Text = parameter.Name + ':';
Textbox.Text = parameter.Text;
}
private void textBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter)
{
Label.Focus();
e.Handled = true;
}
}
}
}