private static void OnCboActiveMouseButtonsFormat(object sender, ListControlConvertEventArgs e) { if (e.DesiredType == typeof (string)) { e.Value = TypeDescriptor.GetConverter(typeof (XMouseButtons)).ConvertToString(e.ListItem); } }
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); } } }
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; }
protected override void OnFormat(ListControlConvertEventArgs e) { if ((e.ListItem is NamedFilter) && (e.DesiredType == typeof(string))) { e.Value = ((NamedFilter) e.ListItem).Name; } base.OnFormat(e); }
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()); } }
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; }
/// <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"]; } }
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(); } }
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; } }
// 顔選択リストボックスの文字列変換 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; } }
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()); }
private void _folderSystems_Format(object sender, ListControlConvertEventArgs e) { e.Value = _component.FormatFolderSystem(e.ListItem); }
private void lst_Format( object sender, ListControlConvertEventArgs e ) { e.Value = Path.GetFileName( e.ListItem as string ); }
private void memberListBox_Format(object sender, ListControlConvertEventArgs e) { if (e.ListItem is MemberItem) { MemberItem item = e.ListItem as MemberItem; e.Value = item.DisplayName; } }
protected virtual void OnFormat (ListControlConvertEventArgs e) { ListControlConvertEventHandler eh = (ListControlConvertEventHandler)(Events[FormatEvent]); if (eh != null) eh (this, e); }
private void cbo_Format(object sender, ListControlConvertEventArgs e) { e.Value = Path.GetFileName((string)e.ListItem); }
private void _launchModeCombo_Format(object sender, ListControlConvertEventArgs e) { var launcher = (LauncherInfo)e.ListItem; e.Value = launcher.DisplayName; }
private void OnListBoxFormat(object sender, ListControlConvertEventArgs e) { OnFormat(e); }
/// <include file='doc\ListControl.uex' path='docs/doc[@for="ListControl.OnFormat"]/*' /> protected virtual void OnFormat(ListControlConvertEventArgs e) { ListControlConvertEventHandler eh = Events[EVENT_FORMAT] as ListControlConvertEventHandler; if (eh != null) eh(this, e); }
private void lbEPSGCodes_Format(object sender, ListControlConvertEventArgs e) { KeyValuePair<int, string> item = (KeyValuePair<int, string>)e.ListItem; e.Value = string.Format("{0} ({1})", item.Value, item.Key); }
private void ddlOwner_Format(object sender, ListControlConvertEventArgs e) { DataRow r = ((DataRowView)e.ListItem).Row; e.Value = r["OwnerLname"] + " , " + r["OwnerFname"]; }
void playlistsCLB_Format(object sender, ListControlConvertEventArgs e) { e.Value = ((Playlist)e.ListItem)["Name"]; }
private void _comboBox_Format(object sender, ListControlConvertEventArgs e) { e.Value = _editor.FormatItem(e.ListItem); }
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); }
public string GetItemText (object item) { object o = FilterItemOnProperty (item, DisplayMember); if (o == null) o = item; string retval = o.ToString (); if (FormattingEnabled) { ListControlConvertEventArgs e = new ListControlConvertEventArgs (o, typeof (string), item); OnFormat (e); // The user provided their own value if (e.Value.ToString () != retval) return e.Value.ToString (); if (o is IFormattable) return ((IFormattable)o).ToString (string.IsNullOrEmpty (FormatString) ? null : FormatString, FormatInfo); } return retval; }
private void FormatOrderItem(object sender, ListControlConvertEventArgs e) { if (listBoxOrder.Items.Count > 0) { string restaurantItemName = ((IRestaurantItem)e.ListItem).Name; string restaurantItemPrice = string.Format("{0:c}", ((IRestaurantItem)e.ListItem).Price); string restaurantItemNamePadded = restaurantItemName.PadRight(15); // set padding on the right e.Value = restaurantItemNamePadded + restaurantItemPrice; } }
/// <summary> /// Raises the Format event. /// </summary> /// <param name="e">An EventArgs containing the event data.</param> protected virtual void OnFormat(ListControlConvertEventArgs e) { if (Format != null) Format(this, e); }
void songsCLB_Format(object sender, ListControlConvertEventArgs e) { JObject song = (JObject)e.ListItem; if (song.ContainsKey("Empty")) { e.Value = "Loading..."; return; } string str = (string)song["ArtistName"] + " - " + (string)song["Name"] + ".mp3"; if(song.ContainsKey("Status")) str += " [" + song["Status"] + "]"; if (song.ContainsKey("Percentage")) str += " ("+song["Percentage"].ToString()+"%) "+ /* song["Downloaded"]+"/"+song["Total"] + " "*/ + (int)((double)song["Rate"])+ " kb/sec"; e.Value = str; }
private void cbStudent_Format(object sender, ListControlConvertEventArgs e) { string firstname = ((Student)e.ListItem).FirstName; string lastname= ((Student)e.ListItem).LastName; e.Value = lastname + ", " + firstname; }
private void cmb_sysid_Format(object sender, ListControlConvertEventArgs e) { e.Value = MainV2.comPort.MAVlist[(int) e.Value/256, (int) e.Value%256].aptype.ToString() + "-" + ((int) e.Value%256); }
private void cbClass_Format(object sender, ListControlConvertEventArgs e) { string prefix = ((Class)e.ListItem).Prefix; string suffix = ((Class)e.ListItem).Suffix; e.Value = prefix + suffix; }