BExplorer.Shell.ShellView.DrawComputerTiledModeView C# (CSharp) Method

DrawComputerTiledModeView() private method

private DrawComputerTiledModeView ( IListItemEx sho, Graphics g, RectangleF lblrectTiles, StringFormat fmt ) : void
sho IListItemEx
g Graphics
lblrectTiles RectangleF
fmt StringFormat
return void
    private void DrawComputerTiledModeView(IListItemEx sho, Graphics g, RectangleF lblrectTiles, StringFormat fmt) {
      var driveInfo = new DriveInfo(sho.ParsingName);
      if (driveInfo.IsReady) {
        ProgressBarRenderer.DrawHorizontalBar(g, new Rectangle((Int32)lblrectTiles.Left, (Int32)lblrectTiles.Bottom + 4, (Int32)lblrectTiles.Width - 10, 10));
        var fullProcent = (100 * (driveInfo.TotalSize - driveInfo.AvailableFreeSpace)) / driveInfo.TotalSize;
        var barWidth = (lblrectTiles.Width - 12) * fullProcent / 100;
        var rec = new Rectangle((Int32)lblrectTiles.Left + 1, (Int32)lblrectTiles.Bottom + 5, (Int32)barWidth, 8);
        var gradRec = new Rectangle(rec.Left, rec.Top - 1, rec.Width, rec.Height + 2);
        var criticalUsed = fullProcent >= 90;
        var warningUsed = fullProcent >= 75;
        var averageUsed = fullProcent >= 50;
        var brush = new LinearGradientBrush(gradRec,
                                                                        criticalUsed ? Color.FromArgb(255, 0, 0) : warningUsed ? Color.FromArgb(255, 224, 0) : averageUsed ? Color.FromArgb(0, 220, 255) : Color.FromArgb(199, 248, 165),
                                                                        criticalUsed ? Color.FromArgb(150, 0, 0) : warningUsed ? Color.FromArgb(255, 188, 0) : averageUsed ? Color.FromArgb(43, 84, 235) : Color.FromArgb(101, 247, 0),
                                                                        LinearGradientMode.Vertical);
        g.FillRectangle(brush, rec);
        brush.Dispose();
        var lblrectSubiTem3 = new RectangleF(lblrectTiles.Left, lblrectTiles.Bottom + 16, lblrectTiles.Width, 15);
        Font subItemFont = System.Drawing.SystemFonts.IconTitleFont;
        var subItemTextBrush = new SolidBrush(System.Drawing.SystemColors.ControlDarkDark);
        g.DrawString($"{ShlWapi.StrFormatByteSize(driveInfo.AvailableFreeSpace)} free of {ShlWapi.StrFormatByteSize(driveInfo.TotalSize)}",
                                                                        subItemFont, subItemTextBrush, lblrectSubiTem3, fmt);

        subItemFont.Dispose();
        subItemTextBrush.Dispose();
      }
    }
ShellView