作成日: 2021/02/16 最終更新日: 2021/02/16
文書種別
使用方法
詳細
C1ComboBoxのドロップダウン項目に、単位の付いた値を表示するには、ItemModeプロパティに「HtmlPattern」を指定し、HtmlPatternプロパティに単位を含むHTML表現を設定します。
また、ドロップダウンリストの項目選択後に、TextBox部分に表示されるテキストにも単位を付加するには、SelectedIndexChangedイベントにて、SelectedItemのテキストに単位となる文字列を追加します。
◎サンプルコード(VB)
また、ドロップダウンリストの項目選択後に、TextBox部分に表示されるテキストにも単位を付加するには、SelectedIndexChangedイベントにて、SelectedItemのテキストに単位となる文字列を追加します。
◎サンプルコード(VB)
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
C1ComboBox1.TextDetached = True
C1ComboBox1.ItemMode = C1.Win.C1Input.ComboItemMode.HtmlPattern
C1ComboBox1.HtmlPattern = "<table><tr><td>{Text} 個</td></tr></table>"
C1ComboBox1.Items.AddRange(New String() {"10", "20", "30"})
C1ComboBox1.SelectedIndex = 0
End Sub
Private Sub C1ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles C1ComboBox1.SelectedIndexChanged
If C1ComboBox1.SelectedItem IsNot Nothing Then
C1ComboBox1.Text = C1ComboBox1.SelectedItem.ToString() + " 個"
End If
End Sub
End Class
◎サンプルコード(C#) public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
c1ComboBox1.TextDetached = true;
c1ComboBox1.ItemMode = C1.Win.C1Input.ComboItemMode.HtmlPattern;
c1ComboBox1.HtmlPattern = "<table><tr><td>{Text} 個</td></tr></table>";
c1ComboBox1.Items.AddRange(new string[] { "10", "20", "30" });
c1ComboBox1.SelectedIndex = 0;
}
private void c1ComboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (c1ComboBox1.SelectedItem != null)
{
c1ComboBox1.Text = c1ComboBox1.SelectedItem.ToString() + " 個";
}
}
}
旧文書番号
86414