Beispiel #1
0
        private void OnPaintCredit(object sender, PaintEventArgs args)
        {
            if (_creditIndex == _creditGroups.Count)
            {
                return;
            }

            CreditGroup grp = (CreditGroup)_creditGroups[_creditIndex];

            Color col;

            if (_creditStep < 10)
            {
                col = ColorUtil.CalculateColor(SystemColors.WindowText, SystemColors.Window, _creditStep * (255 / 10));
            }
            else if (_creditStep < 40)
            {
                col = SystemColors.WindowText;
            }
            else if (_creditStep < 50)
            {
                col = ColorUtil.CalculateColor(SystemColors.WindowText, SystemColors.Window, (50 - _creditStep) * (255 / 10));
            }
            else
            {
                return; //no draw
            }
            Graphics g         = args.Graphics;
            SizeF    name_size = g.MeasureString(grp._name, _boldFont);
            Brush    br        = new SolidBrush(col);
            float    y         = (_mainPanel.Height - (name_size.Height * (1 + grp._credits.Length))) / 2;
            float    width     = this.Width;

            DrawString(g, grp._name, _boldFont, br, y);
            y += name_size.Height;
            foreach (Entry e in grp._credits)
            {
                DrawString(g, WindowManagerPlugin.Instance.WindowPreference.OriginalPreference.Language == Language.English ? e._en_name : e._ja_name, _mainPanel.Font, br, y);
                y += name_size.Height;
            }
            br.Dispose();
        }
Beispiel #2
0
        internal void DrawFocusCues()
        {
            if (!IsInATreeListView)
            {
                return;
            }
            if (TreeListView._updating)
            {
                return;
            }
            if (TreeListView.HideSelection && !TreeListView.Focused)
            {
                return;
            }
            Graphics g = Graphics.FromHwnd(TreeListView.Handle);

            if (Visible)
            {
                Rectangle entireitemrect = GetBounds(ItemBoundsPortion.Entire);
                if (entireitemrect.Bottom > entireitemrect.Height * 1.5f)
                {
                    Rectangle labelitemrect    = GetBounds(ItemBoundsPortion.Label);
                    Rectangle itemonlyrect     = GetBounds(ItemBoundsPortion.ItemOnly);
                    Rectangle selecteditemrect = new Rectangle(
                        labelitemrect.Left,
                        labelitemrect.Top,
                        TreeListView.FullRowSelect ? entireitemrect.Width - labelitemrect.Left - 1 : itemonlyrect.Width - SystemInformation.SmallIconSize.Width - 1,
                        labelitemrect.Height - 1);
                    Pen pen = new Pen(TreeListView.Focused && Selected ? Color.Blue : ColorUtil.CalculateColor(SystemColors.Highlight, SystemColors.Window, 130));
                    for (int i = 1; i < TreeListView.Columns.Count; i++)
                    {
                        Rectangle rect = TreeListView.GetSubItemRect(Index, i);
                        if (rect.X < selecteditemrect.X)
                        {
                            selecteditemrect = new Rectangle(
                                rect.X, selecteditemrect.Y,
                                selecteditemrect.Width + (selecteditemrect.X - rect.X),
                                selecteditemrect.Height);
                        }
                    }

                    g.DrawRectangle(new Pen(ColorUtil.VSNetSelectionColor), selecteditemrect);
                    // Fill the item (in CommCtl V6, the selection area is not always the same :
                    // label only or first column). I decided to always draw the entire column...
                    if (!TreeListView.FullRowSelect)
                    {
                        g.FillRectangle(
                            new SolidBrush(BackColor),
                            itemonlyrect.Right - 1, itemonlyrect.Top,
                            labelitemrect.Width - itemonlyrect.Width + SystemInformation.SmallIconSize.Width + 1, selecteditemrect.Height + 1);
                    }
                    //bool draw = true;
                    //if (PrevVisibleItem != null)
                    //    if (PrevVisibleItem.Selected) draw = false;
                    //// Draw upper line if previous item is not selected
                    ////if (draw) g.DrawLine(pen, selecteditemrect.Left, selecteditemrect.Top, selecteditemrect.Right, selecteditemrect.Top);
                    ////g.DrawLine(pen, selecteditemrect.Left, selecteditemrect.Top, selecteditemrect.Left, selecteditemrect.Bottom);
                    //draw = true;
                    //if (NextVisibleItem != null)
                    //    if (NextVisibleItem.Selected) draw = false;
                    //// Draw lower line if net item is not selected
                    ////if (draw) g.DrawLine(pen, selecteditemrect.Left, selecteditemrect.Bottom, selecteditemrect.Right, selecteditemrect.Bottom);
                    ////g.DrawLine(pen, selecteditemrect.Right, selecteditemrect.Top, selecteditemrect.Right, selecteditemrect.Bottom);
                    //// If FullRowSelect is false and multiselect is enabled, the items don't have the same width
                    if (!TreeListView.FullRowSelect && NextVisibleItem != null)
                    {
                        if (NextVisibleItem.Selected)
                        {
                            int nextItemWidth = NextVisibleItem.GetBounds(TreeListViewItemBoundsPortion.ItemOnly).Width;
                            if (nextItemWidth != itemonlyrect.Width)
                            {
                                g.DrawLine(
                                    pen,
                                    selecteditemrect.Right,
                                    selecteditemrect.Bottom,
                                    selecteditemrect.Right - (itemonlyrect.Width - nextItemWidth),
                                    selecteditemrect.Bottom);
                            }
                        }
                    }
                    pen.Dispose();
                }
            }
            g.Dispose();
        }
