/* * private string ConstructFormatedString(string strContent) * { * if (strContent=="") * { * return ""; * } * * string tempstr = ""; * string colorStr = ""; * * if (ledData.content != "") * { * if( ledData.Color == "红") * { * colorStr = "`C00FF00"; * } * else if (ledData.Color == "绿") * { * colorStr = "`C0000FF"; * } * else if (ledData.Color == "黄") * { * colorStr = "`C00FFFF"; * } * else * { * colorStr = "`C00FFFF"; * } * * * tempstr = strContent; * int ilen = tempstr.Length; * int iLeftLen = 0; * int PlaceHoldCount = 0; * * if (ledData.FontSize == "12*12") * { * iLeftLen = ilen % (16 * 8 * 2); * * if (iLeftLen > 0) * { * PlaceHoldCount = ((16 * 8 * 2 - iLeftLen)+1); * tempstr = "`A1`H2" + colorStr + tempstr + new string(' ', PlaceHoldCount / 2);//DupeString(' ', (16 * 8 * 2 - iLeftLen)); * } * else * { * tempstr = "`A1`H2" + colorStr + tempstr; * } * } * else if (ledData.FontSize == "16*16") * { * iLeftLen = ilen % (12 * 6 * 2); * if (iLeftLen > 0) * { * PlaceHoldCount = ((12 * 6 * 2 - iLeftLen) + 1); * * tempstr = "`A3`H4" + colorStr + tempstr + new string(' ', PlaceHoldCount / 2);//DupeString(' ', (16 * 8 * 2 - iLeftLen)); * } * else * { * tempstr = "`A3`H4" + colorStr + tempstr; * } * } * else if (ledData.FontSize == "24*24") * { * iLeftLen = ilen % (8 * 4 * 2); * if (iLeftLen > 0) * { * PlaceHoldCount = ((8 * 4 * 2 - iLeftLen)+1); * tempstr = "`A5`H6" + colorStr + tempstr + new string(' ', PlaceHoldCount / 2);//DupeString(' ', (16 * 8 * 2 - iLeftLen)); * } * else * { * tempstr = "`A5`H6" + colorStr + tempstr; * } * } * else if (ledData.FontSize == "32*32") * { * iLeftLen = ilen % (6 * 3 * 2); * if (iLeftLen > 0) * { * PlaceHoldCount = ((8 * 4 * 2 - iLeftLen) + 1); * * tempstr = "`A7`H8" + colorStr + tempstr + new string(' ', PlaceHoldCount / 2);//DupeString(' ', (16 * 8 * 2 - iLeftLen)); * } * else * { * tempstr = "`A7`H8" + colorStr + tempstr; * } * } * * return tempstr; * } * * return ""; * } */ //32*32&&黄&&欢迎公司领导检查指导! private string ConstructFormatedString(string strContent, string color, string fontSize) { if (strContent == "") { return(""); } testLedCom.AddFormatedContentText(fontSize + "&&" + color + "&&" + strContent); return(""); }
//数据格式例子: //32*32&&黄&&欢迎公司领导检查指导!, //16*16&&黄&&Hello! private bool ConstructFormatedString() { bool bRes = false; if (ledDataCollection.Count == 0) { return(bRes); } foreach (var data in ledDataCollection) { string content = data; if (content != "") { ledCom.AddFormatedContentText(content); bRes = true; } } return(bRes); }