本文整理汇总了C#中BrightIdeasSoftware.OLVListItem类的典型用法代码示例。如果您正苦于以下问题:C# OLVListItem类的具体用法?C# OLVListItem怎么用?C# OLVListItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OLVListItem类属于BrightIdeasSoftware命名空间,在下文中一共展示了OLVListItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FormatRow
private static void FormatRow(OLVListItem item)
{
var installment = (Installment)item.RowObject;
if (installment == null) return;
if (installment.IsPending) item.BackColor = Color.Orange;
if (installment.IsRepaid) item.BackColor = Color.FromArgb(61, 153, 57);
if (installment.IsPending || installment.IsRepaid) item.ForeColor = Color.White;
}
开发者ID:jay3126,项目名称:opencbs,代码行数:8,代码来源:ScheduleControl.cs
示例2: CalculateItemBounds
/// <summary>
/// Given the item and the subitem, calculate its bounds.
/// </summary>
/// <param name="item"></param>
/// <param name="subItem"></param>
/// <returns></returns>
public Rectangle CalculateItemBounds(OLVListItem item, OLVListSubItem subItem) {
if (item == null)
return Rectangle.Empty;
if (subItem == null)
return item.Bounds;
else
return item.GetSubItemBounds(item.SubItems.IndexOf(subItem));
}
开发者ID:VicBoss,项目名称:KR,代码行数:15,代码来源:Adornments.cs
示例3: ApplyHyperlinkStyle
private void ApplyHyperlinkStyle(int rowIndex, OLVListItem olvi)
{
olvi.UseItemStyleForSubItems = false;
// If subitem 0 is given a back color, the item back color is changed too.
// So we have to remember it here so we can used it even if subitem 0 is changed.
Color itemBackColor = olvi.BackColor;
for (int i = 0; i < this.Columns.Count; i++) {
OLVListSubItem subItem = olvi.GetSubItem(i);
if (subItem == null)
continue;
OLVColumn column = this.GetColumn(i);
subItem.BackColor = itemBackColor;
if (column.Hyperlink && !String.IsNullOrEmpty(subItem.Url)) {
if (this.IsUrlVisited(subItem.Url))
this.ApplyCellStyle(olvi, i, this.HyperlinkStyle.Visited);
else
this.ApplyCellStyle(olvi, i, this.HyperlinkStyle.Normal);
}
}
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:22,代码来源:ObjectListView.cs
示例4: UpdateHotRow
/// <summary>
/// Update the given row using the current hot item information
/// </summary>
/// <param name="olvi"></param>
protected virtual void UpdateHotRow(OLVListItem olvi)
{
this.UpdateHotRow(this.HotRowIndex, this.HotColumnIndex, this.HotCellHitLocation, olvi);
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:8,代码来源:ObjectListView.cs
示例5: SetSubItemImages
/// <summary>
/// Tell the underlying list control which images to show against the subitems
/// </summary>
/// <param name="rowIndex">the index at which the item occurs</param>
/// <param name="item">the item whose subitems are to be set</param>
/// <param name="shouldClearImages">will existing images be cleared if no new image is provided?</param>
protected virtual void SetSubItemImages(int rowIndex, OLVListItem item, bool shouldClearImages)
{
if (!this.ShowImagesOnSubItems || this.OwnerDraw)
return;
for (int i = 1; i < item.SubItems.Count; i++) {
this.SetSubItemImage(rowIndex, i, item.GetSubItem(i), shouldClearImages);
}
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:15,代码来源:ObjectListView.cs
示例6: PostProcessOneRow
/// <summary>
/// Do the work required after one item in a listview have been created
/// </summary>
protected virtual void PostProcessOneRow(int rowIndex, int displayIndex, OLVListItem olvi)
{
if (this.UseAlternatingBackColors && this.View == View.Details) {
if (displayIndex % 2 == 1) {
olvi.BackColor = this.AlternateRowBackColorOrDefault;
} else {
olvi.BackColor = this.BackColor;
}
}
if (this.ShowImagesOnSubItems && !this.VirtualMode) {
this.SetSubItemImages(rowIndex, olvi);
}
if (this.UseHyperlinks) {
this.ApplyHyperlinkStyle(rowIndex, olvi);
}
this.TriggerFormatRowEvent(rowIndex, displayIndex, olvi);
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:20,代码来源:ObjectListView.cs
示例7: FillInValues
/// <summary>
/// Fill in the given OLVListItem with values of the given row
/// </summary>
/// <param name="lvi">the OLVListItem that is to be stuff with values</param>
/// <param name="rowObject">the model object from which values will be taken</param>
protected virtual void FillInValues(OLVListItem lvi, object rowObject)
{
if (this.Columns.Count == 0)
return;
OLVListSubItem subItem = this.MakeSubItem(rowObject, this.GetColumn(0));
lvi.SubItems[0] = subItem;
lvi.ImageSelector = subItem.ImageSelector;
// Only Details and Tile views have subitems
if (this.View == View.Details) {
for (int i = 1; i < this.Columns.Count; i++) {
lvi.SubItems.Add(this.MakeSubItem(rowObject, this.GetColumn(i)));
}
} else {
if (this.View == View.Tile) {
for (int i = 1; i < this.Columns.Count; i++) {
OLVColumn column = this.GetColumn(i);
if (column.IsTileViewColumn)
lvi.SubItems.Add(this.MakeSubItem(rowObject, column));
}
}
}
// Give the item the same font/colors as the control
lvi.Font = this.Font;
lvi.BackColor = this.BackColor;
lvi.ForeColor = this.ForeColor;
// Set the check state of the row, if we are showing check boxes
if (this.CheckBoxes) {
CheckState? state = this.GetCheckState(lvi.RowObject);
if (state.HasValue)
lvi.CheckState = (CheckState)state;
}
// Give the RowFormatter a chance to mess with the item
if (this.RowFormatter != null) {
this.RowFormatter(lvi);
}
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:46,代码来源:ObjectListView.cs
示例8: CalculateCellEditorBoundsOwnerDrawn
/// <summary>
/// Calculate the bounds of the edit control for the given item/column, when the listview
/// is being owner drawn.
/// </summary>
/// <param name="item"></param>
/// <param name="subItemIndex"></param>
/// <param name="r"></param>
/// <returns>A rectangle that is the bounds of the cell editor</returns>
protected Rectangle CalculateCellEditorBoundsOwnerDrawn(OLVListItem item, int subItemIndex, Rectangle r)
{
IRenderer renderer = null;
if (this.View == View.Details)
renderer = this.GetColumn(subItemIndex).Renderer ?? this.DefaultRenderer;
else
renderer = this.ItemRenderer;
if (renderer == null)
return r;
else {
using (Graphics g = this.CreateGraphics()) {
return renderer.GetEditRectangle(g, r, item, subItemIndex);
}
}
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:24,代码来源:ObjectListView.cs
示例9: CalculateCellEditorBounds
/// <summary>
/// Calculate the bounds of the edit control for the given item/column
/// </summary>
/// <param name="item"></param>
/// <param name="subItemIndex"></param>
/// <returns></returns>
public Rectangle CalculateCellEditorBounds(OLVListItem item, int subItemIndex)
{
Rectangle r;
if (this.View == View.Details)
r = item.GetSubItemBounds(subItemIndex);
else
r = this.GetItemRect(item.Index, ItemBoundsPortion.Label);
if (this.OwnerDraw)
return CalculateCellEditorBoundsOwnerDrawn(item, subItemIndex, r);
else
return CalculateCellEditorBoundsStandard(item, subItemIndex, r);
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:18,代码来源:ObjectListView.cs
示例10: CalculateCellBounds
/// <summary>
/// Return the bounds of the given cell
/// </summary>
/// <param name="item">The row to be edited</param>
/// <param name="subItemIndex">The index of the cell to be edited</param>
/// <returns>A Rectangle</returns>
public virtual Rectangle CalculateCellBounds(OLVListItem item, int subItemIndex)
{
// We use ItemBoundsPortion.Label rather than ItemBoundsPortion.Item
// since Label extends to the right edge of the cell, whereas Item gives just the
// current text width.
return this.CalculateCellBounds(item, subItemIndex, ItemBoundsPortion.Label);
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:13,代码来源:ObjectListView.cs
示例11: BuildList
/// <summary>
/// Build/rebuild all the list view items in the list
/// </summary>
/// <param name="shouldPreserveState">If this is true, the control will try to preserve the selection,
/// focused item, and the scroll position (see Remarks)
/// </param>
/// <remarks>
/// <para>
/// Use this method in situations were the contents of the list is basically the same
/// as previously.
/// </para>
/// <para>
/// Due to limitations in .NET's ListView, the scroll position is only preserved if
/// the control is in Details view AND it is not showing groups.
/// </para>
/// </remarks>
public virtual void BuildList(bool shouldPreserveState)
{
if (this.Frozen)
return;
this.ApplyExtendedStyles();
this.ClearHotItem();
int previousTopIndex = this.TopItemIndex;
Point currentScrollPosition = this.LowLevelScrollPosition;
IList previousSelection = new ArrayList();
Object previousFocus = null;
if (shouldPreserveState && this.objects != null) {
previousSelection = this.SelectedObjects;
OLVListItem focusedItem = this.FocusedItem as OLVListItem;
if (focusedItem != null)
previousFocus = focusedItem.RowObject;
}
IEnumerable objectsToDisplay = this.FilteredObjects;
this.BeginUpdate();
try {
this.Items.Clear();
this.ListViewItemSorter = null;
if (objectsToDisplay != null) {
// Build a list of all our items and then display them. (Building
// a list and then doing one AddRange is about 10-15% faster than individual adds)
List<OLVListItem> itemList = new List<OLVListItem>();
foreach (object rowObject in objectsToDisplay) {
OLVListItem lvi = new OLVListItem(rowObject);
this.FillInValues(lvi, rowObject);
itemList.Add(lvi);
}
this.Items.AddRange(itemList.ToArray());
this.Sort();
if (shouldPreserveState) {
this.SelectedObjects = previousSelection;
this.FocusedItem = this.ModelToItem(previousFocus);
}
this.RefreshHotItem();
}
} finally {
this.EndUpdate();
}
// We can only restore the scroll position after the EndUpdate() because
// of caching that the ListView does internally during a BeginUpdate/EndUpdate pair.
if (shouldPreserveState) {
this.RefreshHotItem();
// Restore the scroll position. TopItemIndex is best, but doesn't work
// when the control is grouped.
if (this.ShowGroups)
this.LowLevelScroll(currentScrollPosition.X, currentScrollPosition.Y);
else
this.TopItemIndex = previousTopIndex;
}
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:79,代码来源:ObjectListView.cs
示例12: CellEditEventArgs
/// <summary>
/// Create an event args
/// </summary>
/// <param name="column"></param>
/// <param name="control"></param>
/// <param name="r"></param>
/// <param name="item"></param>
/// <param name="subItemIndex"></param>
public CellEditEventArgs(OLVColumn column, Control control, Rectangle r, OLVListItem item, int subItemIndex) {
this.Control = control;
this.column = column;
this.cellBounds = r;
this.listViewItem = item;
this.rowObject = item.RowObject;
this.subItemIndex = subItemIndex;
this.value = column.GetValue(item.RowObject);
}
开发者ID:heliwave,项目名称:QuranCode,代码行数:17,代码来源:Events.cs
示例13: TreeBranchCollapsedEventArgs
/// <summary>
/// Create a new event args
/// </summary>
/// <param name="model"></param>
/// <param name="item"></param>
public TreeBranchCollapsedEventArgs(object model, OLVListItem item)
{
this.Model = model;
this.Item = item;
}
开发者ID:heliwave,项目名称:QuranCode,代码行数:10,代码来源:Events.cs
示例14: TreeBranchExpandingEventArgs
/// <summary>
/// Create a new event args
/// </summary>
/// <param name="model"></param>
/// <param name="item"></param>
public TreeBranchExpandingEventArgs(object model, OLVListItem item)
{
this.Model = model;
this.Item = item;
}
开发者ID:heliwave,项目名称:QuranCode,代码行数:10,代码来源:Events.cs
示例15: SubItemCheckingEventArgs
/// <summary>
/// Create a new event block
/// </summary>
/// <param name="column"></param>
/// <param name="item"></param>
/// <param name="subItemIndex"></param>
/// <param name="currentValue"></param>
/// <param name="newValue"></param>
public SubItemCheckingEventArgs(OLVColumn column, OLVListItem item, int subItemIndex, CheckState currentValue, CheckState newValue) {
this.column = column;
this.listViewItem = item;
this.subItemIndex = subItemIndex;
this.currentValue = currentValue;
this.newValue = newValue;
}
开发者ID:heliwave,项目名称:QuranCode,代码行数:15,代码来源:Events.cs
示例16: ApplyCellStyle
/// <summary>
/// Apply a style to a cell
/// </summary>
/// <param name="olvi"></param>
/// <param name="columnIndex"></param>
/// <param name="style"></param>
protected virtual void ApplyCellStyle(OLVListItem olvi, int columnIndex, IItemStyle style)
{
if (style == null)
return;
// Don't apply formatting to subitems when not in Details view
if (this.View != View.Details && columnIndex > 0)
return;
olvi.UseItemStyleForSubItems = false;
ListViewItem.ListViewSubItem subItem = olvi.SubItems[columnIndex];
if (style.Font != null)
subItem.Font = style.Font;
if (style.FontStyle != FontStyle.Regular)
subItem.Font = new Font(subItem.Font ?? olvi.Font ?? this.Font, style.FontStyle);
if (!style.ForeColor.IsEmpty)
subItem.ForeColor = style.ForeColor;
if (!style.BackColor.IsEmpty)
subItem.BackColor = style.BackColor;
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:30,代码来源:ObjectListView.cs
示例17: ApplyRowStyle
/// <summary>
/// Apply a style to the given row
/// </summary>
/// <param name="olvi"></param>
/// <param name="style"></param>
protected virtual void ApplyRowStyle(OLVListItem olvi, IItemStyle style)
{
if (style == null)
return;
if (this.FullRowSelect || this.View != View.Details) {
if (style.Font != null)
olvi.Font = style.Font;
if (style.FontStyle != FontStyle.Regular)
olvi.Font = new Font(olvi.Font ?? this.Font, style.FontStyle);
if (!style.ForeColor.IsEmpty) {
if (olvi.UseItemStyleForSubItems)
olvi.ForeColor = style.ForeColor;
else {
foreach (ListViewItem.ListViewSubItem x in olvi.SubItems) {
x.ForeColor = style.ForeColor;
}
}
}
if (!style.BackColor.IsEmpty) {
if (olvi.UseItemStyleForSubItems)
olvi.BackColor = style.BackColor;
else {
foreach (ListViewItem.ListViewSubItem x in olvi.SubItems) {
x.BackColor = style.BackColor;
}
}
}
} else {
olvi.UseItemStyleForSubItems = false;
foreach (ListViewItem.ListViewSubItem x in olvi.SubItems) {
if (style.BackColor.IsEmpty)
x.BackColor = olvi.BackColor;
else
x.BackColor = style.BackColor;
}
this.ApplyCellStyle(olvi, 0, style);
}
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:49,代码来源:ObjectListView.cs
示例18: CalculateCellTextBounds
/// <summary>
/// Return the bounds of the given cell only until the edge of the current text
/// </summary>
/// <param name="item">The row to be edited</param>
/// <param name="subItemIndex">The index of the cell to be edited</param>
/// <returns>A Rectangle</returns>
public virtual Rectangle CalculateCellTextBounds(OLVListItem item, int subItemIndex)
{
return this.CalculateCellBounds(item, subItemIndex, ItemBoundsPortion.ItemOnly);
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:10,代码来源:ObjectListView.cs
示例19: CalculateCellEditorBoundsStandard
/// <summary>
/// Calculate the bounds of the edit control for the given item/column, when the listview
/// is not being owner drawn.
/// </summary>
/// <param name="item"></param>
/// <param name="subItemIndex"></param>
/// <param name="cellBounds"></param>
/// <returns>A rectangle that is the bounds of the cell editor</returns>
protected Rectangle CalculateCellEditorBoundsStandard(OLVListItem item, int subItemIndex, Rectangle cellBounds)
{
if (this.View != View.Details)
return cellBounds;//
// Allow for image (if there is one)
int offset = 0;
object subItemImageSelector = item.ImageSelector;
if (subItemIndex > 0)
subItemImageSelector = ((OLVListSubItem)item.SubItems[subItemIndex]).ImageSelector;
if (this.GetActualImageIndex(subItemImageSelector) != -1) {
offset += this.SmallImageSize.Width + 2;
}
// Allow for checkbox
if (this.CheckBoxes && this.StateImageList != null && subItemIndex == 0) {
offset += this.StateImageList.ImageSize.Width + 2;
}
// Allow for indent (first column only)
if (subItemIndex == 0 && item.IndentCount > 0) {
offset += (this.SmallImageSize.Width * item.IndentCount);
}
// Do the adjustment
if (offset > 0) {
cellBounds.X += offset;
cellBounds.Width -= offset;
}
return cellBounds;
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:40,代码来源:ObjectListView.cs
示例20: EditSubItem
/// <summary>
/// Begin an edit operation on the given cell.
/// </summary>
/// <remarks>This performs various sanity checks and passes off the real work to StartCellEdit().</remarks>
/// <param name="item">The row to be edited</param>
/// <param name="subItemIndex">The index of the cell to be edited</param>
public virtual void EditSubItem(OLVListItem item, int subItemIndex)
{
if (item == null)
return;
if (subItemIndex < 0 && subItemIndex >= item.SubItems.Count)
return;
if (this.CellEditActivation == CellEditActivateMode.None)
return;
if (!this.GetColumn(subItemIndex).IsEditable)
return;
this.StartCellEdit(item, subItemIndex);
}
开发者ID:ZlayaZhaba,项目名称:XervBackup,代码行数:22,代码来源:ObjectListView.cs
注:本文中的BrightIdeasSoftware.OLVListItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论