/// <summary>
/// Event on format cell
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private void FastOlvOnFormatCell(object sender, FormatCellEventArgs args)
{
CompletionItem item = (CompletionItem)args.Model;
if (item == null)
{
return;
}
// display the flags
int offset = -5;
item.DoForEachFlag((name, flag) => {
Image tryImg = (Image)ImageResources.ResourceManager.GetObject(name);
if (tryImg != null)
{
ImageDecoration decoration = new ImageDecoration(tryImg, 100, ContentAlignment.MiddleRight)
{
Offset = new Size(offset, 0)
};
if (args.SubItem.Decoration == null)
{
args.SubItem.Decoration = decoration;
}
else
{
args.SubItem.Decorations.Add(decoration);
}
offset -= 20;
}
});
// display the sub string
if (offset < -5)
{
offset -= 5;
}
if (!String.IsNullOrEmpty(item.SubString))
{
TextDecoration decoration = new TextDecoration(item.SubString, 100)
{
Alignment = ContentAlignment.MiddleRight,
Offset = new Size(offset, 0),
Font = FontManager.GetFont(FontStyle.Bold, 10),
TextColor = ThemeManager.Current.SubTextFore,
CornerRounding = 1f,
Rotation = 0,
BorderWidth = 1,
BorderColor = ThemeManager.Current.SubTextFore
};
args.SubItem.Decorations.Add(decoration);
}
}