private void DrawTextInfo(Graphics g) { if (SelectedGame == null) { return; } string gameName = SelectedGame.IsParent ? SelectedGame.Name : SelectedGame.ParentSet; int maxRows = 0; int chars; Info info = new Info(); string text = ""; StringFormat stringFormat = new StringFormat(); //Calculate the Area to draw the text in. SizeF size = new SizeF((float)ClientRectangle.Width / 2, 100000); ; RectangleF rectangleF = new RectangleF(((float)ClientRectangle.Width / 2), ArtOffset, ((float)ClientRectangle.Width / 2) - ArtOffset, ClientRectangle.Height - ArtOffset * 2); //Find out if we are reading MameInfo or History string textType = Path.GetFileNameWithoutExtension(SettingsManager.ArtPaths[ArtType]); if (textType.Equals("mameinfo", StringComparison.InvariantCultureIgnoreCase)) { if (MameInfo == null) { MameInfo = new InfoParser(SettingsManager.ArtPaths[ArtType]); } if (!MameInfo.Contains(gameName.Replace("fav_", ""))) { return; } info = MameInfo[gameName.Replace("fav_", "")]; } else if (textType.Equals("history", StringComparison.InvariantCultureIgnoreCase)) { if (History == null) { History = new InfoParser(SettingsManager.ArtPaths[ArtType]); } if (!History.Contains(gameName.Replace("fav_", ""))) { return; } info = History[gameName.Replace("fav_", "")]; } else { return; } _currentInfo = info; text = GetShortInfoText(); _currentInfoText = text; g.MeasureString(text, Settings.Default.info_font, size, stringFormat, out chars, out maxRows); g.DrawString(text, Settings.Default.info_font, new SolidBrush(Settings.Default.info_font_color), rectangleF, stringFormat); _imageArea = new Rectangle((int)rectangleF.X, (int)rectangleF.Y, (int)rectangleF.Width, (int)rectangleF.Height); info.TotalRows = maxRows; info.VisibleRows = GetVisibleRows(_currentInfoText); }
private void DrawTextInfo(Graphics g) { if (SelectedGame == null) return; string gameName = SelectedGame.IsParent ? SelectedGame.Name : SelectedGame.ParentSet; int maxRows = 0; int chars; Info info = new Info(); string text = ""; StringFormat stringFormat = new StringFormat(); //Calculate the Area to draw the text in. SizeF size = new SizeF((float) ClientRectangle.Width/2, 100000); ; RectangleF rectangleF = new RectangleF(((float) ClientRectangle.Width/2), ArtOffset, ((float) ClientRectangle.Width/2) - ArtOffset, ClientRectangle.Height - ArtOffset*2); //Find out if we are reading MameInfo or History string textType = Path.GetFileNameWithoutExtension(SettingsManager.ArtPaths[ArtType]); if (textType.Equals("mameinfo", StringComparison.InvariantCultureIgnoreCase)) { if (MameInfo == null) MameInfo = new InfoParser(SettingsManager.ArtPaths[ArtType]); if (!MameInfo.Contains(gameName.Replace("fav_", ""))) return; info = MameInfo[gameName.Replace("fav_", "")]; } else if (textType.Equals("history", StringComparison.InvariantCultureIgnoreCase)) { if (History == null) History = new InfoParser(SettingsManager.ArtPaths[ArtType]); if (!History.Contains(gameName.Replace("fav_", ""))) return; info = History[gameName.Replace("fav_", "")]; } else return; _currentInfo = info; text = GetShortInfoText(); _currentInfoText = text; g.MeasureString(text, Settings.Default.info_font, size, stringFormat, out chars, out maxRows); g.DrawString(text, Settings.Default.info_font, new SolidBrush(Settings.Default.info_font_color), rectangleF, stringFormat); _imageArea = new Rectangle((int) rectangleF.X, (int) rectangleF.Y, (int) rectangleF.Width, (int) rectangleF.Height); info.TotalRows = maxRows; info.VisibleRows = GetVisibleRows(_currentInfoText); }