protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); e.Graphics.DrawImage(Resources.shadow, new Rectangle(0, 0, 512, 352)); using (SolidBrush brush = new SolidBrush(Color.FromArgb(230, 56, 56, 56))) { e.Graphics.FillRectangle(brush, ClientArea); } if (_draging) { e.Graphics.DrawImage(Resources.drag, ClientArea); } e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; using (SolidBrush brush = new SolidBrush(Color.White)) { using (StringFormat sf = StringFormat.GenericDefault) { sf.LineAlignment = StringAlignment.Center; sf.Alignment = StringAlignment.Center; sf.FormatFlags = StringFormatFlags.NoWrap; sf.Trimming = StringTrimming.EllipsisCharacter; if (_files.Count <= 0) { e.Graphics.DrawString(Resources.Normal, Font, brush, ClientArea, sf); } } } int _offsetY = 0; // graphics item for (int i = 0; i < _files.Count; i++) { NeteaseCrypto f = _files[i]; RectangleF imgRect = new RectangleF(ClientArea.X, ClientArea.Y + _offsetY, ITEM_HEIGHT, ITEM_HEIGHT); float fpw = (ClientArea.Width - imgRect.Width) / 100f; RectangleF fillProgress = new RectangleF(imgRect.Right, ClientArea.Y + _offsetY, (float)f.Progress * fpw, ITEM_HEIGHT); RectangleF nameRect = new RectangleF(imgRect.Right + 5, ClientArea.Y + _offsetY, ClientArea.Width / 2.8f, ITEM_HEIGHT); RectangleF artistRect = new RectangleF(nameRect.Right, ClientArea.Y + _offsetY, nameRect.Width, ITEM_HEIGHT); RectangleF progressRect = new RectangleF(artistRect.Right, ClientArea.Y + _offsetY, ClientArea.Width - artistRect.Right, ITEM_HEIGHT); using (HightQualityGraphics _ = new HightQualityGraphics(e.Graphics)) { e.Graphics.DrawImage(f.Cover, imgRect); } using (SolidBrush brush = new SolidBrush(Color.FromArgb(120, 0, 0, 0))) { e.Graphics.FillRectangle(brush, fillProgress); } using (SolidBrush brush = new SolidBrush(Color.White)) { using (StringFormat sf = StringFormat.GenericTypographic) { sf.LineAlignment = StringAlignment.Center; sf.FormatFlags = StringFormatFlags.NoWrap; sf.Trimming = StringTrimming.EllipsisCharacter; e.Graphics.DrawString(f.Name, Font, brush, nameRect, sf); e.Graphics.DrawString(String.Join("/", f.Artist), Font, brush, artistRect, sf); e.Graphics.DrawString(string.Format("{0:F}%", f.Progress), Font, brush, progressRect, sf); } } _offsetY += ITEM_HEIGHT; } e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault; }