摘要:
如何装载等待光标?
光标是drawing名称空间的一部分。要显示一个特定的光标,可以查阅文档得到所有可用的类型。要显示等待光标,请试试以下代码:
componentsname.cursor = system.drawing.cursors.waitcursor;
// back to arrow
cursor = cursors.arrow
如何获取机器上......
摘要:
dynamic method invocation
one very useful feature related to reflection is the ability to create objects dynamically and call methods on them.
note : class1.cs has methods which will be dyn......
C#积木模块ABC(一)(转自新一代技术网)
第一个c#程序:经典例程hello world
“hello world”可以说是学习每一种编程语言的第一个例程了.我们可以在notepad.wordpad等任何编辑器中输入以下的c#代码,并保存为helloworld.cs,最后在命令行中执行csc helloworld.cs来运行文件:
// using system
using system;
class hello
{
static void main() { // display output on console
console.writeline("hello,c# world!");
}
}
用openfiledialog类浏览或打开文件
同vc++中cfiledialog的 open 方法相同,c#中的openfiledialog类可用于打开一个文件.这个类是从filedialog派生出来的.用这个类中的 openfile方法打开一个文件,然后就可以通过流(steam)来读取这个文件.
请看下面的例程代码,它使用 openfiledialog类浏览一个文件:
openfiledialog fdlg = new openfiledialog();
fdlg.title = "c# corner open file dialog" ;
fdlg.initialdirectory = @"c:\" ;
fdlg.filter = "all files (*.*)|*.*|all files (*.*)|*.*" ;
fdlg.filterindex = 2 ;
fdlg.restoredirectory = true ;
if(fdlg.showdialog() == dialogresult.ok)
{
textbox1.text = fdlg.filename ;
}
title一行设置打开对话框的标题,filter一行为打开的文件类型设置一个过滤器,filename一行包含了所选中的文件名.
下图就是运行的结果:
从c#中调用com组件
.net框架是com的一个自然发展,两者共享许多核心要素,这包括组件的再利用以及语言的中立性.为了向后兼容,com interop可以使用现存的com组件而不要求对原始组件进行修改.当一个 .net 框架开发人员想将com代码合并到一个管理应用程序中时,就可以用com interop功能引入相关的com类型.引入之后,这个com类型就可以使用了.这属于前期连接.但是有时候你需要对象的后期连接,这在.net中也能实现,使用名称空间映射就可以通过后期连接来调用com对象.
这里介绍一个应用程序例程,它将调用excel,并且通过使用后期连接使它可视....
下一页 摘要:
介绍
api(application programming interface),我想大家不会陌生,它是我们windows编程的常客,虽然基于.net平台的c#有了强大的类库,但是,我们还是不能否认api在windows编程中的重要性。大多数的编程语言都支持api编程,而.net平台中的mfc(microsoft foundation class library)构架本身就......