PortraitIndex is useful for sorting. To save data about characters, it's best to use Index or HeroId
To display the names horizontally you either add them to a string in the foreach and then show them all at once, or you show them on the screen one by one increasing the X coordinate.
Code:
var nameslist = string.Empty
foreach (var player in players)
{
namelist = namelist + " " + player.BattleTagAbovePortrait; // or namelist += " " + player.BattleTagAbovePortrait;
}
FontNames.DrawText(FontNames.GetTextLayout(namelist), 200 , 200);
--- or ---
Code:
var xPos = 200;
foreach (var player in players)
{
var layout = FontNames.GetTextLayout(player.BattleTagAbovePortrait);
FontNames.DrawText(layout, xPos , 200);
xPos = xPos + layout.Metrics.Width + 5; // or xPos += layout.Metrics.Width + 5;
}