Exemple #1
0
        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();
        }
Exemple #2
0
        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];
                }
            }
        }
Exemple #3
0
        /// <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);
            }
        }
        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;
        }
Exemple #5
0
        /// <summary>
        /// Event on format cell
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private static void FastOlvOnFormatCell(object sender, FormatCellEventArgs args)
        {
            FileListItem obj = (FileListItem)args.Model;

            if (obj == null)
            {
                return;
            }

            // currently document
            if (obj.FullPath.Equals(Plug.CurrentFilePath))
            {
                RowBorderDecoration rbd = new RowBorderDecoration {
                    FillBrush      = new SolidBrush(Color.FromArgb(50, ThemeManager.Current.MenuFocusedBack)),
                    BorderPen      = new Pen(Color.FromArgb(128, ThemeManager.Current.MenuFocusedBack.IsColorDark() ? ControlPaint.Light(ThemeManager.Current.MenuFocusedBack, 0.10f) : ControlPaint.Dark(ThemeManager.Current.MenuFocusedBack, 0.10f)), 1),
                    BoundsPadding  = new Size(-2, 0),
                    CornerRounding = 6.0f
                };
                args.SubItem.Decoration = rbd;
            }

            // display the flags
            int offset = -5;

            foreach (var name in Enum.GetNames(typeof(FileFlag)))
            {
                FileFlag flag = (FileFlag)Enum.Parse(typeof(FileFlag), name);
                if (flag == 0)
                {
                    continue;
                }
                if (!obj.Flags.HasFlag(flag))
                {
                    continue;
                }
                Image tryImg = (Image)ImageResources.ResourceManager.GetObject(name);
                if (tryImg == null)
                {
                    continue;
                }
                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(obj.SubString))
            {
                TextDecoration decoration = new TextDecoration(obj.SubString, 100)
                {
                    Alignment      = ContentAlignment.MiddleRight,
                    Offset         = new Size(offset, 0),
                    Font           = FontManager.GetFont(FontStyle.Bold, 11),
                    TextColor      = ThemeManager.Current.SubTextFore,
                    CornerRounding = 1f,
                    Rotation       = 0,
                    BorderWidth    = 1,
                    BorderColor    = ThemeManager.Current.SubTextFore
                };
                args.SubItem.Decorations.Add(decoration);
            }
        }
Exemple #6
0
        /// <summary>
        /// Event on format cell
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private static void FastOlvOnFormatCell(object sender, FormatCellEventArgs args)
        {
            CodeExplorerItem obj = (CodeExplorerItem)args.Model;
            var curScope         = ParserHandler.GetScopeOfLine(Npp.Line.CurrentLine);

            // currently selected block
            if (curScope != null && !obj.IsNotBlock && obj.DisplayText.Equals(curScope.Name))
            {
                RowBorderDecoration rbd = new RowBorderDecoration {
                    FillBrush      = new SolidBrush(Color.FromArgb(50, ThemeManager.Current.MenuFocusedBack)),
                    BorderPen      = new Pen(Color.FromArgb(128, ThemeManager.Current.MenuFocusedBack.IsColorDark() ? ControlPaint.Light(ThemeManager.Current.MenuFocusedBack, 0.10f) : ControlPaint.Dark(ThemeManager.Current.MenuFocusedBack, 0.10f)), 1),
                    BoundsPadding  = new Size(-2, 0),
                    CornerRounding = 6.0f
                };
                args.SubItem.Decoration = rbd;
            }

            // display the flags
            int offset = -5;

            obj.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(obj.SubString))
            {
                TextDecoration decoration = new TextDecoration(obj.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);
            }
        }
Exemple #7
0
 public ForwardingDecoration(OLVListItem item, OLVListSubItem subitem, ImageDecoration decoration)
 {
     this.item       = item;
     this.subitem    = subitem;
     this.decoration = decoration;
 }