本文整理汇总了C#中OLVColumn.GetStringValue方法的典型用法代码示例。如果您正苦于以下问题:C# OLVColumn.GetStringValue方法的具体用法?C# OLVColumn.GetStringValue怎么用?C# OLVColumn.GetStringValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OLVColumn
的用法示例。
在下文中一共展示了OLVColumn.GetStringValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AutoCompleteCellEditor
/// <summary>
/// Create an AutoCompleteCellEditor
/// </summary>
/// <param name="lv"></param>
/// <param name="column"></param>
public AutoCompleteCellEditor(ObjectListView lv, OLVColumn column)
{
this.DropDownStyle = ComboBoxStyle.DropDown;
Dictionary<String, bool> alreadySeen = new Dictionary<string, bool>();
for (int i = 0; i < Math.Min(lv.GetItemCount(), 1000); i++) {
String str = column.GetStringValue(lv.GetModelObject(i));
if (!alreadySeen.ContainsKey(str)) {
this.Items.Add(str);
alreadySeen[str] = true;
}
}
this.Sorted = true;
this.AutoCompleteSource = AutoCompleteSource.ListItems;
this.AutoCompleteMode = AutoCompleteMode.Append;
}
示例2: FindMatchInRange
/// <summary>
/// Find the first row in the given range of rows that prefix matches the string value of the given column.
/// </summary>
/// <param name="text"></param>
/// <param name="first"></param>
/// <param name="last"></param>
/// <param name="column"></param>
/// <returns>The index of the matched row, or -1</returns>
protected virtual int FindMatchInRange(string text, int first, int last, OLVColumn column)
{
if (first <= last) {
for (int i = first; i <= last; i++) {
string data = column.GetStringValue(this.GetNthItemInDisplayOrder(i).RowObject);
if (data.StartsWith(text, StringComparison.CurrentCultureIgnoreCase))
return i;
}
} else {
for (int i = first; i >= last; i--) {
string data = column.GetStringValue(this.GetNthItemInDisplayOrder(i).RowObject);
if (data.StartsWith(text, StringComparison.CurrentCultureIgnoreCase))
return i;
}
}
return -1;
}
示例3: ConfigureAutoComplete
/// <summary>
/// Configure the given text box to autocomplete unique values
/// from the given column. At most 1000 rows will be considered.
/// </summary>
/// <param name="tb">The textbox to configure</param>
/// <param name="column">The column used to calculate values</param>
/// <param name="maxRows">Consider only this many rows</param>
public void ConfigureAutoComplete(TextBox tb, OLVColumn column, int maxRows)
{
// Don't consider more rows than we actually have
maxRows = Math.Min(this.GetItemCount(), maxRows);
// Reset any existing autocomplete
tb.AutoCompleteCustomSource.Clear();
// CONSIDER: Should we use ClusteringStrategy here?
// Build a list of unique values, to be used as autocomplete on the editor
Dictionary<string, bool> alreadySeen = new Dictionary<string, bool>();
List<string> values = new List<string>();
for (int i = 0; i < maxRows; i++) {
string valueAsString = column.GetStringValue(this.GetModelObject(i));
if (!String.IsNullOrEmpty(valueAsString) && !alreadySeen.ContainsKey(valueAsString)) {
values.Add(valueAsString);
alreadySeen[valueAsString] = true;
}
}
tb.AutoCompleteCustomSource.AddRange(values.ToArray());
tb.AutoCompleteSource = AutoCompleteSource.CustomSource;
tb.AutoCompleteMode = column.AutoCompleteEditorMode;
}
示例4: DefaultSearchText
/// <summary>
/// This is a useful default implementation of SearchText method, intended to be called
/// by implementors of IVirtualListDataSource.
/// </summary>
/// <param name="value"></param>
/// <param name="first"></param>
/// <param name="last"></param>
/// <param name="column"></param>
/// <param name="source"></param>
/// <returns></returns>
static public int DefaultSearchText(string value, int first, int last, OLVColumn column, IVirtualListDataSource source) {
if (first <= last) {
for (int i = first; i <= last; i++) {
string data = column.GetStringValue(source.GetNthObject(i));
if (data.StartsWith(value, StringComparison.CurrentCultureIgnoreCase))
return i;
}
} else {
for (int i = first; i >= last; i--) {
string data = column.GetStringValue(source.GetNthObject(i));
if (data.StartsWith(value, StringComparison.CurrentCultureIgnoreCase))
return i;
}
}
return -1;
}
示例5: SearchText
/// <summary>
///
/// </summary>
/// <param name="text"></param>
/// <param name="first"></param>
/// <param name="last"></param>
/// <param name="column"></param>
/// <returns></returns>
public override int SearchText(string text, int first, int last, OLVColumn column)
{
if (first <= last) {
for (int i = first; i <= last; i++) {
string data = column.GetStringValue(this.listView.GetNthItemInDisplayOrder(i).RowObject);
if (data.StartsWith(text, StringComparison.CurrentCultureIgnoreCase))
return i;
}
} else {
for (int i = first; i >= last; i--) {
string data = column.GetStringValue(this.listView.GetNthItemInDisplayOrder(i).RowObject);
if (data.StartsWith(text, StringComparison.CurrentCultureIgnoreCase))
return i;
}
}
return -1;
}