作成日: 2022/05/13 最終更新日: 2022/12/07
文書種別
不具合
発生環境
Visual Studio 2022
状況
修正済み
詳細
開発環境がVisual Studio 2022の場合、デザイン画面で以下のラッパーコントロールをツールボックスからフォームへ配置する際に「値が有効な範囲にありません」というエラーが表示され、コントロールを配置できない現象が発生します。
- 日付(Date)コントロール
- 数値(Number)コントロール
- タイムスパン(TimeSpan)コントロール
回避方法
Service Pack 1より前のバージョンでは次の方法で回避可能です。
コードでコントロールの配置を実装します。.Designer.vbまたは.Designer.csにコードを追加した後はデザイン画面での操作が可能になります。
◎サンプルコード(VB)
Private Sub InitializeComponent()
Me.Date1 = New GrapeCity.Win.Input.Interop.Date()
CType(Me.Date1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Date1
'
Me.Date1.Location = New System.Drawing.Point(0, 0)
Me.Date1.Name = "Date1"
Me.Date1.Size = New System.Drawing.Size(120, 20)
Me.Date1.TabIndex = 0
Me.Date1.Value = New GrapeCity.Win.Input.Interop.DateTimeEx(New System.DateTime(2022, 5, 13, 16, 49, 52, 304))
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(800, 450)
Me.Controls.Add(Me.Date1)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.Date1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents Date1 As GrapeCity.Win.Input.Interop.Date
◎サンプルコード(C#)
private void InitializeComponent()
{
this.date1 = new GrapeCity.Win.Input.Interop.Date();
((System.ComponentModel.ISupportInitialize)(this.date1)).BeginInit();
this.SuspendLayout();
//
// date1
//
this.date1.Location = new System.Drawing.Point(12, 12);
this.date1.Name = "date";
this.date1.Size = new System.Drawing.Size(120, 20);
this.date1.TabIndex = 0;
this.date1.Value = new GrapeCity.Win.Input.Interop.DateTimeEx(new System.DateTime(2022, 5, 13, 16, 49, 52, 304));
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.date1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.date1)).EndInit();
this.ResumeLayout(false);
}
private GrapeCity.Win.Input.Interop.Date date1;