帮我调试一下
上次给我发 的这个demo我又调了下,现在可以实现COMBOBOX的下拉列表根据text的变化而模糊查询,但是下拉列表的内容只能选第一个ITEM,选其他会报错,说INDEX超出范围,求帮我调试一下 发多了,帮我删一个 zy2164867你好我们正在调试你的程序,明天会给你一个回复。
回复 2# zy2164867 的帖子
我这边调试的结果如下,现在可以进行模糊查找,不过也丢失了一些ComboBox原有的特性,比如说键盘的上下键操作:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace DEMO
{
public partial class Form1 : Form
{
FarPoint.Win.Spread.CellType.ComboBoxCellType comboBoxType = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
string[] ItemSource = new string[] { "AAA", "ABC", "AABC", "ACB", "BBB", "BCD", "AG" };
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
comboBoxType.Editable = true;
comboBoxType.Items = ItemSource;
comboBoxType.ListControl = new ListBox();
this.fpSpread1.Sheets.Columns.CellType = comboBoxType;
}
private void fpSpread1_EditChange(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
{
if (e.Column == 4)
{
FarPoint.Win.FpCombo cbo = fpSpread1.EditingControl as FarPoint.Win.FpCombo;
string[] items = (from item in ItemSource orderby item.ToUpper().IndexOf(fpSpread1.ActiveSheet.ActiveCell.Text.ToUpper()) where item.ToUpper().IndexOf(fpSpread1.ActiveSheet.ActiveCell.Text.ToUpper()) != -1 select item).ToArray<string>();
if (items.Length > 0)
{
comboBoxType.Items = items;
comboBoxType.MaxDrop = items.Length;
cbo.ListControl.Items.Clear();
cbo.ListControl.Items.AddRange(items);
cbo.ShowList(true);
cbo.SelectedItem = null;
}
else
{
comboBoxType.Items = ItemSource;
comboBoxType.MaxDrop = ItemSource.Length;
cbo.ListControl.Items.Clear();
cbo.ListControl.Items.AddRange(ItemSource);
cbo.ShowList(true);
cbo.SelectedIndex = -1;
}
}
}
private void fpSpread1_EditModeOff(object sender, EventArgs e)
{
if (fpSpread1.ActiveSheet.ActiveColumnIndex == 4)
{
comboBoxType.Items = ItemSource;
comboBoxType.MaxDrop = ItemSource.Length;
comboBoxType.ListControl.Items.Clear();
comboBoxType.ListControl.Items.AddRange(ItemSource);
}
}
private void 调试ToolStripMenuItem_Click(object sender, EventArgs e)
{
}
}
}
博主:您好!下列代码中如何设置下拉条目的间距:
comboBoxType.Items = items;
comboBoxType.MaxDrop = items.Length;
cbo.ListControl.Items.Clear();
cbo.ListControl.Items.AddRange(items);
cbo.ShowList(true);
cbo.SelectedItem = null; ComboboxCelltype不支持设置下拉条目的行间距
页:
[1]