问题一:
- private void Form1_Load(object sender, EventArgs e)
- {
- DataTable dt = new DataTable();
- dt.Columns.Add("姓名");
- dt.Columns.Add("年龄");
- dt.Columns.Add("性别");
- dt.Rows.Add("AAA", "20", "女");
- dt.Rows.Add("AAA", "20", "男");
- dt.Rows.Add("AAA", "22", "女");
- dt.Rows.Add("AAA", "23", "女");
- dt.Rows.Add("AAA", "24", "女");
- fpSpread1.ActiveSheet.DataSource = dt;
- fpSpread1.ActiveSheet.Columns[0, 2].AllowAutoFilter = true;
- }
- private void 过滤ToolStripMenuItem_Click(object sender, EventArgs e)
- {
- fpSpread1.ActiveSheet.AutoFilterColumn(1, "20", 1);
- fpSpread1.ActiveSheet.AutoFilterColumn(2, "女", 1);
- }
复制代码
问题二,可以通过InputMap来实现:
- FarPoint.Win.Spread.InputMap im = new FarPoint.Win.Spread.InputMap();
- im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);
- im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow);
- im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
- im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow);
复制代码 |