string scss = @"<style type=""text/css""> body{ margin-left: {0}px; margin-top: {1}px; } </style>"; scss = string.Format(scss, marginleft, margintop);
调试时提示string.Format格式错误,不太明白,后来将{}也作为修改字符串
public void AddcssBody(int marginleft=2,int margintop=2) { string scss = @"<style type=""text/css""> body{2} margin-left: {0}px; margin-top: {1}px; {3} </style>"; scss = string.Format(scss, marginleft, margintop, "{", "}"); Headary.Add(scss); }
正确显示.
时间: 2024-12-28 09:46:22