Changeset 100 for trunk/MacFaceFloat/StatusWindow.cs
- Timestamp:
- Dec 9, 2007, 1:48:43 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MacFaceFloat/StatusWindow.cs
r98 r100 28 28 29 29 private Bitmap cpuGraph; 30 private Label label1; 31 private Label lblFree; 32 private Label label3; 33 private Label label4; 34 private Label label5; 35 private Label lblCommited; 36 private Label lblSysCache; 37 private Label lblSystem; 38 private Label label2; 39 private Label label6; 40 private Label label7; 41 private Label lblCPUUser; 42 private Label lblCPUSystem; 43 private Label lblCPUIdle; 30 44 private Bitmap memoryGraph; 31 45 … … 119 133 } 120 134 121 g.Dispose(); 135 if (cpuStats.Count > 0) 136 { 137 CPUUsage u = cpuStats[0]; 138 lblCPUUser.Text = u.User.ToString("###\\%"); 139 lblCPUSystem.Text = u.System.ToString("###\\%"); 140 lblCPUIdle.Text = u.Idle.ToString("###\\%"); 141 } 142 143 g.Dispose(); 122 144 } 123 145 … … 160 182 int h = 0; 161 183 162 UInt64 kernelTotal = usage.KernelNonPaged + usage.KernelPaged + usage.DriverTotal + usage.SystemCodeTotal; 163 h = (int)((kernelTotal) * rate); 184 h = (int)((usage.KernelTotal) * rate); 164 185 y -= h; 165 186 g.FillRectangle(kernelBrush, x, y, w, h); … … 169 190 g.FillRectangle(systemCacheBrush, x, y, w, h); 170 191 171 h = (int)((usage.Committed - kernelTotal) * rate);192 h = (int)((usage.Committed - usage.KernelTotal) * rate); 172 193 y -= h; 173 194 g.FillRectangle(commitedBrush, x, y, w, h); … … 198 219 g.DrawLine(borderPen, 0, fh-border, fw, fh-border); 199 220 200 g.Dispose(); 221 g.Dispose(); 222 223 if (memStats.Count > 0) 224 { 225 MemoryUsage u = memStats[0]; 226 lblFree.Text = (u.Available / (1048576.0)).ToString("######.0MB"); 227 lblCommited.Text = (u.Committed / (1048576.0)).ToString("######.0MB"); 228 lblSysCache.Text = (u.SystemCache / (1048576.0)).ToString("######.0MB"); 229 lblSystem.Text = (u.KernelTotal / (1048576.0)).ToString("######.0MB"); 230 } 201 231 } 202 232 … … 208 238 private void InitializeComponent() 209 239 { 210 System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(StatusWindow)); 211 this.memoryGraphPicBox = new System.Windows.Forms.PictureBox(); 212 this.cpuGraphPicBox = new System.Windows.Forms.PictureBox(); 213 this.SuspendLayout(); 214 // 215 // memoryGraphPicBox 216 // 217 this.memoryGraphPicBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 218 | System.Windows.Forms.AnchorStyles.Left) 219 | System.Windows.Forms.AnchorStyles.Right))); 220 this.memoryGraphPicBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 221 this.memoryGraphPicBox.Location = new System.Drawing.Point(7, 8); 222 this.memoryGraphPicBox.Name = "memoryGraphPicBox"; 223 this.memoryGraphPicBox.Size = new System.Drawing.Size(300, 100); 224 this.memoryGraphPicBox.TabIndex = 0; 225 this.memoryGraphPicBox.TabStop = false; 226 // 227 // cpuGraphPicBox 228 // 229 this.cpuGraphPicBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 230 | System.Windows.Forms.AnchorStyles.Right))); 231 this.cpuGraphPicBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 232 this.cpuGraphPicBox.Location = new System.Drawing.Point(7, 116); 233 this.cpuGraphPicBox.Name = "cpuGraphPicBox"; 234 this.cpuGraphPicBox.Size = new System.Drawing.Size(300, 100); 235 this.cpuGraphPicBox.TabIndex = 1; 236 this.cpuGraphPicBox.TabStop = false; 237 // 238 // StatusWindow 239 // 240 this.AutoScaleBaseSize = new System.Drawing.Size(5, 12); 241 this.ClientSize = new System.Drawing.Size(314, 223); 242 this.Controls.Add(this.cpuGraphPicBox); 243 this.Controls.Add(this.memoryGraphPicBox); 244 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 245 this.MaximizeBox = false; 246 this.MinimizeBox = false; 247 this.MinimumSize = new System.Drawing.Size(322, 250); 248 this.Name = "StatusWindow"; 249 this.Text = "Xe[^X"; 250 this.SizeChanged += new System.EventHandler(this.StatusWindow_SizeChanged); 251 this.ResumeLayout(false); 240 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(StatusWindow)); 241 this.memoryGraphPicBox = new System.Windows.Forms.PictureBox(); 242 this.cpuGraphPicBox = new System.Windows.Forms.PictureBox(); 243 this.label1 = new System.Windows.Forms.Label(); 244 this.lblFree = new System.Windows.Forms.Label(); 245 this.label3 = new System.Windows.Forms.Label(); 246 this.label4 = new System.Windows.Forms.Label(); 247 this.label5 = new System.Windows.Forms.Label(); 248 this.lblCommited = new System.Windows.Forms.Label(); 249 this.lblSysCache = new System.Windows.Forms.Label(); 250 this.lblSystem = new System.Windows.Forms.Label(); 251 this.label2 = new System.Windows.Forms.Label(); 252 this.label6 = new System.Windows.Forms.Label(); 253 this.label7 = new System.Windows.Forms.Label(); 254 this.lblCPUUser = new System.Windows.Forms.Label(); 255 this.lblCPUSystem = new System.Windows.Forms.Label(); 256 this.lblCPUIdle = new System.Windows.Forms.Label(); 257 ((System.ComponentModel.ISupportInitialize)(this.memoryGraphPicBox)).BeginInit(); 258 ((System.ComponentModel.ISupportInitialize)(this.cpuGraphPicBox)).BeginInit(); 259 this.SuspendLayout(); 260 // 261 // memoryGraphPicBox 262 // 263 this.memoryGraphPicBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 264 | System.Windows.Forms.AnchorStyles.Left) 265 | System.Windows.Forms.AnchorStyles.Right))); 266 this.memoryGraphPicBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 267 this.memoryGraphPicBox.Location = new System.Drawing.Point(7, 8); 268 this.memoryGraphPicBox.Name = "memoryGraphPicBox"; 269 this.memoryGraphPicBox.Size = new System.Drawing.Size(300, 100); 270 this.memoryGraphPicBox.TabIndex = 0; 271 this.memoryGraphPicBox.TabStop = false; 272 // 273 // cpuGraphPicBox 274 // 275 this.cpuGraphPicBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 276 | System.Windows.Forms.AnchorStyles.Right))); 277 this.cpuGraphPicBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 278 this.cpuGraphPicBox.Location = new System.Drawing.Point(7, 116); 279 this.cpuGraphPicBox.Name = "cpuGraphPicBox"; 280 this.cpuGraphPicBox.Size = new System.Drawing.Size(300, 100); 281 this.cpuGraphPicBox.TabIndex = 1; 282 this.cpuGraphPicBox.TabStop = false; 283 // 284 // label1 285 // 286 this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 287 this.label1.AutoSize = true; 288 this.label1.Location = new System.Drawing.Point(313, 12); 289 this.label1.Name = "label1"; 290 this.label1.Size = new System.Drawing.Size(28, 12); 291 this.label1.TabIndex = 2; 292 this.label1.Text = "Free"; 293 // 294 // lblFree 295 // 296 this.lblFree.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 297 this.lblFree.Location = new System.Drawing.Point(393, 12); 298 this.lblFree.Name = "lblFree"; 299 this.lblFree.Size = new System.Drawing.Size(62, 12); 300 this.lblFree.TabIndex = 3; 301 this.lblFree.Text = "00000.0MB"; 302 this.lblFree.TextAlign = System.Drawing.ContentAlignment.TopRight; 303 // 304 // label3 305 // 306 this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 307 this.label3.AutoSize = true; 308 this.label3.Location = new System.Drawing.Point(313, 32); 309 this.label3.Name = "label3"; 310 this.label3.Size = new System.Drawing.Size(56, 12); 311 this.label3.TabIndex = 2; 312 this.label3.Text = "Commited"; 313 // 314 // label4 315 // 316 this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 317 this.label4.AutoSize = true; 318 this.label4.Location = new System.Drawing.Point(313, 52); 319 this.label4.Name = "label4"; 320 this.label4.Size = new System.Drawing.Size(79, 12); 321 this.label4.TabIndex = 2; 322 this.label4.Text = "System Cache"; 323 // 324 // label5 325 // 326 this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 327 this.label5.AutoSize = true; 328 this.label5.Location = new System.Drawing.Point(313, 72); 329 this.label5.Name = "label5"; 330 this.label5.Size = new System.Drawing.Size(43, 12); 331 this.label5.TabIndex = 2; 332 this.label5.Text = "System"; 333 // 334 // lblCommited 335 // 336 this.lblCommited.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 337 this.lblCommited.Location = new System.Drawing.Point(393, 32); 338 this.lblCommited.Name = "lblCommited"; 339 this.lblCommited.Size = new System.Drawing.Size(62, 12); 340 this.lblCommited.TabIndex = 3; 341 this.lblCommited.Text = "00000.0MB"; 342 this.lblCommited.TextAlign = System.Drawing.ContentAlignment.TopRight; 343 // 344 // lblSysCache 345 // 346 this.lblSysCache.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 347 this.lblSysCache.Location = new System.Drawing.Point(393, 52); 348 this.lblSysCache.Name = "lblSysCache"; 349 this.lblSysCache.Size = new System.Drawing.Size(62, 12); 350 this.lblSysCache.TabIndex = 3; 351 this.lblSysCache.Text = "00000.0MB"; 352 this.lblSysCache.TextAlign = System.Drawing.ContentAlignment.TopRight; 353 // 354 // lblSystem 355 // 356 this.lblSystem.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 357 this.lblSystem.Location = new System.Drawing.Point(393, 72); 358 this.lblSystem.Name = "lblSystem"; 359 this.lblSystem.Size = new System.Drawing.Size(62, 12); 360 this.lblSystem.TabIndex = 3; 361 this.lblSystem.Text = "00000.0MB"; 362 this.lblSystem.TextAlign = System.Drawing.ContentAlignment.TopRight; 363 // 364 // label2 365 // 366 this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 367 this.label2.AutoSize = true; 368 this.label2.Location = new System.Drawing.Point(313, 116); 369 this.label2.Name = "label2"; 370 this.label2.Size = new System.Drawing.Size(29, 12); 371 this.label2.TabIndex = 4; 372 this.label2.Text = "User"; 373 // 374 // label6 375 // 376 this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 377 this.label6.AutoSize = true; 378 this.label6.Location = new System.Drawing.Point(313, 136); 379 this.label6.Name = "label6"; 380 this.label6.Size = new System.Drawing.Size(43, 12); 381 this.label6.TabIndex = 5; 382 this.label6.Text = "System"; 383 // 384 // label7 385 // 386 this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 387 this.label7.AutoSize = true; 388 this.label7.Location = new System.Drawing.Point(313, 157); 389 this.label7.Name = "label7"; 390 this.label7.Size = new System.Drawing.Size(23, 12); 391 this.label7.TabIndex = 6; 392 this.label7.Text = "Idle"; 393 // 394 // lblCPUUser 395 // 396 this.lblCPUUser.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 397 this.lblCPUUser.Location = new System.Drawing.Point(395, 116); 398 this.lblCPUUser.Name = "lblCPUUser"; 399 this.lblCPUUser.Size = new System.Drawing.Size(62, 12); 400 this.lblCPUUser.TabIndex = 7; 401 this.lblCPUUser.Text = "100%"; 402 this.lblCPUUser.TextAlign = System.Drawing.ContentAlignment.TopRight; 403 // 404 // lblCPUSystem 405 // 406 this.lblCPUSystem.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 407 this.lblCPUSystem.Location = new System.Drawing.Point(395, 136); 408 this.lblCPUSystem.Name = "lblCPUSystem"; 409 this.lblCPUSystem.Size = new System.Drawing.Size(62, 12); 410 this.lblCPUSystem.TabIndex = 8; 411 this.lblCPUSystem.Text = "100%"; 412 this.lblCPUSystem.TextAlign = System.Drawing.ContentAlignment.TopRight; 413 // 414 // lblCPUIdle 415 // 416 this.lblCPUIdle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 417 this.lblCPUIdle.Location = new System.Drawing.Point(395, 157); 418 this.lblCPUIdle.Name = "lblCPUIdle"; 419 this.lblCPUIdle.Size = new System.Drawing.Size(62, 12); 420 this.lblCPUIdle.TabIndex = 9; 421 this.lblCPUIdle.Text = "100%"; 422 this.lblCPUIdle.TextAlign = System.Drawing.ContentAlignment.TopRight; 423 // 424 // StatusWindow 425 // 426 this.AutoScaleBaseSize = new System.Drawing.Size(5, 12); 427 this.ClientSize = new System.Drawing.Size(460, 223); 428 this.Controls.Add(this.lblCPUIdle); 429 this.Controls.Add(this.lblCPUSystem); 430 this.Controls.Add(this.lblCPUUser); 431 this.Controls.Add(this.label7); 432 this.Controls.Add(this.label6); 433 this.Controls.Add(this.label2); 434 this.Controls.Add(this.lblSystem); 435 this.Controls.Add(this.lblSysCache); 436 this.Controls.Add(this.lblCommited); 437 this.Controls.Add(this.lblFree); 438 this.Controls.Add(this.label5); 439 this.Controls.Add(this.label4); 440 this.Controls.Add(this.label3); 441 this.Controls.Add(this.label1); 442 this.Controls.Add(this.cpuGraphPicBox); 443 this.Controls.Add(this.memoryGraphPicBox); 444 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 445 this.MaximizeBox = false; 446 this.MinimizeBox = false; 447 this.MinimumSize = new System.Drawing.Size(476, 260); 448 this.Name = "StatusWindow"; 449 this.Text = "Xe[^X"; 450 this.SizeChanged += new System.EventHandler(this.StatusWindow_SizeChanged); 451 this.Load += new System.EventHandler(this.StatusWindow_Load); 452 ((System.ComponentModel.ISupportInitialize)(this.memoryGraphPicBox)).EndInit(); 453 ((System.ComponentModel.ISupportInitialize)(this.cpuGraphPicBox)).EndInit(); 454 this.ResumeLayout(false); 455 this.PerformLayout(); 252 456 253 457 } … … 263 467 memoryGraphPicBox.Image = memoryGraph; 264 468 } 469 470 private void StatusWindow_Load(object sender, EventArgs e) 471 { 472 473 } 265 474 } 266 475 }
Note: See TracChangeset
for help on using the changeset viewer.