private void objectListView1_FormatCell(object sender, BrightIdeasSoftware.FormatCellEventArgs e) { if (e.ColumnIndex == 2) e.SubItem.ForeColor = primaryCellColor; else e.SubItem.ForeColor = otherCellColor; if (e.ColumnIndex != 0) return; // Setup album artwork column Song song = (Song)e.Model; if (song.TrackNumber == 1) { Image albumCover = this.GetAlbumArtwork(song); if (albumCover != null) { // albumCover = albumCover.GetThumbnailImage(120, 120, delegate { return false; }, IntPtr.Zero); ImageDecoration decoration = new ImageDecoration(albumCover); decoration.ShrinkToWidth = true; decoration.AdornmentCorner = ContentAlignment.BottomCenter; decoration.ReferenceCorner = ContentAlignment.TopCenter; e.SubItem.Decoration = decoration; albumImageDecorations[song.Album] = new ForwardingDecoration(e.Item, e.SubItem, decoration); TextDecoration td = new TextDecoration(song.Album, ContentAlignment.BottomCenter); td.Font = this.objectListView1.Font; td.Wrap = false; td.TextColor = primaryCellColor; td.BackColor = Color.FromArgb(255, 16, 16, 16); td.CornerRounding = 4; //td.BackColor = otherCellColor; //td.TextColor = Color.FromArgb(255, 16, 16, 16); //td.CornerRounding = 0; e.SubItem.Decorations.Add(td); } } else { if (albumImageDecorations.ContainsKey(song.Album)) { e.SubItem.Decoration = albumImageDecorations[song.Album]; } } }
private void objectListView1_FormatCell(object sender, FormatCellEventArgs e) { if (e.ColumnIndex != 0) return; loginfo info = (loginfo) e.Model; if (info.img == null) return; ImageDecoration decoration = new ImageDecoration(new Bitmap(info.img, 150, 150), 255); //decoration.ShrinkToWidth = true; decoration.AdornmentCorner = ContentAlignment.TopCenter; decoration.ReferenceCorner = ContentAlignment.TopCenter; e.SubItem.Decoration = decoration; // TextDecoration td = new TextDecoration("test", ContentAlignment.BottomCenter); // e.SubItem.Decorations.Add(td); Application.DoEvents(); }
private void lstGames_FormatCell(object sender, BrightIdeasSoftware.FormatCellEventArgs e) { if (e.ColumnIndex != 0) return; if (e.Model == null) return; // Add game banner to ID column GameInfo g = (GameInfo)e.Model; string bannerFile = string.Format(Properties.Resources.GameBannerPath, Path.GetDirectoryName(Application.ExecutablePath), g.Id); if (!File.Exists(bannerFile)) return; ImageDecoration decoration = new ImageDecoration(Image.FromFile(bannerFile)); decoration.ShrinkToWidth = true; decoration.AdornmentCorner = ContentAlignment.TopLeft; decoration.ReferenceCorner = ContentAlignment.TopLeft; decoration.Transparency = 255; //e.SubItem.Decoration = decoration; e.SubItem.Decorations.Add(decoration); // Add Early Access banner if (Program.GameDB.Games.ContainsKey(g.Id) && Program.GameDB.Games[g.Id].Tags != null) { if (Program.GameDB.Games[g.Id].Tags.Contains(EARLY_ACCESS)) { decoration = new ImageDecoration(imglistEarlyAccess.Images[0]) { AdornmentCorner = ContentAlignment.TopLeft, ReferenceCorner = ContentAlignment.TopLeft, Transparency = 200 }; e.SubItem.Decorations.Add(decoration); } } TextDecoration td = new TextDecoration(g.Id.ToString(), ContentAlignment.BottomLeft) { Font = new Font(this.lstGames.Font.Name, 8), Wrap = false, TextColor = textColor, BackColor = listBackground, CornerRounding = 4, Transparency = 200 }; e.SubItem.Decorations.Add(td); }
private void lstGames_FormatCell(object sender, BrightIdeasSoftware.FormatCellEventArgs e) { if (e.ColumnIndex != 0) return; // Add game banner to ID column GameInfo g = (GameInfo)e.Model; ImageDecoration decoration = new ImageDecoration(g.Banner()); decoration.ShrinkToWidth = true; decoration.AdornmentCorner = ContentAlignment.TopLeft; decoration.ReferenceCorner = ContentAlignment.TopLeft; decoration.Transparency = 255; e.SubItem.Decoration = decoration; TextDecoration td = new TextDecoration(g.Id.ToString(), ContentAlignment.BottomLeft); td.Font = new Font(this.lstGames.Font.Name, 8); td.Wrap = false; td.TextColor = textColor; td.BackColor = listBackground; td.CornerRounding = 4; td.Transparency = 200; e.SubItem.Decorations.Add(td); }
// Input data and decoration for cell private void listItems_FormatCell(object sender, BrightIdeasSoftware.FormatCellEventArgs e) { try { ItemMasterRow item = (ItemMasterRow)e.Model; if (e.ColumnIndex == 0) { BrightIdeasSoftware.ImageDecoration imageDeco = new BrightIdeasSoftware.ImageDecoration(); imageDeco.Image = listIcons.Images[item.ItemTypeID.ToString()]; imageDeco.Transparency = 255; imageDeco.Alignment = ContentAlignment.MiddleCenter; imageDeco.ShrinkToWidth = true; e.SubItem.Decoration = imageDeco; } else if (e.ColumnIndex == 1) { ItemDecoration decoration = new ItemDecoration(); decoration.Title = item.Title; if (item.PubYear == "-1" || item.PubYear == null) { if (Regex.Match(item.PubDate, @"\d{4}").Success) decoration.Year = Regex.Match(item.PubDate, @"\d{4}").Value; else decoration.Year = ""; } else decoration.Year = item.PubYear; decoration.Authors = item.Author = CitationTools.GetAuthorsString(item.Authors); e.SubItem.Decoration = decoration; } else if (e.ColumnIndex == 2) //如果有 3 行(通常都是 連結 或者 pdf 檔案的圖示) { if (item.ItemFile.Length > 0 && item.ItemFile != string.Empty) { BrightIdeasSoftware.ImageDecoration imageDeco = new BrightIdeasSoftware.ImageDecoration(); imageDeco.Image = CitationTools.GetItemFileIcon(item.ItemFile); if (imageDeco.Image != null) { imageDeco.Transparency = 255; imageDeco.Offset = new Size(-5, 0); imageDeco.ShrinkToWidth = true; imageDeco.Alignment = ContentAlignment.MiddleRight; e.SubItem.Decoration = imageDeco; } } else if (item.ItemTypeID == ItemTypes.WebPage) { BrightIdeasSoftware.ImageDecoration imageDeco = new BrightIdeasSoftware.ImageDecoration(); imageDeco.Image = CitationTools.GetItemFileIcon("wizfolio.wfweb"); if (imageDeco.Image != null) { imageDeco.Transparency = 255; imageDeco.Offset = new Size(-5, 0); imageDeco.ShrinkToWidth = true; imageDeco.Alignment = ContentAlignment.MiddleRight; e.SubItem.Decoration = imageDeco; } } } } catch(Exception ex) { log.WriteLine(LogType.Error, "MasterControl::listItems_FormatCell", ex.ToString()); } }
public ForwardingDecoration(OLVListItem item, OLVListSubItem subitem, ImageDecoration decoration) { this.item = item; this.subitem = subitem; this.decoration = decoration; }