Beispiel #3
0
 internal void DrawFocusCues()
 {
     if (IsInATreeListView && !TreeListView._Updating && (!TreeListView.HideSelection || TreeListView.Focused))
     {
         Graphics graphics = Graphics.FromHwnd(TreeListView.Handle);
         if (Visible)
         {
             Rectangle bounds = GetBounds(ItemBoundsPortion.Entire);
             if ((float)bounds.Bottom > (float)bounds.Height * 1.5f)
             {
                 Rectangle bounds2 = GetBounds(ItemBoundsPortion.Label);
                 Rectangle bounds3 = GetBounds(ItemBoundsPortion.ItemOnly);
                 Rectangle rect    = new Rectangle(bounds2.Left, bounds2.Top, TreeListView.FullRowSelect ? (bounds.Width - bounds2.Left - 1) : (bounds3.Width - SystemInformation.SmallIconSize.Width - 1), bounds2.Height - 1);
                 Pen       pen     = new Pen((TreeListView.Focused && base.Selected) ? Color.Blue : ColorUtil.CalculateColor(System.Drawing.SystemColors.Highlight, System.Drawing.SystemColors.Window, 130));
                 for (int i = 1; i < TreeListView.Columns.Count; i++)
                 {
                     Rectangle subItemRect = TreeListView.GetSubItemRect(base.Index, i);
                     if (subItemRect.X < rect.X)
                     {
                         rect = new Rectangle(subItemRect.X, rect.Y, rect.Width + (rect.X - subItemRect.X), rect.Height);
                     }
                 }
                 graphics.DrawRectangle(new Pen(ColorUtil.VSNetSelectionColor), rect);
                 if (!TreeListView.FullRowSelect)
                 {
                     graphics.FillRectangle(new SolidBrush(base.BackColor), bounds3.Right - 1, bounds3.Top, bounds2.Width - bounds3.Width + SystemInformation.SmallIconSize.Width + 1, rect.Height + 1);
                 }
                 bool flag = true;
                 if (PrevVisibleItem != null && PrevVisibleItem.Selected)
                 {
                     flag = false;
                 }
                 if (flag)
                 {
                     graphics.DrawLine(pen, rect.Left, rect.Top, rect.Right, rect.Top);
                 }
                 graphics.DrawLine(pen, rect.Left, rect.Top, rect.Left, rect.Bottom);
                 flag = true;
                 if (NextVisibleItem != null && NextVisibleItem.Selected)
                 {
                     flag = false;
                 }
                 if (flag)
                 {
                     graphics.DrawLine(pen, rect.Left, rect.Bottom, rect.Right, rect.Bottom);
                 }
                 graphics.DrawLine(pen, rect.Right, rect.Top, rect.Right, rect.Bottom);
                 if (!TreeListView.FullRowSelect && NextVisibleItem != null && NextVisibleItem.Selected)
                 {
                     int width = NextVisibleItem.GetBounds(TreeListViewItemBoundsPortion.ItemOnly).Width;
                     if (width != bounds3.Width)
                     {
                         graphics.DrawLine(pen, rect.Right, rect.Bottom, rect.Right - (bounds3.Width - width), rect.Bottom);
                     }
                 }
                 pen.Dispose();
             }
         }
         graphics.Dispose();
     }
 }