private void PnlData_Paint(object sender, PaintEventArgs e) { if (GameFile == null) { return; } DpiScale dpiScale = new DpiScale(e.Graphics); float xPos = gameTile.Location.X + dpiScale.ScaleIntX(4); int yPos = dpiScale.ScaleIntY(8); int offset = dpiScale.ScaleIntY(22); e.Graphics.DrawString("Filename", DisplayBoldFont, TextBrush, xPos, yPos); yPos += offset; e.Graphics.DrawString("Title", DisplayBoldFont, TextBrush, xPos, yPos); yPos += offset; e.Graphics.DrawString("Author", DisplayBoldFont, TextBrush, xPos, yPos); yPos += offset; e.Graphics.DrawString("Release", DisplayBoldFont, TextBrush, xPos, yPos); yPos += offset; e.Graphics.DrawString("Played", DisplayBoldFont, TextBrush, xPos, yPos); yPos += offset; e.Graphics.DrawString("Maps", DisplayBoldFont, TextBrush, xPos, yPos); yPos += offset; e.Graphics.DrawString("Tags", DisplayBoldFont, TextBrush, xPos, yPos); xPos = gameTile.Location.X + dpiScale.ScaleFloatX(82); yPos = dpiScale.ScaleIntY(8); SizeF maxLabelSize = new SizeF(pnlData.ClientRectangle.Width - xPos + dpiScale.ScaleIntX(8), 16); e.Graphics.DrawString(GameFile.FileNameNoPath, DisplayFont, Brushes.Black, xPos, yPos); yPos += offset; e.Graphics.DrawString(Util.GetClippedEllipsesText(e.Graphics, DisplayFont, GameFile.Title, maxLabelSize), DisplayFont, TextBrush, xPos, yPos); yPos += offset; e.Graphics.DrawString(Util.GetClippedEllipsesText(e.Graphics, DisplayFont, GameFile.Author, maxLabelSize), DisplayFont, TextBrush, xPos, yPos); yPos += offset; e.Graphics.DrawString(m_release, DisplayFont, TextBrush, xPos, yPos); yPos += offset; e.Graphics.DrawString(m_played, DisplayFont, TextBrush, xPos, yPos); yPos += offset; e.Graphics.DrawString(m_maps, DisplayFont, TextBrush, xPos, yPos); yPos += offset; e.Graphics.DrawString(m_tags, DisplayFont, TextBrush, xPos, yPos); }
private void GameFileTile_Paint(object sender, PaintEventArgs e) { if (GameFile == null) { return; } DpiScale dpiScale = new DpiScale(e.Graphics); int labelHeight = dpiScale.ScaleIntY(LabelHeight); int pad = dpiScale.ScaleIntX(1); SizeF layout = new SizeF(Width, 16); string text; if (!string.IsNullOrEmpty(GameFile.Title)) { text = Util.GetClippedEllipsesText(e.Graphics, DisplayFont, GameFile.Title, layout); } else { text = GameFile.FileNameNoPath; } SizeF size = e.Graphics.MeasureDisplayString(text, DisplayFont); float x = Width - size.Width - (Width - size.Width) / 2; float y = Height - size.Height - (labelHeight - size.Height) / 2; if (Selected) { e.Graphics.DrawString(text, DisplayFont, new SolidBrush(SystemColors.HighlightText), x, y); } else { e.Graphics.DrawString(text, DisplayFont, new SolidBrush(m_titleColor), x, y); } if (DrawBorder && !Selected) { e.Graphics.DrawRectangle(SeparatorPen, 0, 0, Width - pad, Height - pad); } }