?? objectlistview.cs
字號:
DefaultValue(typeof(Color), "")]
public virtual Color HighlightBackgroundColor
{
get { return highlightBackgroundColor; }
set { highlightBackgroundColor = value; }
}
private Color highlightBackgroundColor = Color.Empty;
/// <summary>
/// Return the color should be used for the background of selected rows or a reasonable default
/// </summary>
[Browsable(false)]
public virtual Color HighlightBackgroundColorOrDefault
{
get {
if (this.HighlightBackgroundColor.IsEmpty)
return SystemColors.Highlight;
else
return this.HighlightBackgroundColor;
}
}
/// <summary>
/// What color should be used for the foreground of selected rows?
/// </summary>
/// <remarks>Windows does not give the option of changing the selection foreground (text color).
/// So the control has to be owner drawn to see the result of this setting.
/// Setting UseCustomSelectionColors = true will do this for you.</remarks>
[Category("Appearance"),
Description("The foreground foregroundColor of selected rows when the control is owner drawn"),
DefaultValue(typeof(Color), "")]
public virtual Color HighlightForegroundColor
{
get { return highlightForegroundColor; }
set { highlightForegroundColor = value; }
}
private Color highlightForegroundColor = Color.Empty;
/// <summary>
/// Return the color should be used for the foreground of selected rows or a reasonable default
/// </summary>
[Browsable(false)]
public virtual Color HighlightForegroundColorOrDefault
{
get {
if (this.HighlightForegroundColor.IsEmpty)
return SystemColors.HighlightText;
else
return this.HighlightForegroundColor;
}
}
/// <summary>
/// Return true if a cell edit operation is currently happening
/// </summary>
[Browsable(false)]
public virtual bool IsCellEditing
{
get { return this.cellEditor != null; }
}
/// <summary>
/// When the user types into a list, should the values in the current sort column be searched to find a match?
/// If this is false, the primary column will always be used regardless of the sort column.
/// </summary>
/// <remarks>When this is true, the behavior is like that of ITunes.</remarks>
[Category("Behavior - ObjectListView"),
Description("When the user types into a list, should the values in the current sort column be searched to find a match?"),
DefaultValue(true)]
public virtual bool IsSearchOnSortColumn
{
get { return isSearchOnSortColumn; }
set { isSearchOnSortColumn = value; }
}
private bool isSearchOnSortColumn = true;
/// <summary>
/// This renderer draws the items when in the list is in non-details view.
/// In details view, the renderers for the individuals columns are responsible.
/// </summary>
public IRenderer ItemRenderer
{
get { return itemRenderer; }
set { itemRenderer = value; }
}
private IRenderer itemRenderer;
/// <summary>
/// Which column did we last sort by
/// </summary>
[Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public virtual OLVColumn LastSortColumn
{
get { return lastSortColumn; }
set { lastSortColumn = value; }
}
private OLVColumn lastSortColumn;
/// <summary>
/// Which direction did we last sort
/// </summary>
[Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public virtual SortOrder LastSortOrder
{
get { return lastSortOrder; }
set { lastSortOrder = value; }
}
private SortOrder lastSortOrder;
/// <summary>
/// Get/set the collection of objects that this list will show
/// </summary>
/// <remarks>
/// <para>
/// The contents of the control will be updated immediately after setting this property.
/// </para>
/// <para>This method preserves selection, if possible. Use SetObjects() if
/// you do not want to preserve the selection. Preserving selection is the slowest part of this
/// code and performance is O(n) where n is the number of selected rows.</para>
/// <para>This method is not thread safe.</para>
/// <para>The property DOES work on virtual lists: setting is problem-free, but if you try to get it
/// and the list has 10 million objects, it may take some time to return.</para>
/// </remarks>
[Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public virtual IEnumerable Objects
{
get {
if (this.VirtualMode) {
ArrayList contents = new ArrayList(this.GetItemCount());
for (int i = 0; i < this.GetItemCount(); i++)
contents.Add(this.GetModelObject(i));
return contents;
}
else
return this.objects;
}
set {
this.BeginUpdate();
try {
IList previousSelection = this.SelectedObjects;
this.SetObjects(value);
this.SelectedObjects = previousSelection;
}
finally {
this.EndUpdate();
}
}
}
private IEnumerable objects;
/// <summary>
/// Specify the height of each row in the control in pixels.
/// </summary>
/// <remarks><para>The row height in a listview is normally determined by the font size and the small image list size.
/// This setting allows that calculation to be overridden (within reason: you still cannot set the line height to be
/// less than the line height of the font used in the control). </para>
/// <para>Setting it to -1 means use the normal calculation method.</para>
/// <para><bold>This feature is experiemental!</bold> Strange things may happen to your program,
/// your spouse or your pet if you use it.</para>
/// </remarks>
[Category("Appearance"),
Description("Specify the height of each row in pixels. -1 indicates default height"),
DefaultValue(-1)]
public virtual int RowHeight
{
get { return rowHeight; }
set {
if (value < 1)
rowHeight = -1;
else
rowHeight = value;
this.SetupExternalImageList();
}
}
private int rowHeight = -1;
/// <summary>
/// How many rows appear on each page of this control
/// </summary>
public virtual int RowsPerPage
{
get {
return NativeMethods.GetCountPerPage(this);
}
}
/// <summary>
/// Get/set the column that will be used to resolve comparisons that are equal when sorting.
/// </summary>
/// <remarks>There is no user interface for this setting. It must be set programmatically.
/// The default is the first column.</remarks>
[Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public virtual OLVColumn SecondarySortColumn
{
get {
if (this.secondarySortColumn == null) {
if (this.Columns.Count > 0)
return this.GetColumn(0);
else
return null;
} else
return this.secondarySortColumn;
}
set {
this.secondarySortColumn = value;
}
}
private OLVColumn secondarySortColumn;
/// <summary>
/// When the SecondarySortColumn is used, in what order will it compare results?
/// </summary>
[Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public virtual SortOrder SecondarySortOrder
{
get { return this.secondarySortOrder; }
set { this.secondarySortOrder = value; }
}
private SortOrder secondarySortOrder = SortOrder.Ascending;
/// <summary>
/// When the user right clicks on the column headers, should a menu be presented which will allow
/// them to choose which columns will be shown in the view?
/// </summary>
[Category("Behavior - ObjectListView"),
Description("When the user right clicks on the column headers, should a menu be presented which will allow them to choose which columns will be shown in the view?"),
DefaultValue(true)]
public virtual bool SelectColumnsOnRightClick
{
get { return selectColumnsOnRightClick; }
set { selectColumnsOnRightClick = value; }
}
private bool selectColumnsOnRightClick = true;
/// <summary>
/// When the column select menu is open, should it stay open after an item is selected?
/// Staying open allows the user to turn more than one column on or off at a time.
/// </summary>
[Category("Behavior - ObjectListView"),
Description("When the column select menu is open, should it stay open after an item is selected?"),
DefaultValue(true)]
public virtual bool SelectColumnsMenuStaysOpen
{
get { return selectColumnsMenuStaysOpen; }
set { selectColumnsMenuStaysOpen = value; }
}
private bool selectColumnsMenuStaysOpen = true;
/// <summary>
/// Return the index of the row that is currently selected. If no row is selected,
/// or more than one is selected, return -1.
/// </summary>
[Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public virtual int SelectedIndex
{
get {
if (this.SelectedIndices.Count == 1)
return this.SelectedIndices[0];
else
return -1;
}
set {
this.SelectedIndices.Clear();
if (value >= 0 && value < this.Items.Count)
this.SelectedIndices.Add(value);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -