public partial class displayvoltage : UserControl
{
public displayvoltage()
{
InitializeComponent();
if (!this.ratio_1.Checked && !this.ratio_12.Checked && !this.ratio_34.Checked && !this.ratio_14.Checked)
this.ratio_1.Checked = true;
}
public double Ratio
{
get
{
if (this.ratio_1.Checked) return 1.0;
if (this.ratio_1.Checked) return 4.0/3.0;
if (this.ratio_1.Checked) return 2.0;
return 4.0;
}
}
public int SetRatio
{
set
{
if (value == 1) this.ratio_1.Checked = true;
if (value == 2) this.ratio_34.Checked = true;
if (value == 3) this.ratio_12.Checked = true;
if (value == 4) this.ratio_14.Checked = true;
SetRatio = value;
}
}
[DefaultValue(0.0)]
public double Voltage
{
get { return Voltage * this.Ratio; }
set { Voltage = value; }
}
private bool DisplayVoltage = false;
private bool Pause = false;
private void ratio_CheckedChanged(object sender, EventArgs e)
{
RadioButton r = (RadioButton)sender;
if (r.Checked) Invalidate();
}
}
デザイナーだけで4つのラジオと1つのパネルで作成されました。 コントロールVSのプロパティを表示したい場合でも、プログラムを起動するとクラッシュします。何が問題なの?この単純なユーザー制御コードはVS2015をクラッシュさせます。理由は分かりません
私は取得のみでプロパティを持つことはできますか?
SetRatioとVoltageでスタックオーバーフロー例外を作成します。 VSがあなたのコントロールをロードすると、このコードを実行するとOSがシャットダウンします。 –