找回密码
 立即注册

QQ登录

只需一步,快速开始

yrpting

中级会员

4

主题

13

帖子

625

积分

中级会员

积分
625

活字格认证

最新发帖
yrpting
中级会员   /  发表于:2013-5-29 15:47  /   查看:4819  /  回复:3
spread cell的StyleName=“Locked”和cell的Locked属性="True"有什么区别?StyleName有什么作用?请高手帮忙解答一下,谢谢

3 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2013-5-29 17:25:00
沙发
回复 1楼yrpting的帖子

StyleName 用户设置单元格的样式,StyleName=“Locked” 中的 Locked 只是 NameStyle 的名称。参考代码:

  1. FarPoint.Win.Spread.NamedStyle ns = new FarPoint.Win.Spread.NamedStyle("StyleData", "DataAreaDefault");
  2. ns.BackColor = Color.LightBlue;
  3. ns.Border = new FarPoint.Win.LineBorder(Color.DarkBlue, 2);
  4. ns.CellType = new FarPoint.Win.Spread.CellType.TextCellType();
  5. ns.Editor = new FarPoint.Win.Spread.CellType.TextCellType();
  6. ns.Font = new Font("Comic Sans Serif", 12);
  7. ns.ForeColor = Color.Red;
  8. ns.Formatter = new FarPoint.Win.Spread.CellType.TextCellType();
  9. ns.HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Right;
  10. ns.Name = "StyleData";
  11. ns.Parent = "DataAreaDefault";
  12. ns.Renderer = new FarPoint.Win.Spread.CellType.TextCellType();
  13. ns.VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Bottom;
  14. fpSpread1.NamedStyles.Add(ns);
  15. fpSpread1.ActiveSheet.Cells[0, 0].StyleName = "StyleData";
  16. fpSpread1.ActiveSheet.SetText(0, 0, "NamedStyle");
  17. fpSpread1.ActiveSheet.Columns[0].Width = 120;
  18. fpSpread1.ActiveSheet.Rows[0].Height = 80;
复制代码


Cell 的 Locked 属性用于设置是否锁定单元格禁止用户编辑。


  1. fpSpread1.Sheets[0].Cells[0, 0].Locked = true;
复制代码
回复 使用道具 举报
yrpting
中级会员   /  发表于:2013-5-30 09:57:00
板凳
谢谢
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2013-5-30 19:00:00
地板
回复 3楼yrpting的帖子

不客气
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部