截屏、闪屏(Timer)、输入窗口--DFL for D2.053
这个小练习用D2.053+DFL完成了以下功能:
1.截屏(Chris的例子);
2.用截屏做闪屏,Timer(用Chris的例子);
3.数据库登陆窗口(数据库连接部分暂没做);
4.输入窗口模块module inputbox,从窗口输入中获得一个字符串和一个整数可以这样:
/*Generated by Entice DesignerEntice Designer written by Christopher E. Millerwww.dprogramming.com/entice.php*/import dfl.all;import dfl.internal.winapi;import std.c.string;import std.conv;import std.string;class SimplePictureBox: PictureBox{ protected override void onPaintBackground(PaintEventArgs ea) { } protected override void createParams(ref CreateParams cp) { super.createParams(cp); //cp.exStyle |= WS_EX_TRANSPARENT; }}class SplashForm: dfl.form.Form{// Do not modify or move this block of variables.//~Entice Designer variables begin here.SimplePictureBox pictureBox1;//~Entice Designer variables end here.Timer timer;this(){initializeSplashForm();//@ Other SplashForm initialization code here.startTimer;}protected void startTimer(){timer=new Timer;timer.interval=3000;timer.tick~=&ticks;timer.start;}protected void ticks(Timer sender,EventArgs e){this.close;}private void initializeSplashForm(){// Do not manually modify this function.//~Entice Designer 0.8.5.02 code begins here.//~DFL FormformBorderStyle = dfl.all.FormBorderStyle.NONE;startPosition = dfl.all.FormStartPosition.CENTER_PARENT;text = "Splash Form";clientSize = dfl.all.Size(304, 192);//~DFL SimplePictureBox:dfl.picturebox.PictureBox=pictureBox1pictureBox1 = new SimplePictureBox();pictureBox1.name = "pictureBox1";pictureBox1.dock = dfl.all.DockStyle.FILL;pictureBox1.bounds = dfl.all.Rect(0, 0, 304, 192);pictureBox1.parent = this;//~Entice Designer 0.8.5.02 code ends here.pictureBox1.sizeMode=PictureBoxSizeMode.STRETCH_IMAGE;//this.onLoad~=&onLoad;}protected override void onLoad(EventArgs ea){super.onLoad(ea);HWND hWnd = FindWindowExA(cast(HWND)0, cast(HWND)0, null, toStringz("0")); //or 0 for desktop... //writefln("HWND = %d", hWnd); Graphics g = MemoryGraphics.fromHwnd(hWnd); MemoryGraphics mg = new MemoryGraphics(1280,1024); g.copyTo(mg, 0,0,1280,1024); Bitmap bmp = mg.toBitmap(mg); pictureBox1.image(bmp);}}