本文整理汇总了C#中BrightIdeasSoftware.ObjectListView.GetColumn方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectListView.GetColumn方法的具体用法?C# ObjectListView.GetColumn怎么用?C# ObjectListView.GetColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrightIdeasSoftware.ObjectListView
的用法示例。
在下文中一共展示了ObjectListView.GetColumn方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TimedFilter
public static void TimedFilter(ObjectListView olv, string txt, TextMatchFilter.MatchKind matchKind = TextMatchFilter.MatchKind.Text)
{
TextMatchFilter filter = null;
if (!String.IsNullOrEmpty(txt))
filter = new TextMatchFilter(olv, txt, matchKind);
// Setup a default renderer to draw the filter matches
olv.DefaultRenderer = filter == null ? null : new HighlightTextRenderer(filter);
// Some lists have renderers already installed
var highlightingRenderer = olv.GetColumn(0).Renderer as HighlightTextRenderer;
if (highlightingRenderer != null)
highlightingRenderer.Filter = filter;
olv.ModelFilter = filter;
}
示例2: TimedFilter
void TimedFilter(ObjectListView olv, string txt)
{
TextMatchFilter filter = null;
if (!String.IsNullOrEmpty(txt))
{
filter = TextMatchFilter.Contains(olv, txt);
}
// Setup a default renderer to draw the filter matches
if (filter == null)
olv.DefaultRenderer = null;
else
{
HighlightTextRenderer htr = new HighlightTextRenderer(filter);
htr.FillBrush = Brushes.AliceBlue;
olv.DefaultRenderer = htr; //new HighlightTextRenderer(filter);
// Uncomment this line to see how the GDI+ rendering looks
//olv.DefaultRenderer = new HighlightTextRenderer { Filter = filter, UseGdiTextRendering = false };
}
// Some lists have renderers already installed
HighlightTextRenderer highlightingRenderer = olv.GetColumn(0).Renderer as HighlightTextRenderer;
if (highlightingRenderer != null)
highlightingRenderer.Filter = filter;
CompositeAllFilter currentFilter = null;
if (filter != null)
{
// Get the existing model filters, if any, remove any existing TextMatchFilters,
// then add the new TextMatchFilter
if (olv.ModelFilter == null) // easy, just add the new one
{
List<IModelFilter> listOfFilters = new List<IModelFilter>();
listOfFilters.Add(filter); //add the TextMatchFilter
CompositeAllFilter compositeFilter = new CompositeAllFilter(listOfFilters);
olv.ModelFilter = compositeFilter;
}
else //need to remove existing TextMatchFilters, if any, than add the new one
{
currentFilter = (CompositeAllFilter)olv.ModelFilter;
//find the first existing TextMatchFilter (should be at most one) and remove it
foreach (IModelFilter m in currentFilter.Filters)
{
if (m is TextMatchFilter)
{
currentFilter.Filters.Remove(m);
break;
}
}
//add the new TextMatchFilter
if (olv.ModelFilter != null)
{
(olv.ModelFilter as CompositeAllFilter).Filters.Add(filter);
}
else
{
List<IModelFilter> listOfFilters = new List<IModelFilter>();
listOfFilters.Add(filter); //add the TextMatchFilter
CompositeAllFilter compositeFilter = new CompositeAllFilter(listOfFilters);
olv.ModelFilter = compositeFilter;
}
}
}
else //remove text filter
{
if (olv.ModelFilter != null)
{
currentFilter = (CompositeAllFilter)olv.ModelFilter;
//find and remove the first existing TextMatchFilter if any
foreach (IModelFilter m in currentFilter.Filters)
{
if (m is TextMatchFilter)
{
currentFilter.Filters.Remove(m);
break;
}
}
if (currentFilter.Filters.Count == 0)
{
fastDataListView1.ModelFilter = null;
}
}
}
if (currentFilter != null)
fastDataListView1.ModelFilter = currentFilter;
updateStatusLine(fastDataListView1);
}
示例3: AnimatedDecoration
/// <summary>
/// Create a decoration that will draw an animation around a cell of the given model
/// </summary>
/// <param name="ModelObject"></param>
public AnimatedDecoration(ObjectListView olv, OLVListItem item, OLVListSubItem subItem)
: this(olv) {
this.ModelObject = item.RowObject;
this.Column = olv.GetColumn(item.SubItems.IndexOf(subItem));
}
示例4: DrawBusinessCard
public void DrawBusinessCard(Graphics g, Rectangle itemBounds, object rowObject, ObjectListView olv, OLVListItem item)
{
try
{
const int spacing = 8;
// Allow a border around the card
itemBounds.Inflate(-2, -2);
// Draw card background
const int rounding = 20;
GraphicsPath path = this.GetRoundedRect(itemBounds, rounding);
g.FillPath(this.BackBrush, path);
g.DrawPath(this.BorderPen, path);
g.Clip = new Region(itemBounds);
// Draw the photo
Rectangle photoRect = itemBounds;
photoRect.Inflate(-spacing, -spacing);
Movie movie = rowObject as Movie;
if (movie != null)
{
photoRect.Width = 200;
if (!File.Exists(movie.ImagePath))
DownloadImage(movie);
if (IsFileExists(movie.ImagePath))
{
try
{
using (var photo = Image.FromFile(movie.ImagePath))
{
if (photo.Width > photoRect.Width)
photoRect.Height = (int)(photo.Height * ((float)photoRect.Width / photo.Width));
else
photoRect.Height = photo.Height;
g.DrawImage(photo, photoRect);
}
}
catch
{
g.DrawRectangle(Pens.DarkGray, photoRect);
File.Delete(movie.ImagePath);
}
}
else
{
g.DrawRectangle(Pens.DarkGray, photoRect);
}
}
// Now draw the text portion
RectangleF textBoxRect = photoRect;
textBoxRect.X += (photoRect.Width + spacing);
textBoxRect.Width = itemBounds.Right - textBoxRect.X - spacing;
using (StringFormat fmt = new StringFormat())
{
fmt.Trimming = StringTrimming.EllipsisCharacter;
fmt.Alignment = StringAlignment.Center;
fmt.LineAlignment = StringAlignment.Near;
String txt = item.Text;
using (Font font = new Font("Tahoma", 11))
{
// Measure the height of the title
SizeF size = g.MeasureString(txt, font, (int)textBoxRect.Width, fmt);
// Draw the title
RectangleF r3 = textBoxRect;
r3.Height = size.Height;
path = this.GetRoundedRect(r3, 15);
g.FillPath(this.HeaderBackBrush, path);
g.DrawString(txt, font, this.HeaderTextBrush, textBoxRect, fmt);
textBoxRect.Y += size.Height + spacing;
}
// Draw the other bits of information
using (Font font = new Font("Tahoma", 8))
{
for (int i = 0; i < olv.Columns.Count; i++)
{
OLVColumn column = olv.GetColumn(i);
if (column.IsTileViewColumn)
{
SizeF size = g.MeasureString(column.GetStringValue(movie), font, (int)textBoxRect.Width, fmt);
textBoxRect.Height = size.Height;
fmt.Alignment = StringAlignment.Near;
txt = column.GetStringValue(rowObject);
g.DrawString(txt, font, this.TextBrush, textBoxRect, fmt);
textBoxRect.Y += size.Height ;
}
}
}
}
}
catch (Exception ex) { Debug.WriteLine("This exception: " + ex.Message); }
}
示例5: ResultTextFilter
/// <summary>
/// Filter list by text
/// </summary>
/// <param name="olv"></param>
/// <param name="txt"></param>
void ResultTextFilter(ObjectListView olv, string txt)
{
TextMatchFilter filter = null;
if (!String.IsNullOrEmpty(txt))
filter = new TextMatchFilter(olv, txt);
// Setup a default renderer to draw the filter matches
if (filter == null)
olv.DefaultRenderer = null;
else
olv.DefaultRenderer = new HighlightTextRenderer(txt);
// Some lists have renderers already installed
HighlightTextRenderer highlightingRenderer = olv.GetColumn(0).Renderer as HighlightTextRenderer;
if (highlightingRenderer != null)
highlightingRenderer.TextToHighlight = txt;
olv.ModelFilter = filter;
/*
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
olv.ModelFilter = filter;
stopWatch.Stop();
IList objects = olv.Objects as IList;
if (objects == null)
this.toolStripStatusLabel1.Text =
String.Format("Filtered in {0}ms", stopWatch.ElapsedMilliseconds);
else
this.toolStripStatusLabel1.Text =
String.Format("Filtered {0} items down to {1} items in {2}ms",
objects.Count,
olv.Items.Count,
stopWatch.ElapsedMilliseconds);
*/
//GC.Collect();//Melek
}
示例6: TimedFilter
void TimedFilter(ObjectListView olv, string txt, int matchKind) {
TextMatchFilter filter = null;
if (!String.IsNullOrEmpty(txt)) {
switch (matchKind) {
case 0:
default:
filter = TextMatchFilter.Contains(olv, txt);
break;
case 1:
filter = TextMatchFilter.Prefix(olv, txt);
break;
case 2:
filter = TextMatchFilter.Regex(olv, txt);
break;
}
}
// Setup a default renderer to draw the filter matches
if (filter == null) {
olv.DefaultRenderer = null;
} else {
olv.DefaultRenderer = new HighlightTextRenderer(filter);
// Uncomment this line to see how the GDI+ rendering looks
//olv.DefaultRenderer = new HighlightTextRenderer { Filter = filter, UseGdiTextRendering = false };
}
// Some lists have renderers already installed
HighlightTextRenderer highlightingRenderer = olv.GetColumn(0).Renderer as HighlightTextRenderer;
if (highlightingRenderer != null) {
highlightingRenderer.Filter = filter;
}
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
olv.AdditionalFilter = filter;
olv.Invalidate();
stopWatch.Stop();
IList objects = olv.Objects as IList;
if (objects == null) {
string msg = String.Format("Filtered in {0}ms", stopWatch.ElapsedMilliseconds);
this.toolTip1.SetToolTip(this.textBoxFilterTree, msg);
} else {
string msg = String.Format("Filtered {0} items down to {1} items in {2}ms",
objects.Count,
olv.Items.Count,
stopWatch.ElapsedMilliseconds);
this.toolTip1.SetToolTip(this.textBoxFilterTree, msg);
}
}