| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1493 人关注过本帖
标题:这个命名空间是什么
只看楼主 加入收藏
casualhewo
Rank: 1
等 级:新手上路
帖 子:267
专家分:0
注 册:2006-6-13
收藏
 问题点数:0 回复次数:2 
这个命名空间是什么

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
// 添加新的命名空间。
using DxVBLib;

namespace DirectDraw1
{
/// <summary>
/// DirectDraw实例:显示图片。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel panel1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码。
//
DirectX = new DirectX7();
InitializeDirectX();
}

/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// panel1
//
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(440, 320);
this.panel1.TabIndex = 0;
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(440, 320);
this.Controls.Add(this.panel1);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "显示图片";
this.Resize += new System.EventHandler(this.Form1_Resize);
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private DirectX7 DirectX = null;
private DirectDraw7 DirectDraw = null;
private DirectDrawSurface7 Surface = null;
private DirectDrawSurface7 PrimarySurface = null;
private DDSURFACEDESC2 Surface1;
private DDSURFACEDESC2 Surface2;
private DirectDrawClipper Clipper = null;
private Boolean bInit;
private void Blt()
{
// 判断是否初始化成功。
if (bInit == false)
return;

DxVBLib.RECT r1 = new DxVBLib.RECT();
DxVBLib.RECT r2 = new DxVBLib.RECT();

// 得到窗口边界大小。
DirectX.GetWindowRect(panel1.Handle.ToInt32(), ref r1);
// 按照新的边界大小显示图片。
r2.Bottom = Surface2.lHeight;
r2.Right = Surface2.lWidth;
PrimarySurface.Blt(ref r1, Surface, ref r2, CONST_DDBLTFLAGS.DDBLT_WAIT);
}
private void InitializeDirectX()
{
// 初始化各个变量。
DirectDraw = DirectX.DirectDrawCreate("");
DirectDraw.SetCooperativeLevel(this.Handle.ToInt32(), CONST_DDSCLFLAGS.DDSCL_NORMAL);

Surface1.lFlags = CONST_DDSURFACEDESCFLAGS.DDSD_CAPS;
Surface1.ddsCaps.lCaps = CONST_DDSURFACECAPSFLAGS.DDSCAPS_PRIMARYSURFACE;
PrimarySurface = DirectDraw.CreateSurface(ref Surface1);

Surface2.lFlags = CONST_DDSURFACEDESCFLAGS.DDSD_CAPS;
Surface2.ddsCaps.lCaps = CONST_DDSURFACECAPSFLAGS.DDSCAPS_OFFSCREENPLAIN;

try
{
Surface = DirectDraw.CreateSurfaceFromFile("sample.bmp", ref Surface2); //background.bmp
}
catch(System.Runtime.InteropServices.COMException e)
{
// 没有找到文件。
if ( (uint)e.ErrorCode == 0x800A0035)
{
MessageBox.Show("没有找到文件'sample.bmp'.\n该文件必须和程序放在一个目录下面。", "图片没有找到");
}
else
{
MessageBox.Show("异常: " + e.ToString(), "异常信息");
}
Application.Exit();
Application.DoEvents();
}
Clipper = DirectDraw.CreateClipper(0);
Clipper.SetHWnd(panel1.Handle.ToInt32());
PrimarySurface.SetClipper(Clipper);
// 初始化完成。
bInit = true;
Blt();
}

private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
DirectDraw.RestoreAllSurfaces();
Blt();
}

private void Form1_Resize(object sender, System.EventArgs e)
{
panel1.Width = this.ClientSize.Width;
panel1.Height = this.ClientSize.Height;
Blt();
}
}
}
这个命名是什么.为什么我在连机帮助中找不到啊.

搜索更多相关主题的帖子: using System 空间 summary Forms 
2007-02-04 17:28
bygg
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:乖乖的心中
等 级:版主
威 望:241
帖 子:13555
专家分:3076
注 册:2006-10-23
收藏
得分:0 
应该是引用的一个项目.

飘过~~
2007-02-04 17:36
casualhewo
Rank: 1
等 级:新手上路
帖 子:267
专家分:0
注 册:2006-6-13
收藏
得分:0 
这是一个DirecitX的库,用于多媒体的开发!

超越自己,挣脱平凡
2007-02-05 08:06
快速回复:这个命名空间是什么
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.031084 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved