我目前学用DotNetBar的SuperGrid,做的窗口真漂亮,但是我以前用PowerBuiler的,有过滤重复值功能就比如我一条SELECT语句结果是姓名 年份 工作地点
张三 2001 广州
张三 2003 深圳
张三 2007 上海
李四 2005 广州
张四 2008 深圳
李四 2009 上海
王五 2013 深圳
我要在SuperGrid显示的效果是姓名 年份 工作地点
张三 2001 广州
2003 深圳
2007 上海
李四 2005 广州
2008 深圳
2009 上海
王五 2013 深圳应该SuperGrid与DataGridView用法差不多吧,只不过前者有很多特色的功能
张三 2001 广州
张三 2003 深圳
张三 2007 上海
李四 2005 广州
张四 2008 深圳
李四 2009 上海
王五 2013 深圳
我要在SuperGrid显示的效果是姓名 年份 工作地点
张三 2001 广州
2003 深圳
2007 上海
李四 2005 广州
2008 深圳
2009 上海
王五 2013 深圳应该SuperGrid与DataGridView用法差不多吧,只不过前者有很多特色的功能
解决方案 »
- Ado.net连接数据库执行时间的一个问题?
- vb读取串口数据绘制实时曲线关键源码翻译求教,希望了解源程序通讯协议以及主要变量的计算表达式,改为用C#进行绘制
- c# 调用dll函数的问题,大侠请帮我
- 还是关于在OnMouseDown事件中存变量的问题
- 请教个三层架构的查询语句问题!高人进来看看
- 打包安装程序
- wpf中怎么使用msChart控件
- Winform 绘制大图的问题
- 看C#高级编程很枯燥啊..还有些看不懂..实际应用的场景也很少..怎么看呐?推荐一本好书来吧?
- Graphics 图层问题,急急急!!!
- lucene lucene-core-3.4.0.jar
- C# WINDOW服务组件问题
DotNetBar的SuperGridControl应该有属性吧,这么强大的控件,没人用过吗
using System.Collections.Generic;
namespace GeZhongTest
{
/// <summary>
/// 泛型去重复比较类
/// </summary>
class ListComparer:IEqualityComparer<string>
{
public bool Equals(string a, string b)
{
if (a == b)
{
return true;
}
else
{
return false;
}
}
public int GetHashCode(string obj)
{
return 0;
}
}
}
static void Main(string[] args)
{
List<string> list = new List<string>();
for (int i = 0; i < 5; i++)
{
list.Add("shenme" + i);
}
list.Add("shenme2");
list.Add("shenme3");
for (int j = 10; j < 15; j++)
{
list.Add("ha" + j);
}
list.Add("ha12");
Console.WriteLine("去重之前");
Console.WriteLine("******************************");
foreach (string eve in list)
{
Console.Write(eve + "\t");
}
Console.WriteLine("******************************");
Console.WriteLine("去重之后");
Console.WriteLine("******************************");
//调用方法去重复
var resultList = list.Distinct(new ListComparer());
foreach(var item in resultList)
{
Console.Write(item.ToString() + "\t");
}
Console.WriteLine("******************************");
Console.ReadKey();
}
using System.Windows.Forms;
/// <summary>
///GridViewMergeCell 合并GridView
/// </summary>
public class GridViewMerge
{
public static void spanRow(SuperGridControl dg, string GroupColumn)
{
int i = 0;
int j = 0;
int rowSpan;
string strTemp = "";
string strTemp2 = "";
GridElement col;
GridRow a; for (i = 0; i < dg.PrimaryGrid.Rows.Count; i++)
{
rowSpan = 1;
col = dg.PrimaryGrid.Rows[i];
a = col as GridRow;
strTemp = a.Cells[GroupColumn].Value.ToString();
for (j = i + 1; j < dg.PrimaryGrid.Rows.Count; j++)
{
col = dg.PrimaryGrid.Rows[j];
a = col as GridRow;
strTemp2 = a.Cells[GroupColumn].Value.ToString(); if (string.Compare(strTemp, strTemp2) == 0)
{
rowSpan += 1;
//dg.Items[i].Cells[GroupColumn].RowSpan = rowSpan;
//dg.Items[j].Cells[GroupColumn].Visible = false;
a.Cells[GroupColumn].Visible = false;
}
else
{
break;
}
}
i = j - 1;
}
}
}
FpSpread1.Sheets(i).SetColumnMerge(0, Model.MergePolicy.Always)