本文整理汇总了C#中OLVColumn类的典型用法代码示例。如果您正苦于以下问题:C# OLVColumn类的具体用法?C# OLVColumn怎么用?C# OLVColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OLVColumn类属于命名空间,在下文中一共展示了OLVColumn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeTreeList
private void InitializeTreeList()
{
PluginTree.MultiSelect = true;
PluginTree.CanExpandGetter = x => (x is IGroupRecord);
PluginTree.ChildrenGetter = x =>
{
var r = x as IGroupRecord;
return (r != null) ? r.Records : null;
};
_olvColumnName = new OLVColumn("Name", "Name");
PluginTree.Columns.Add(_olvColumnName);
_olvColumnName.AspectGetter = x =>
{
var r = x as IRecord;
return (r != null) ? r.DescriptiveName : x;
};
var sink1 = (SimpleDropSink) PluginTree.DropSink;
sink1.AcceptExternal = false;
sink1.CanDropBetween = true;
sink1.CanDropOnBackground = false;
sink1.CanDropOnSubItem = false;
UpdateRoots();
}
示例2: AddColumnForOlv
public static void AddColumnForOlv(Type type, ObjectListView olv)
{
olv.Columns.Clear();
olv.AllColumns.Clear();
var lColumn = ReflectionUtils.PropertysFromType(type);
var i = 0;
foreach (var colN in lColumn)
{
var col = new OLVColumn();
col.AspectName = colN.Name;
col.DisplayIndex = i++;
col.Text = colN.Name;
col.IsEditable = true;
if (colN.PropertyType.FullName == "System.Boolean")
{
col.CheckBoxes = true;
}
if (colN.PropertyType.FullName == "System.Single")
{
var colName = colN.Name;
col.AspectPutter = delegate(Object row, Object newvalue)
{
ReflectionUtils.SetPropertyInternal(row, colName, float.Parse(newvalue.ToString()));
};
}
olv.AllColumns.Add(col);
olv.Columns.Add(col);
}
}
示例3: MakeColumnFromAttribute
private static OLVColumn MakeColumnFromAttribute(string aspectName, OLVColumnAttribute attr, bool editable) {
string title = String.IsNullOrEmpty(attr.Title) ? aspectName : attr.Title;
OLVColumn column = new OLVColumn(title, aspectName);
column.AspectToStringFormat = attr.AspectToStringFormat;
column.CheckBoxes = attr.CheckBoxes;
column.DisplayIndex = attr.DisplayIndex;
column.FillsFreeSpace = attr.FillsFreeSpace;
if (attr.FreeSpaceProportion.HasValue)
column.FreeSpaceProportion = attr.FreeSpaceProportion.Value;
column.GroupWithItemCountFormat = attr.GroupWithItemCountFormat;
column.GroupWithItemCountSingularFormat = attr.GroupWithItemCountSingularFormat;
column.Hyperlink = attr.Hyperlink;
column.ImageAspectName = attr.ImageAspectName;
if (attr.IsEditableSet)
column.IsEditable = attr.IsEditable;
else
column.IsEditable = editable;
column.IsTileViewColumn = attr.IsTileViewColumn;
column.IsVisible = attr.IsVisible;
column.MaximumWidth = attr.MaximumWidth;
column.MinimumWidth = attr.MinimumWidth;
column.Name = String.IsNullOrEmpty(attr.Name) ? aspectName : attr.Name;
column.Tag = attr.Tag;
column.TextAlign = attr.TextAlign;
column.ToolTipText = attr.ToolTipText;
column.TriStateCheckBoxes = attr.TriStateCheckBoxes;
column.UseInitialLetterForGroup = attr.UseInitialLetterForGroup;
column.Width = attr.Width;
if (attr.GroupCutoffs != null && attr.GroupDescriptions != null)
column.MakeGroupies(attr.GroupCutoffs, attr.GroupDescriptions);
return column;
}
示例4: AddListColumn
/// <summary>
/// Helper method for GenerateListColumns()
/// </summary>
/// <param name="objectListView"></param>
/// <param name="data"></param>
public static void AddListColumn(ObjectListView objectListView, string name, string aspect)
{
OLVColumn columnHeader = new OLVColumn();
columnHeader.Text = name;
columnHeader.AspectName = aspect;
objectListView.Columns.Add(columnHeader);
}
示例5: InitializeTreeList
private void InitializeTreeList()
{
this.filterTree.SelectionChanged += this.filterTree_SelectionChanged;
this.filterTree.SelectedIndexChanged += this.filterTree_SelectedIndexChanged;
this.filterTree.SizeChanged += this.filterTree_SizeChanged;
this.filterTree.Enter += this.filterTree_Enter;
this.filterTree.KeyDown += this.filterTree_KeyDown;
this.filterTree.MouseDoubleClick += this.filterTree_MouseDoubleClick;
filterTree.MultiSelect = true;
filterTree.CanExpandGetter = x => (x is ColumnSubrecord);
filterTree.ChildrenGetter = x =>
{
var r = x as ColumnSubrecord;
return (r != null) ? r.Children : null;
};
olvColumnName = new OLVColumn
{
Name = "Name", Text = "Name", AspectName = "Name", Width = 175, IsVisible = true, IsEditable = false,
AspectGetter = x => { var r = x as ColumnCriteria; return (r != null) ? r.Name : x;}
};
filterTree.Columns.Add(olvColumnName);
filterTree.CellEditActivation = ObjectListView.CellEditActivateMode.SingleClick;
filterTree.Roots = filterTree.Roots;
var checkedItems = new ArrayList();
if (this.Criteria != null)
{
var modelItems = filterTree.Roots.OfType<ColumnSubrecord>();
foreach (var item in this.Criteria.Items.OfType<ColumnSubrecord>())
{
var modelItem = modelItems.FirstOrDefault(x => x.Name == item.Name);
if (modelItem != null)
{
modelItem.Checked = true;
}
}
foreach (var item in this.Criteria.Items.OfType<ColumnElement>())
{
var modelItem = modelItems.FirstOrDefault(x => x.Name == item.Parent.Name);
if (modelItem != null)
{
filterTree.Expand(modelItem);
var modelElem = modelItem.Children.FirstOrDefault(x => x.Name == item.Name);
if (modelElem != null)
{
modelElem.Checked = true;
checkedItems.Add(modelElem);
}
}
}
this.filterTree.CheckObjects(checkedItems);
}
}
示例6: InitializeTreeList
private void InitializeTreeList()
{
this.filterTree.ModelCanDrop += this.filterTree_ModelCanDrop;
this.filterTree.ModelDropped += this.filterTree_ModelDropped;
this.filterTree.SelectionChanged += this.filterTree_SelectionChanged;
this.filterTree.SelectedIndexChanged += this.filterTree_SelectedIndexChanged;
this.filterTree.SizeChanged += this.filterTree_SizeChanged;
this.filterTree.Enter += this.filterTree_Enter;
this.filterTree.KeyDown += this.filterTree_KeyDown;
this.filterTree.MouseDoubleClick += this.filterTree_MouseDoubleClick;
filterTree.MultiSelect = true;
filterTree.CanExpandGetter = x => (x is SearchSubrecord);
filterTree.ChildrenGetter = x =>
{
var r = x as SearchSubrecord;
return (r != null) ? r.Children : null;
};
olvColumnName = new OLVColumn
{
Name = "Name", Text = "Name", AspectName = "Name", Width = 175, IsVisible = true, IsEditable = false,
AspectGetter = x => { var r = x as SearchCriteria; return (r != null) ? r.Name : x;}
};
olvColumnCond = new OLVColumn
{
Name = "Cond", Text = "Cond", AspectName = "Cond", Width = 100, IsVisible = true, IsEditable = true,
AspectGetter = x => (x is SearchSubrecord) ? (object)((SearchSubrecord)x).Type : (x is SearchElement) ? (object)((SearchElement)x).Type : null,
AspectPutter = (x,v) =>
{
if (x is SearchSubrecord) ((SearchSubrecord) x).Type = (SearchCondRecordType) v;
if (x is SearchElement) ((SearchElement) x).Type = (SearchCondElementType) v;
},
};
olvColumnValue = new OLVColumn
{
Name = "Value", Text = "Value", AspectName = "Value", Width = 100, IsVisible = true, IsEditable = true,
AspectGetter = x => { var r = x as SearchElement; return (r != null) ? r.Value : null; }
};
filterTree.Columns.Add(olvColumnName);
filterTree.Columns.Add(olvColumnCond);
filterTree.Columns.Add(olvColumnValue);
filterTree.CellEditActivation = ObjectListView.CellEditActivateMode.SingleClick;
var sink1 = (SimpleDropSink)filterTree.DropSink;
sink1.AcceptExternal = false;
sink1.CanDropBetween = true;
sink1.CanDropOnBackground = false;
sink1.CanDropOnSubItem = false;
filterTree.Roots = filterTree.Roots;
}
示例7: GroupingParameters
/// <summary>
/// Create a GroupingParameters
/// </summary>
/// <param name="olv"></param>
/// <param name="groupByColumn"></param>
/// <param name="groupByOrder"></param>
/// <param name="column"></param>
/// <param name="order"></param>
/// <param name="secondaryColumn"></param>
/// <param name="secondaryOrder"></param>
/// <param name="titleFormat"></param>
/// <param name="titleSingularFormat"></param>
/// <param name="sortItemsByPrimaryColumn"></param>
public GroupingParameters(ObjectListView olv, OLVColumn groupByColumn, SortOrder groupByOrder,
OLVColumn column, SortOrder order, OLVColumn secondaryColumn, SortOrder secondaryOrder,
string titleFormat, string titleSingularFormat, bool sortItemsByPrimaryColumn) {
this.ListView = olv;
this.GroupByColumn = groupByColumn;
this.GroupByOrder = groupByOrder;
this.PrimarySort = column;
this.PrimarySortOrder = order;
this.SecondarySort = secondaryColumn;
this.SecondarySortOrder = secondaryOrder;
this.SortItemsByPrimaryColumn = sortItemsByPrimaryColumn;
this.TitleFormat = titleFormat;
this.TitleSingularFormat = titleSingularFormat;
}
示例8: Form1
public Form1()
{
InitializeComponent();
this.Text = Properties.Resources.AppTitleLong;
this.Icon = Properties.Resources.Ryder25;
this.openFileDialog.Filter = "Big files|*.big|All files|*.*";
this.saveFileDialog.Filter = "Big files|*.big|All files|*.*";
this.entriesObjectListView.ShowGroups = false;
this.entriesObjectListView.FullRowSelect = true;
this.entriesObjectListView.CellEditActivation = ObjectListView.CellEditActivateMode.DoubleClick;
OLVColumn nameCol = new OLVColumn("Name", "Name");
nameCol.Width = 225;
nameCol.IsEditable = false;
this.entriesObjectListView.Columns.Add(nameCol);
OLVColumn fileTypeCol = new OLVColumn("File Type", "Type");
fileTypeCol.Width = 150;
fileTypeCol.IsEditable = false;
this.entriesObjectListView.Columns.Add(fileTypeCol);
OLVColumn sizeCol = new OLVColumn("Size", "Size");
sizeCol.Width = 100;
sizeCol.IsEditable = false;
this.entriesObjectListView.Columns.Add(sizeCol);
OLVColumn pSizeCol = new OLVColumn("Packed Size", "CompressedSize");
pSizeCol.Width = 100;
pSizeCol.IsEditable = false;
this.entriesObjectListView.Columns.Add(pSizeCol);
OLVColumn fullPathCol = new OLVColumn("Full Path", "FileName");
//fullPathCol.Width = 500;
fullPathCol.FillsFreeSpace = true;
fullPathCol.IsEditable = false;
this.entriesObjectListView.Columns.Add(fullPathCol);
//string expPath = @"C:\Games\Rise Of Legends\BIGS\exp";
//foreach (string bigFileName in Directory.GetFiles(@"C:\Games\Rise Of Legends\BIGS", "*.big", SearchOption.TopDirectoryOnly))
//{
// //MessageBox.Show(bigFileName);
// this.file = new BigFile();
// this.file.Read(File.Open(bigFileName, FileMode.Open, FileAccess.Read, FileShare.Read));
// file.Export(expPath);
//}
//MessageBox.Show("Success");
}
示例9: InitializationOLVCOlumn
/// <summary>
/// 1.2.初始化一个栏位
/// </summary>
/// <param name="Title">显示的名称</param>
/// <param name="aspect">名称代码</param>
/// <param name="Name">栏位名称</param>
/// <param name="alig">对齐方式</param>
/// <param name="bolleter">超出界限部分是否显示省略号</param>
/// <param name="with">栏位宽度</param>
/// <param name="columnobj">栏位对象</param>
/// <param name="isSHow">是否显示</param>
private OLVColumn InitializationOLVCOlumn(string Title, string aspect, string Name, HorizontalAlignment alig, bool bolleter, int with, object columnobj, bool isSHow,ObjectListView listview,IListViewColumnFormater _formater)
{
OLVColumn newcolumn = new OLVColumn();
newcolumn.HeaderTextAlign = alig;
newcolumn.UseInitialLetterForGroup = bolleter;
newcolumn.Text = Title;
newcolumn.Name = Name;
newcolumn.Width = with;
newcolumn.Tag = columnobj;
newcolumn.IsVisible = isSHow;//是否显示
_formater.Formater(listview,newcolumn, isSHow);
return newcolumn;
}
示例10: 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;
}
示例11: openToolStripMenuItem_Click
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.openFileDialog.ShowDialog() == DialogResult.OK)
{
this.file.Read(File.Open(openFileDialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read));
OLVColumn nameCol = new OLVColumn("Name", string.Empty);
nameCol.Width = 325;
nameCol.IsEditable = false;
nameCol.AspectGetter = delegate(object rowObject)
{
if (rowObject is ErpEntry)
{
string str = ((ErpEntry)rowObject).FileName.Substring(7).Replace("/", "\\");
return Path.GetFileName(((ErpEntry)rowObject).FileName);//.Substring(7));
}
else if (rowObject is ErpResource)
{
return ((ErpResource)rowObject).Name;
}
return string.Empty;
};
this.TreeListView.Columns.Add(nameCol);
OLVColumn fileTypeCol = new OLVColumn("File Type", "EntryType");
fileTypeCol.Width = 150;
this.TreeListView.Columns.Add(fileTypeCol);
OLVColumn sizeCol = new OLVColumn("Size", "Size");
sizeCol.Width = 100;
sizeCol.IsEditable = false;
this.TreeListView.Columns.Add(sizeCol);
OLVColumn pSizeCol = new OLVColumn("Packed Size", "PackedSize");
pSizeCol.Width = 100;
pSizeCol.IsEditable = false;
this.TreeListView.Columns.Add(pSizeCol);
this.TreeListView.SetObjects(this.file.Entries);
}
}
示例12: Form1
public Form1(string[] Args)
{
InitializeComponent();
this.Icon = EgoJpkArchiver.Properties.Resources.Ryder25;
this.Text = EgoJpkArchiver.Properties.Resources.AppTitleLong + " " + EgoJpkArchiver.Properties.Resources.AppVersionShort;
this.listView.ShowGroups = false;
OLVColumn nameCol = new OLVColumn("Name", "Name");
nameCol.Width = 300;
nameCol.IsEditable = false;
this.listView.Columns.Add(nameCol);
OLVColumn sizeCol = new OLVColumn("Size", "Size");
sizeCol.Width = 100;
sizeCol.IsEditable = false;
this.listView.Columns.Add(sizeCol);
if (Args.Length > 0)
{
fileName = Args[0];
this.ReadJpk();
}
}
示例13: CollectGroupingParameters
/// <summary>
/// Collect and return all the variables that influence the creation of groups
/// </summary>
/// <returns></returns>
protected virtual GroupingParameters CollectGroupingParameters(OLVColumn groupByColumn, SortOrder groupByOrder,
OLVColumn column, SortOrder order, OLVColumn secondaryColumn, SortOrder secondaryOrder)
{
string titleFormat = this.ShowItemCountOnGroups ? groupByColumn.GroupWithItemCountFormatOrDefault : null;
string titleSingularFormat = this.ShowItemCountOnGroups ? groupByColumn.GroupWithItemCountSingularFormatOrDefault : null;
GroupingParameters parms = new GroupingParameters(this, groupByColumn, groupByOrder,
column, order, secondaryColumn, secondaryOrder,
titleFormat, titleSingularFormat, this.SortGroupItemsByPrimaryColumn);
return parms;
}
示例14: GetFirstNonNullValue
/// <summary>
/// Get the first non-null value of the given column.
/// At most 1000 rows will be considered.
/// </summary>
/// <param name="column"></param>
/// <returns>The first non-null value, or null if no non-null values were found</returns>
internal object GetFirstNonNullValue(OLVColumn column)
{
for (int i = 0; i < Math.Min(this.GetItemCount(), 1000); i++) {
object value = column.GetValue(this.GetModelObject(i));
if (value != null)
return value;
}
return null;
}
示例15: UncheckSubItem
/// <summary>
/// Uncheck the check at the given cell
/// </summary>
/// <param name="rowObject"></param>
/// <param name="column"></param>
public virtual void UncheckSubItem(object rowObject, OLVColumn column)
{
if (column == null || rowObject == null || !column.CheckBoxes)
return;
column.PutCheckState(rowObject, CheckState.Unchecked);
this.RefreshObject(rowObject);
}