Changeset 50

Show
Ignore:
Timestamp:
03/29/05 23:32:18 (4 years ago)
Author:
altba\rryu
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/MacFaceFloat/MacFaceApp.cs

    r49 r50  
    107107                        // �X�e�[�^�X�E�C���h�E          
    108108                        statusWindow = new Form(); 
    109                         statusWindow.ClientSize = new System.Drawing.Size(300, 211); 
     109                        statusWindow.ClientSize = new System.Drawing.Size(310, 215); 
    110110                        statusWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 
    111111                        statusWindow.ControlBox = false; 
    112112                        statusWindow.Icon = new Icon(asm.GetManifestResourceStream("MacFace.FloatApp.App.ico")); 
    113                         statusWindow.Text = "Status"; 
     113                        statusWindow.Text = "�X�e�[�^�X"; 
    114114                        statusWindow.Paint +=new PaintEventHandler(statusWindow_Paint); 
    115115                } 
     
    316316                        g.SmoothingMode = SmoothingMode.AntiAlias; 
    317317 
    318                         g.FillRectangle(new SolidBrush(Color.White), 0, 0, 300, 100); 
    319                         for (int y = 0; y < 100; y += 10)  
    320                         { 
    321                                 g.DrawLine(Pens.FloralWhite, 0, y, 300, y); 
    322                         } 
    323  
    324                         g.FillRectangle(new SolidBrush(Color.White), 0, 110, 300, 100); 
     318                        g.FillRectangle(new SolidBrush(Color.White), 5, 5, 300, 100); 
     319                        Pen pen = new Pen(Color.FromArgb(220, 220, 220), 1F); 
     320                        for (int y = 5; y < 105; y += 10)  
     321                        { 
     322                                g.DrawLine(pen, 5, y, 305, y); 
     323                        } 
     324                        g.DrawRectangle(Pens.Black, 4, 4, 301, 101); 
     325 
     326                        g.FillRectangle(new SolidBrush(Color.White), 5, 110, 300, 100); 
    325327                        for (int y = 110; y < 210; y += 10)  
    326328                        { 
    327                                 g.DrawLine(Pens.FloralWhite, 0, y, 300, y); 
    328                         } 
     329                                g.DrawLine(pen, 5, y, 305, y); 
     330                        } 
     331                        g.DrawRectangle(Pens.Black, 4, 109, 301, 101); 
    329332 
    330333 
    331334                        if (cpuHistoryCount >= 2)  
    332335                        { 
    333                                 Point[] userGraph = new Point[cpuHistoryCount]; 
    334                                 Point[] sysGraph = new Point[cpuHistoryCount]; 
     336                                Point[] userGraph = new Point[cpuHistoryCount+2]; 
     337                                Point[] sysGraph = new Point[cpuHistoryCount+2]; 
     338 
     339                                userGraph[cpuHistoryCount+0].X = 305 - cpuHistoryCount * 5; 
     340                                userGraph[cpuHistoryCount+0].Y = 105 - 0; 
     341                                userGraph[cpuHistoryCount+1].X = 305 - 0 * 5; 
     342                                userGraph[cpuHistoryCount+1].Y = 105 - 0; 
     343 
     344                                sysGraph[cpuHistoryCount+0].X = 305 - cpuHistoryCount * 5; 
     345                                sysGraph[cpuHistoryCount+0].Y = 105 - 0; 
     346                                sysGraph[cpuHistoryCount+1].X = 305 - 0 * 5; 
     347                                sysGraph[cpuHistoryCount+1].Y = 105 - 0; 
    335348 
    336349                                int pos = cpuHistoryHead - 1; 
     
    339352                                        if (pos < 0) pos = cpuHistory.Length - 1; 
    340353                                        CPUUsage usage = cpuHistory[pos]; 
    341                                         userGraph[i].X = sysGraph[i].X = 300 - i * 5; 
    342                                         userGraph[i].Y = 100 - usage.Active; 
    343                                         sysGraph[i].Y = 100 - usage.System; 
    344                                         //Console.WriteLine("" + pos + ": " + points[i]); 
     354                                        userGraph[i].X = sysGraph[i].X = 305 - i * 5; 
     355                                        userGraph[i].Y = 105 - usage.Active; 
     356                                        sysGraph[i].Y = 105 - usage.System; 
    345357                                        pos--; 
    346358                                } 
    347359 
    348                                 g.DrawLines(Pens.Red, sysGraph); 
    349                                 g.DrawLines(Pens.Blue, userGraph); 
     360                                g.FillPolygon(new SolidBrush(Color.FromArgb(64, 0, 0, 255)), userGraph); 
     361                                g.DrawPolygon(new Pen(Color.FromArgb(0, 0, 255), 1F), userGraph); 
     362                                g.FillPolygon(new SolidBrush(Color.FromArgb(64, 255, 0, 0)), sysGraph); 
    350363                        } 
    351364 
    352365                        double rate = 70.0 / (MemoryUsageCounter.TotalVisibleMemorySize * 1024); 
    353366 
     367                        g.SmoothingMode = SmoothingMode.None; 
     368                        Brush brush = new SolidBrush(Color.FromArgb(180, 255, 145, 0)); 
    354369                        int posu = memHistoryHead - 1; 
    355370                        for (int i = 0; i < memHistoryCount; i++)  
     
    360375                                int x, y, w, h; 
    361376 
    362                                 x = 300 - i * 5; 
     377                                x = 305 - i * 5 - 5; 
    363378                                w = 5; 
    364379                                h = (int)(usage.Committed * rate); 
    365380                                y = 210 - h; 
    366                                 g.FillRectangle(Brushes.Blue, x, y, w, h); 
    367  
    368                                 x = 300 - i * 5; 
     381                                g.FillRectangle(brush, x, y, w, h); 
     382 
     383                                x = 305 - i * 5 - 5; 
    369384                                w = 2; 
    370385                                h = (int)(usage.Pagein); 
     
    372387                                g.FillRectangle(Brushes.LightGray, x, y, w, h); 
    373388 
    374                                 x = 303 - i * 5; 
     389                                x = 308 - i * 5 - 5; 
    375390                                w = 2; 
    376391                                h = (int)(usage.Pageout); 
     
    380395                                posu--; 
    381396                        } 
    382                         g.DrawLine(Pens.Red, 0, 210-70, 300, 210-70); 
     397                        g.DrawLine(Pens.Red, 5, 210-70, 305, 210-70); 
    383398                } 
    384399        }