MESCIUS SPREAD for Windows Forms 17.0J サンプルコード集 > 行フィルタリング > インジケータに独自のアイコンを表示させる |
自動的に表示される行フィルタリング用のインジケータは自由に変更することができます。(FilterState列挙体による)
※このサンプルはシートのAutoFilterModeがFilterGadgetまたはEnhancedContextMenuに設定されている場合のみ有効です。
|
private void Form1_Load(object sender, System.EventArgs e) { //自動フィルタ機能を有効にします fpSpread1.ActiveSheet.Columns[0,1].AllowAutoFilter = true; //自動フィルタのフィルタガジェットを表示します fpSpread1.ActiveSheet.AutoFilterMode = FarPoint.Win.Spread.AutoFilterMode.FilterGadget; FarPoint.Win.Spread.SpreadView sv = fpSpread1.GetRootWorkbook(); //行フィルタリング未実施中のアイコンを設定します sv.SetImage(FarPoint.Win.Spread.SpreadView.FilterInactive, Image.FromFile("画像ファイルパス名")); //行フィルタリング実施中のアイコンを設定します sv.SetImage(FarPoint.Win.Spread.SpreadView.FilterActive, Image.FromFile("画像ファイルパス名")); fpSpread1.ActiveSheet.DefaultStyle.CellType = new FarPoint.Win.Spread.CellType.TextCellType(); fpSpread1.ActiveSheet.SetText(0, 0, "Fender"); fpSpread1.ActiveSheet.SetText(1, 0, "Gibson"); fpSpread1.ActiveSheet.SetText(2, 0, "Fender"); fpSpread1.ActiveSheet.SetText(3, 0, "Ibanez"); fpSpread1.ActiveSheet.SetText(4, 0, "Gibson"); fpSpread1.ActiveSheet.SetText(5, 0, "YAMAHA"); fpSpread1.ActiveSheet.SetText(0, 1, "AST-100 DMC"); fpSpread1.ActiveSheet.SetText(1, 1, "Les Paul Standard Double Cut Plus"); fpSpread1.ActiveSheet.SetText(2, 1, "ST58-70TX"); fpSpread1.ActiveSheet.SetText(3, 1, "AGS83B"); fpSpread1.ActiveSheet.SetText(4, 1, "Les Paul Supreme"); fpSpread1.ActiveSheet.SetText(5, 1, "ATTITUDE-Limited II"); fpSpread1.ActiveSheet.SetColumnWidth(0, 90); fpSpread1.ActiveSheet.SetColumnWidth(1, 210); }
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load '自動フィルタ機能を有効にします FpSpread1.ActiveSheet.Columns(0,1).AllowAutoFilter = True '自動フィルタのフィルタガジェットを表示します FpSpread1.ActiveSheet.AutoFilterMode = FarPoint.Win.Spread.AutoFilterMode.FilterGadget Dim sv As FarPoint.Win.Spread.SpreadView = FpSpread1.GetRootWorkbook() '行フィルタリング未実施中のアイコンを設定します sv.SetImage(FarPoint.Win.Spread.SpreadView.FilterInactive, Image.FromFile("画像ファイルパス名")) '行フィルタリング実施中のアイコンを設定します sv.SetImage(FarPoint.Win.Spread.SpreadView.FilterActive, Image.FromFile("画像ファイルパス名")) FpSpread1.ActiveSheet.DefaultStyle.CellType = New FarPoint.Win.Spread.CellType.TextCellType FpSpread1.ActiveSheet.SetText(0, 0, "Fender") FpSpread1.ActiveSheet.SetText(1, 0, "Gibson") FpSpread1.ActiveSheet.SetText(2, 0, "Fender") FpSpread1.ActiveSheet.SetText(3, 0, "Ibanez") FpSpread1.ActiveSheet.SetText(4, 0, "Gibson") FpSpread1.ActiveSheet.SetText(5, 0, "YAMAHA") FpSpread1.ActiveSheet.SetText(0, 1, "AST-100 DMC") FpSpread1.ActiveSheet.SetText(1, 1, "Les Paul Standard Double Cut Plus") FpSpread1.ActiveSheet.SetText(2, 1, "ST58-70TX") FpSpread1.ActiveSheet.SetText(3, 1, "AGS83B") FpSpread1.ActiveSheet.SetText(4, 1, "Les Paul Supreme") FpSpread1.ActiveSheet.SetText(5, 1, "ATTITUDE-Limited II") FpSpread1.ActiveSheet.SetColumnWidth(0, 90) FpSpread1.ActiveSheet.SetColumnWidth(1, 210) End Sub