会员
周边
众包
新闻
博问
闪存
赞助商
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
.NET技术支持者
博客园
::
首页
::
博问
::
闪存
:: ::
联系
::
订阅
::
管理
::
公告
DataGrid相邻行有相同内容时对指定列合并和C#可以实现DLL库的动态调用
/**/
///
<summary>
///
DataGrid相邻行有相同内容时对指定列合并
///
</summary>
///
<param name="spangrid">
格式化的DataGrid的ID
</param>
///
<param name="spancell">
要合并的列
</param>
///
<param name="spanby">
合并所依据数据的列
</param>
public
void
FormatGrid(DataGrid spangrid,
int
spancell,
int
spanby)
{
if
(spanby
<
0
||
spanby
>
spangrid.Items.Count)
return
;
int
rowspan
=
1
;
for
(
int
i
=
1
;i
<
spangrid.Items.Count;i
++
)
{
if
(spangrid.Items[i].Cells[spanby].Text
==
spangrid.Items[i
-
1
].Cells[spanby].Text)
{
rowspan
+=
1
;
spangrid.Items[i].Cells[spancell].Visible
=
false
;
spangrid.Items[i
-
rowspan
+
1
].Cells[spancell].RowSpan
=
rowspan;
}
else
{
string
str
=
spangrid.Items[i].Cells[spanby].Text;
string
str1
=
spangrid.Items[i
-
1
].Cells[spanby].Text;
rowspan
=
1
;
}
}
}
C#可以实现DLL库的动态调用
Assembly assmebly
=
Assembly.LoadFile(
@"
C:WindowsApplication2005-09-30.dll
"
);
Type t
=
assmebly.GetType(
"
WindowsApplication2005_09_30.Class1
"
);
object
obj
=
Activator.CreateInstance(t,
null
);
MethodInfo method
=
t.GetMethod(
"
Test01
"
);
int
i
=
(
int
)method.Invoke(obj,
new
object
[
1
]
{
10
}
);
namespace
WindowsApplication2005_09_30
{
public
class
Class1
{
public
int
Test01(
int
i)
{
return
i
*
10
;
}
}
}
posted on
2005-10-11 19:09
LDAR泄漏检测与修复
阅读(
1324
) 评论(
3
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部