withsmile 你好
请参考下面的代码,我使用下面的代码是可以设置主从表的Locked:
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- public class Score
- {
- private string classname;
- private string grade;
- public string ClassName
- {
- get { return classname; }
- set { classname = value; }
- }
- public string Grade
- {
- get { return grade; }
- set { grade = value; }
- }
- }
- public class Student
- {
- private string name;
- private string id;
- private ArrayList score = new ArrayList();
- public string Name
- {
- get { return name; }
- set { name = value; }
- }
- public string Id
- {
- get { return id; }
- set { id = value; }
- }
- public ArrayList Score
- {
- get { return score; }
- }
- }
- private void Form1_Load(object sender, System.EventArgs e)
- {
- ArrayList list = new ArrayList();
- Student s = new Student();
- s.Name = "John Smith";
- s.Id = "100001";
- Score sc = new Score();
- sc.ClassName = "math";
- sc.Grade = "A";
- s.Score.Add(sc);
- sc = new Score();
- sc.ClassName = "English";
- sc.Grade = "A";
- s.Score.Add(sc);
- list.Add(s);
- s = new Student();
- s.Name = "David Black";
- s.Id = "100002";
- sc = new Score();
- sc.ClassName = "math";
- sc.Grade = "B";
- s.Score.Add(sc);
- sc = new Score();
- sc.ClassName = "English";
- sc.Grade = "A";
- s.Score.Add(sc);
- list.Add(s);
- fpSpread1_Sheet1.DataSource = list;
- this.fpSpread1.ActiveSheet.Columns[0].Locked = true;
- this.fpSpread1.ActiveSheet.GetChildView(0, 0).Columns[0].Locked = true;
- }
- }
复制代码
如果通过以上方法问题依然存在,可以发一个Demo给我们调试。 |