摘要: 最近制作甘特图控件 System.Drawing.Drawing2D. HatchBrush _BlackBrush = new HatchBrush(HatchStyle.Percent50, Color.Blue,Color.White);Graphics _Graphics = Graphics.FromHwnd(this.Handle);_Graphics.FillRectangle(_BlackBrush, new Rectangle(0, 0, 100, 100));这样来绘制的 但发现 HatchBrush..枚举名字和图形对照实在郁闷..下面把效果图贴出来..本文来自CSDN博 阅读全文
posted @ 2011-03-21 18:18 许明吉博客 阅读(2135) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Collections;using System.ComponentModel;using System.Drawing 阅读全文
posted @ 2011-03-21 18:14 许明吉博客 阅读(1044) 评论(1) 推荐(0) 编辑
摘要: 模态窗体(ShowDialog)打开后,后面的主窗体就不能做任何操作了。本博客要实现非模态窗体(show)实现模态窗体(ShowDialog)的一些效果(主窗体关闭,子窗体也要关闭。子窗体只能打开一个。)同时,保留非模态窗体的一些特性(主窗体和子窗体都能操作,比如文本的书写等)。现实的一些用处:1、比如要在主窗体中写已有的内容,用子窗体显示这些已有的内容(一般信息比较多,无法在主窗体中用某个空间显示完全)以供参考。2、直接点击子窗体中的信息,在主窗体中显示出来。等等代码如下:FormA----主窗体FormB----子窗体view plaincopy to clipboardprint? 阅读全文
posted @ 2011-03-21 16:09 许明吉博客 阅读(8548) 评论(0) 推荐(0) 编辑
摘要: 假设你有form1和form2两个窗口类,在form1中创建子窗口form2有两种情况:创建模态对话框form2和创建非模态对话框form2: 一、如果创建模态对话框,如下有两种情况,其中有一种是错误的,是一定要避免的: 错误的情况,如下: form1中 private void button1_Click(object sender, EventArgs e) { Form2 fm = new Form2(); fm.ShowDialog();//创建模态对话框 fm.Owner = this;此句在fm.ShowDialog();后面 } form2中 private void butto 阅读全文
posted @ 2011-03-21 16:05 许明吉博客 阅读(1015) 评论(0) 推荐(0) 编辑
摘要: 何谓模态窗体?简单的可以理解为窗体对话框,用户必须在完成该窗体上的操作或关闭窗体后才能返回打开此窗体的窗体。本文不对模态窗体的定义、特征、功能做具体讨论,主要把重点放在如何在.net窗体应用程序中有效的使用模态窗体,解决使用模态窗体中碰到的常见问题。 模态窗体的属性设置 在.net中一个System.Windows.Forms.Form类就表示一个窗体,通过visual studio 2005设计器能够直接添加窗体,切换到设计模式,在属性窗口中会显示属于该窗体的属性和事件。参照标准的模态窗体,以visual studio 2005程序的菜单工具->选项打开的那个选项对话框为例,对于设计器 阅读全文
posted @ 2011-03-21 16:03 许明吉博客 阅读(1195) 评论(0) 推荐(0) 编辑
摘要: 在日常开发中,经常要打开一个模态窗体,在模态窗体中选择某一项,然后把这项的ID或者Name赋值给打开这个模态窗体的窗体…… 在Windows 客户端中,要实现这样的功能是非常简单的,代码也会很优美。当然,这与个人的写法有关系。 比较优美的方式有2种,一种是使用interface编写观察者模式,一种就是使用事件委托。既然在Windows平台中玩耍,那就采用更加灵活的事件委托方式来实现吧。 废话少说,我们来看实现代码吧。(红色加粗为主要中的重要代码)模态窗体的主要代码: public partial class SelectForm : Form { public event Action< 阅读全文
posted @ 2011-03-21 16:03 许明吉博客 阅读(1555) 评论(0) 推荐(0) 编辑
摘要: library Project1;uses SysUtils, Classes,Forms,windows,dialogs, Unit1 in 'Unit1.pas' {Form1};{$R *.res}function showform(formname:string):boolean;stdcall;var TheClass: TPersistentClass; aForm: TForm;begin result:=false; {如果您的Dll中有很多FORM,请在这儿注册哦 RegisterClasses([TForm1,TForm2,TForm3,...]); } R 阅读全文
posted @ 2011-03-21 15:42 许明吉博客 阅读(971) 评论(0) 推荐(0) 编辑
摘要: 第一步: 建一个 DLL 工程, 如图:然后保存, 我这里使用的名称都是默认的. 第二步: 建一个资源原文件, 如图:编辑内容如下(路径中的文件一定要存在):img1 BITMAP "c:\temp\test.bmp"然后, 取个名(后缀须是 rc, 我这里取名为 Res.rc), 保存在工程目录下. 第三步: 在 DLL 工程中添加这个资源原文件, 如图:此时, 工程源文件中会添加一句: {$R 'Res.res' 'Res.rc'}, 我们需要的源文件这样即可: library Project1;{$R 'Res.res' 阅读全文
posted @ 2011-03-21 15:37 许明吉博客 阅读(626) 评论(0) 推荐(0) 编辑
摘要: procedure TForm1.Button1Click(Sender: TObject); var Doc: IHTMLDocument2; ViewObject: IViewObject; sourceDrawRect: TRect; a, getjpg: TBitMap; i, m: integer; pdest, psour: hbitmap; jpg: tjpegimage; begin Doc := WebBrowser.Document as IHTMLDocument2; if Webbrowser.Document <> nil then try webbrow 阅读全文
posted @ 2011-03-21 11:57 许明吉博客 阅读(1558) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Drawing.Imaging; using System.Runtime.InteropServices; using System.Security; namespace Print { public class Test { public 阅读全文
posted @ 2011-03-21 11:56 许明吉博客 阅读(5259) 评论(1) 推荐(0) 编辑
摘要: 包含mshtml, SHDocVw, AxSHDocVw的引用在vs2005中,这样引进mshtml在代码开头加上using mshtml;(具体方法 引用--》COM--》Microsoft HTML Object Libraryusing mshtml;)SHDocVw的引用,网上有篇文章这么做的:SHDocVw一定要在下面这个路径找:(C:\Program Files\Microsoft Visual Studio 8\Application\PreEmptive Solutions\Dotfuscator Community Edition)还有篇文章是这么来添加引用的:1 在 Vis 阅读全文
posted @ 2011-03-21 09:42 许明吉博客 阅读(11372) 评论(0) 推荐(0) 编辑
摘要: 1, 用Win32 API 或是UI Atomation 获取窗口, 窗口的类型为"Internet Explorer_Server"2。 添加引用:MSHTML, SHDocVw(Microsoft Internet Controls),Accessibility3。 导入APIAccessibleObjectFromWindow: 您可以参考pInvoke.net 获取更多有用信息。4。从窗获取 Acc: (hIENativeWindowHandle 是第一步里取得的窗口指针) object objAcc = null; Guid guidAcc = typeof( I 阅读全文
posted @ 2011-03-21 09:32 许明吉博客 阅读(3379) 评论(1) 推荐(0) 编辑
摘要: var doc: IHtmlDocument2; i: Integer; s: String;begin //iFile := WebBrowser1.Document as IPersistFile; //iFile.Save('F:\tt.mht', False); doc := WebBrowser1.Document as IHtmlDocument2; if doc.images.length = 0 then exit; Memo1.Clear; for i := 0 to doc.images.length-1 do with (doc.images.item(i 阅读全文
posted @ 2011-03-21 09:25 许明吉博客 阅读(1125) 评论(0) 推荐(0) 编辑
摘要: 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.IO;using System.Net;namespace WebPicture{ public partial class Form1 : Form { public Form1() { InitializeCompon 阅读全文
posted @ 2011-03-21 09:20 许明吉博客 阅读(1475) 评论(1) 推荐(0) 编辑