本文整理汇总了C#中System.Windows.Forms.ListControlConvertEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ListControlConvertEventArgs类的具体用法?C# ListControlConvertEventArgs怎么用?C# ListControlConvertEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListControlConvertEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了ListControlConvertEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDrawItem
protected override void OnDrawItem(DrawItemEventArgs e)
{
if (e.Index < 0)
{
base.OnDrawItem(e);
}
else
{
object listItem = this.Items[e.Index];
ListControlConvertEventArgs args = new ListControlConvertEventArgs(listItem.ToString(), typeof(string), listItem);
this.OnFormat(args);
string str = (string) args.Value;
if (!string.IsNullOrEmpty(str))
{
e.DrawBackground();
TextRenderer.DrawText(e.Graphics, str, e.Font, e.Bounds, e.ForeColor, TextFormatFlags.SingleLine | TextFormatFlags.VerticalCenter);
e.DrawFocusRectangle();
}
else
{
int num = e.Bounds.Top + (e.Bounds.Height / 2);
e.Graphics.DrawLine(SystemPens.ControlText, e.Bounds.Left, num, e.Bounds.Right, num);
}
}
}
示例2: OnCboActiveMouseButtonsFormat
private static void OnCboActiveMouseButtonsFormat(object sender, ListControlConvertEventArgs e)
{
if (e.DesiredType == typeof (string))
{
e.Value = TypeDescriptor.GetConverter(typeof (XMouseButtons)).ConvertToString(e.ListItem);
}
}
示例3: listBox1_Format
private void listBox1_Format(object sender, ListControlConvertEventArgs e)
{
string value1 = ((Article)e.ListItem).ID.ToString();
string value2 = ((Article)e.ListItem).Title.ToString();
string value3 = ((Article)e.ListItem).Price.ToString();
e.Value = "ID: " + value1 + "; TITLE: " + value2 + "; PRICE: " + value3;
}
示例4: OnFormat
protected override void OnFormat(ListControlConvertEventArgs e)
{
if ((e.ListItem is NamedFilter) && (e.DesiredType == typeof(string)))
{
e.Value = ((NamedFilter) e.ListItem).Name;
}
base.OnFormat(e);
}
示例5: ChangesListBoxFormat
private static void ChangesListBoxFormat(object sender, ListControlConvertEventArgs e)
{
CouchChangeResult change = e.ListItem as CouchChangeResult;
if ((change != null) && (change.Changes.Length >= 1))
{
e.Value = String.Format("{0:0000}\t{1}\t{2}", change.Sequence, change.Id, change.Changes[0].ToString());
}
}
示例6: FormatarLista
private void FormatarLista(object sender, ListControlConvertEventArgs e)
{
string nomeAtual = ((TblProduto)e.ListItem).Nome;
string precoAtual = string.Format("{0:C}", ((TblProduto)e.ListItem).Preco);
string currentDescriptionPadded = nomeAtual.PadRight(40);
e.Value = currentDescriptionPadded + precoAtual;
}
示例7: addOwnerComboBox_Format
/// <summary>
/// This function runs before each visible item in the addOwnerComboBox is formatted. It retrieves the owners full name and displays it in the combobox.
/// </summary>
/// <param name="sender">The object that called this function. In this case the ownerComboBox.</param>
/// <param name="e">The event arguments for the Format event passed to this function.</param>
private void addOwnerComboBox_Format(object sender, ListControlConvertEventArgs e)
{
int index;
if( int.TryParse(e.Value.ToString(), out index) )
{
index = index - 1;
DataRow ownerRow = dataModule.ownerDataTable.Rows[index];
e.Value = ownerRow["FirstName"] + " " + ownerRow["LastName"];
}
}
示例8: FormatPageSize
private void FormatPageSize(object sender, ListControlConvertEventArgs e)
{
if (e.ListItem is PageDimensions)
{
var pageDimensions = (PageDimensions)e.ListItem;
e.Value = string.Format(MiscResources.CustomPageSizeFormat, pageDimensions.Width, pageDimensions.Height, pageDimensions.Unit.Description());
}
else
{
e.Value = ((Enum)e.ListItem).Description();
}
}
示例9: controlBox_Format
private void controlBox_Format(object sender, ListControlConvertEventArgs e)
{
if (e.ListItem is string)
{
e.Value = "(whole window)";
}
else
{
WindowContent wc = ((SystemWindow)e.ListItem).Content;
e.Value = wc == null ? "<Unknown Type>" : wc.ShortDescription;
}
}
示例10: EFaceComboBox_Format
// 顔選択リストボックスの文字列変換
private void EFaceComboBox_Format(object sender, ListControlConvertEventArgs e)
{
//教育の顔選択肢がわかりやすい文字列になるようにする
switch ((TalkData.Face)e.ListItem)
{
case TalkData.Face.Angry:
e.Value = "怒り顔"; break;
case TalkData.Face.Cry:
e.Value = "泣き顔"; break;
case TalkData.Face.Normal:
e.Value = "ノーマル"; break;
case TalkData.Face.Smile:
e.Value = "笑顔"; break;
}
}
示例11: cbStudent_Format
private void cbStudent_Format(object sender, ListControlConvertEventArgs e)
{
string firstname = ((Student)e.ListItem).FirstName;
string lastname= ((Student)e.ListItem).LastName;
e.Value = lastname + ", " + firstname;
}
示例12: _folderSystems_Format
private void _folderSystems_Format(object sender, ListControlConvertEventArgs e)
{
e.Value = _component.FormatFolderSystem(e.ListItem);
}
示例13: lbCommands_Format
private void lbCommands_Format(object sender, ListControlConvertEventArgs e)
{
F3DEXCommand command = e.ListItem as F3DEXCommand;
e.Value = string.Format("{0}: {1}", string.Format("{0:X2}", (int)(e.ListItem as F3DEXCommand).CommandID), command.CommandID);
}
示例14: memberListBox_Format
private void memberListBox_Format(object sender, ListControlConvertEventArgs e)
{
if (e.ListItem is MemberItem) {
MemberItem item = e.ListItem as MemberItem;
e.Value = item.DisplayName;
}
}
示例15: SnapshotsListBox_Format
private void SnapshotsListBox_Format(object sender, ListControlConvertEventArgs e)
{
var item = e.ListItem as Snapshot;
e.Value = string.Format("({0}) {1} - {2} {3}", item.Id, item.Name, item.DateTime.ToLongTimeString(), item.DateTime.ToShortDateString());
}