Changeset 50


Ignore:
Timestamp:
Mar 29, 2005, 11:32:18 PM (19 years ago)
Author:
altba\rryu
Message:

てきとーなグラフ表示とはいえ毎日見るには耐えないので、少しかっこよくしてみた。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MacFaceFloat/MacFaceApp.cs

    r49 r50  
    108108                        // ƒXƒe[ƒ^ƒXƒEƒCƒ“ƒhƒE         
    109109                        statusWindow = new Form();
    110                         statusWindow.ClientSize = new System.Drawing.Size(300, 211);
     110                        statusWindow.ClientSize = new System.Drawing.Size(310, 215);
    111111                        statusWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
    112112                        statusWindow.ControlBox = false;
    113113                        statusWindow.Icon = new Icon(asm.GetManifestResourceStream("MacFace.FloatApp.App.ico"));
    114                         statusWindow.Text = "Status";
     114                        statusWindow.Text = "ƒXƒe[ƒ^ƒX";
    115115                        statusWindow.Paint +=new PaintEventHandler(statusWindow_Paint);
    116116                }
     
    319319                        g.SmoothingMode = SmoothingMode.AntiAlias;
    320320
    321                         g.FillRectangle(new SolidBrush(Color.White), 0, 0, 300, 100);
    322                         for (int y = 0; y < 100; y += 10)
    323                         {
    324                                 g.DrawLine(Pens.FloralWhite, 0, y, 300, y);
    325                         }
    326 
    327                         g.FillRectangle(new SolidBrush(Color.White), 0, 110, 300, 100);
     321                        g.FillRectangle(new SolidBrush(Color.White), 5, 5, 300, 100);
     322                        Pen pen = new Pen(Color.FromArgb(220, 220, 220), 1F);
     323                        for (int y = 5; y < 105; y += 10)
     324                        {
     325                                g.DrawLine(pen, 5, y, 305, y);
     326                        }
     327                        g.DrawRectangle(Pens.Black, 4, 4, 301, 101);
     328
     329                        g.FillRectangle(new SolidBrush(Color.White), 5, 110, 300, 100);
    328330                        for (int y = 110; y < 210; y += 10)
    329331                        {
    330                                 g.DrawLine(Pens.FloralWhite, 0, y, 300, y);
    331                         }
     332                                g.DrawLine(pen, 5, y, 305, y);
     333                        }
     334                        g.DrawRectangle(Pens.Black, 4, 109, 301, 101);
    332335
    333336
    334337                        if (cpuHistoryCount >= 2)
    335338                        {
    336                                 Point[] userGraph = new Point[cpuHistoryCount];
    337                                 Point[] sysGraph = new Point[cpuHistoryCount];
     339                                Point[] userGraph = new Point[cpuHistoryCount+2];
     340                                Point[] sysGraph = new Point[cpuHistoryCount+2];
     341
     342                                userGraph[cpuHistoryCount+0].X = 305 - cpuHistoryCount * 5;
     343                                userGraph[cpuHistoryCount+0].Y = 105 - 0;
     344                                userGraph[cpuHistoryCount+1].X = 305 - 0 * 5;
     345                                userGraph[cpuHistoryCount+1].Y = 105 - 0;
     346
     347                                sysGraph[cpuHistoryCount+0].X = 305 - cpuHistoryCount * 5;
     348                                sysGraph[cpuHistoryCount+0].Y = 105 - 0;
     349                                sysGraph[cpuHistoryCount+1].X = 305 - 0 * 5;
     350                                sysGraph[cpuHistoryCount+1].Y = 105 - 0;
    338351
    339352                                int pos = cpuHistoryHead - 1;
     
    342355                                        if (pos < 0) pos = cpuHistory.Length - 1;
    343356                                        CPUUsage usage = cpuHistory[pos];
    344                                         userGraph[i].X = sysGraph[i].X = 300 - i * 5;
    345                                         userGraph[i].Y = 100 - usage.Active;
    346                                         sysGraph[i].Y = 100 - usage.System;
    347                                         //Console.WriteLine("" + pos + ": " + points[i]);
     357                                        userGraph[i].X = sysGraph[i].X = 305 - i * 5;
     358                                        userGraph[i].Y = 105 - usage.Active;
     359                                        sysGraph[i].Y = 105 - usage.System;
    348360                                        pos--;
    349361                                }
    350362
    351                                 g.DrawLines(Pens.Red, sysGraph);
    352                                 g.DrawLines(Pens.Blue, userGraph);
     363                                g.FillPolygon(new SolidBrush(Color.FromArgb(64, 0, 0, 255)), userGraph);
     364                                g.DrawPolygon(new Pen(Color.FromArgb(0, 0, 255), 1F), userGraph);
     365                                g.FillPolygon(new SolidBrush(Color.FromArgb(64, 255, 0, 0)), sysGraph);
    353366                        }
    354367
    355368                        double rate = 70.0 / (MemoryUsageCounter.TotalVisibleMemorySize * 1024);
    356369
     370                        g.SmoothingMode = SmoothingMode.None;
     371                        Brush brush = new SolidBrush(Color.FromArgb(180, 255, 145, 0));
    357372                        int posu = memHistoryHead - 1;
    358373                        for (int i = 0; i < memHistoryCount; i++)
     
    363378                                int x, y, w, h;
    364379
    365                                 x = 300 - i * 5;
     380                                x = 305 - i * 5 - 5;
    366381                                w = 5;
    367382                                h = (int)(usage.Committed * rate);
    368383                                y = 210 - h;
    369                                 g.FillRectangle(Brushes.Blue, x, y, w, h);
    370 
    371                                 x = 300 - i * 5;
     384                                g.FillRectangle(brush, x, y, w, h);
     385
     386                                x = 305 - i * 5 - 5;
    372387                                w = 2;
    373388                                h = (int)(usage.Pagein);
     
    375390                                g.FillRectangle(Brushes.LightGray, x, y, w, h);
    376391
    377                                 x = 303 - i * 5;
     392                                x = 308 - i * 5 - 5;
    378393                                w = 2;
    379394                                h = (int)(usage.Pageout);
     
    383398                                posu--;
    384399                        }
    385                         g.DrawLine(Pens.Red, 0, 210-70, 300, 210-70);
     400                        g.DrawLine(Pens.Red, 5, 210-70, 305, 210-70);
    386401                }
    387402        }
Note: See TracChangeset for help on using the changeset viewer.