Changeset 54

Show
Ignore:
Timestamp:
04/07/05 23:36:37 (4 years ago)
Author:
altba\rryu
Message:

・Alt+F4でウインドウを閉じなくした。
・ステータスウインドウの表示位置を保存するようにした。

Files:

Legend:

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

    r30 r54  
    4848                [Category("���H�[��"), Description("�}�E�X���b�Z�[�W�𓧉߂����邩�ǂ�����肵�܂��B")] 
    4949                public bool TransparentMouseMessage; 
     50 
     51                [AutoConfigure("form.status.point")] 
     52                [Category("�X�e�[�^�X�E�C���h�E"), Description("�\���ʒu")] 
     53                public Point StatusWindowLocation; 
    5054 
    5155                public static Configuration GetInstance() 
  • trunk/MacFaceFloat/MacFaceApp.cs

    r53 r54  
    3232                private MemoryUsageCounter memoryCounter; 
    3333 
    34                 private Form statusWindow; 
     34                private StatusWindow statusWindow; 
    3535                private Bitmap cpuGraph; 
    3636                private Bitmap memoryGraph; 
     
    106106                        // �p�^�[���E�C���h�E 
    107107                        this.patternWindow = new PatternWindow(); 
     108                        this.patternWindow.Closing += new System.ComponentModel.CancelEventHandler(patternWindow_Closing); 
    108109 
    109110                        // �X�e�[�^�X�E�C���h�E 
    110111                        cpuGraph = new Bitmap(5*60, 100); 
    111112                        memoryGraph = new Bitmap(5*60, 100); 
    112  
    113                         statusWindow = new Form(); 
    114                         statusWindow.ClientSize = new System.Drawing.Size(310, 215); 
    115                         statusWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 
    116                         statusWindow.ControlBox = false; 
    117                         statusWindow.MaximizeBox = false; 
    118                         statusWindow.MinimizeBox = false; 
    119                         statusWindow.Icon = new Icon(asm.GetManifestResourceStream("MacFace.FloatApp.App.ico")); 
    120                         statusWindow.Text = "�X�e�[�^�X"; 
    121                         statusWindow.Paint +=new PaintEventHandler(statusWindow_Paint); 
     113                        statusWindow = new StatusWindow(); 
     114                        patternWindow.Closing += new System.ComponentModel.CancelEventHandler(patternWindow_Closing); 
     115                        statusWindow.cpuGraphPicBox.Image = cpuGraph; 
     116                        statusWindow.memoryGraphPicBox.Image = memoryGraph; 
    122117                } 
    123118 
     
    142137                        drawCPUGraph(); 
    143138                        drawMemoryGraph(); 
     139                        statusWindow.Location = config.StatusWindowLocation; 
    144140                        statusWindow.Show(); 
    145141 
     
    163159                        // �ۑ� 
    164160                        config.Location = patternWindow.Location; 
     161                        config.StatusWindowLocation = statusWindow.Location; 
    165162                        config.Save(); 
    166163                } 
     
    279276                        drawCPUGraph(); 
    280277                        drawMemoryGraph(); 
    281                         statusWindow.Invalidate(); 
     278                        statusWindow.cpuGraphPicBox.Invalidate(); 
     279                        statusWindow.memoryGraphPicBox.Invalidate(); 
    282280                } 
    283281 
     
    399397                        Brush commitedBrush = new SolidBrush(Color.FromArgb(180, 255, 145, 0)); 
    400398                        Brush uncommitedBrush = new SolidBrush(Color.FromArgb(180, 180, 200, 255)); 
    401                         Brush availableBrush = new SolidBrush(Color.FromArgb(100, 100, 100, 255)); 
     399                        Brush availableBrush = new SolidBrush(Color.FromArgb(180, 100, 100, 255)); 
    402400                        Brush spaceBrush = new SolidBrush(Color.FromArgb(180, 240, 230, 255)); 
    403401 
     
    413411                                w = 5; 
    414412 
    415                                 h = 100 - border; 
     413                                h = (int)(usage.Available * rate); 
     414                                y = 100 - h; 
     415                                g.FillRectangle(availableBrush, x, y, w, h); 
     416 
     417                                h = (int)(usage.Committed * rate); 
     418                                y -= h; 
     419                                g.FillRectangle(commitedBrush, x, y, w, h); 
     420 
     421                                if (y > 100 - border)  
     422                                { 
     423                                        h = y - (100 - border); 
     424                                        y = 100 - border; 
     425                                        g.FillRectangle(uncommitedBrush, x, y, w, h); 
     426                                } 
     427 
     428                                h = y; 
    416429                                y = 0; 
    417430                                g.FillRectangle(spaceBrush, x, y, w, h); 
    418  
    419                                 h = (int)(usage.Committed * rate); 
    420                                 y = 100 - h; 
    421                                 g.FillRectangle(commitedBrush, x, y, w, h); 
    422  
    423                                 if (h < border)  
    424                                 { 
    425                                         h = border - h; 
    426                                         y = 100 - border; 
    427                                         g.FillRectangle(uncommitedBrush, x, y, w, h); 
    428                                 } 
    429  
    430                                 h = (int)(usage.Available * rate); 
    431                                 y = 100 - border; 
    432                                 g.FillRectangle(availableBrush, x, y, w, h); 
    433431 
    434432                                x = 300 - i * 5 - 5; 
     
    452450                        g.Dispose(); 
    453451                } 
     452 
     453                private void patternWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) 
     454                { 
     455                        e.Cancel = true; 
     456                } 
    454457        } 
    455458}