Exemplo n.º 1
0
 protected override void OnHandleCreated(EventArgs e)
 {
     base.OnHandleCreated(e);
     if (DesignMode == false)
     {
         hTheme = TaskMgrListApis.MOpenThemeData(Handle, "HEADER");
     }
 }
Exemplo n.º 2
0
 protected override void DestroyHandle()
 {
     if (!DesignMode)
     {
         TaskMgrListApis.MCloseThemeData(hThemeListView);
         hThemeListView = IntPtr.Zero;
     }
     base.DestroyHandle();
 }
Exemplo n.º 3
0
 protected override void CreateHandle()
 {
     base.CreateHandle();
     if (!DesignMode)
     {
         TaskMgrListApis.MSetAsExplorerTheme(Handle);
         hThemeListView = TaskMgrListApis.MOpenThemeData(Handle, "LISTVIEW");
     }
 }
Exemplo n.º 4
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (!DesignMode)
         {
             TaskMgrListApis.MCloseThemeData(hTheme);
         }
         hTheme = IntPtr.Zero;
     }
     base.Dispose(disposing);
 }
Exemplo n.º 5
0
        private void DrawItem(Graphics g, PerformanceListItem it, int y)
        {
            if (it == mouseEnterItem)
            {
                TaskMgrListApis.MListDrawItem(hThemeListView, g.GetHdc(), 2, mouseEnterItem.ItemY + 1 - yOffest, Width - 6, mouseEnterItem.ItemHeight - 2, TaskMgrListApis.M_DRAW_LISTVIEW_HOT);
                g.ReleaseHdc();
            }
            else if (it == selectedItem)
            {
                TaskMgrListApis.MListDrawItem(hThemeListView, g.GetHdc(), 2, selectedItem.ItemY + 1 - yOffest, Width - 6, selectedItem.ItemHeight - 2, TaskMgrListApis.M_DRAW_LISTVIEW_SELECT);
                g.ReleaseHdc();
            }

            g.DrawString(it.Name, hugeTextFont, Brushes.Black, 80, y + 10);
            g.DrawString(it.SmallText, smallTextFont, Brushes.Black, 80, y + 30);

            DrawItemDataGrid(g, it, y);
        }
Exemplo n.º 6
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (Vsitem())
            {
                return;
            }

            Graphics g = e.Graphics;

            using (Pen p = new Pen(lineBrush))
            {
                TaskMgrListHeaderItem thisItem = null;
                int  h         = Height - 1;
                bool arrdrawed = false;
                for (int i = 0; i < sortedItems.Count; i++)
                {
                    thisItem = sortedItems[i];

                    int x = (thisItem.IsMoveing ? (thisItem.MovingDrawX - XOffest) : (thisItem.X - XOffest));

                    if (thisItem == enteredItem)
                    {
                        if (thisItem.IsHot)
                        {
                            g.FillRectangle(hotBrushHover, new Rectangle((x + 1), 0, thisItem.Width - 1, h));
                        }
                        else
                        {
                            TaskMgrListApis.MHeaderDrawItem(hTheme, g.GetHdc(), (x + 1), 0, thisItem.Width - 1, h, TaskMgrListApis.M_DRAW_HEADER_HOT);
                            g.ReleaseHdc();
                        }
                    }
                    else if (thisItem.IsHot)
                    {
                        g.FillRectangle(hotBrush, new Rectangle((x + 1), 0, thisItem.Width - 1, h));
                    }

                    string tb = thisItem.TextBig;
                    string ts = thisItem.TextSmall;
                    if (tb != "" || ts != "")
                    {
                        StringFormat f = thisItem.AlignmentStringFormat;
                        if (tb != "")
                        {
                            g.DrawString(tb, fb, Brushes.Black, new Rectangle(x + 3, 10, thisItem.Width - 6, 24), f);
                        }
                        if (ts != "")
                        {
                            g.DrawString(ts, fs, new SolidBrush(Color.FromArgb(76, 96, 122)), new Rectangle(x + 3, Height - 22, thisItem.Width - 6, 18), f);
                        }
                    }
                    if (!arrdrawed)
                    {
                        if (thisItem.ArrowType == TaskMgrListHeaderSortArrow.Ascending)
                        {
                            int posx = x + thisItem.Width / 2 - 4;
                            TaskMgrListApis.MHeaderDrawItem(hTheme, g.GetHdc(), posx, 0, 9, 6, TaskMgrListApis.M_DRAW_HEADER_SORTUP);
                            g.ReleaseHdc();
                            arrdrawed = true;
                        }
                        else if (thisItem.ArrowType == TaskMgrListHeaderSortArrow.Descending)
                        {
                            int posx = x + thisItem.Width / 2 - 4;
                            TaskMgrListApis.MHeaderDrawItem(hTheme, g.GetHdc(), posx, 0, 9, 6, TaskMgrListApis.M_DRAW_HEADER_SORTDOWN);
                            g.ReleaseHdc();
                            arrdrawed = true;
                        }
                    }
                    g.DrawLine(p, new Point(x + thisItem.Width, 0), new Point(x + thisItem.Width, h));
                    if (thisItem.DrawBlueLine)
                    {
                        if (drawBlueLineRight)
                        {
                            g.DrawLine(blueLinePen, new Point(thisItem.X + thisItem.Width, 0), new Point(thisItem.X + thisItem.Width, h));
                        }
                        else if (drawBlueLineLeft)
                        {
                            g.DrawLine(blueLinePen, new Point(thisItem.X, 0), new Point(thisItem.X, h));
                        }
                    }
                }
                g.DrawLine(new Pen(Color.FromArgb(160, 160, 160)), new Point(0, Height - 1), new Point(Width, Height - 1));
            }
        }