⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bmprectcombo.cs

📁 这是网上下载的很好的串口发短信的程序! 是用VC++来做的
💻 CS
字号:
using System;
using System.Collections.Specialized;
using Microsoft.DirectX.DirectDraw;

namespace DDGameHelper
{
	/// <summary>
	/// BitmapObject 与 RectangleArray 的组合体(包含 DirectDraw 相关定义及操作 ,用于图像绘制)
	/// </summary>
	public class BmpRectCombo
	{
		protected BitmapObject _bitmapObject;
		protected RectangleArray _rectangleArray;

		protected DDHandler _dDHandler;
		protected SurfaceDescription _surfaceDesc;
		protected Surface _bitmapSurface;

		public BitmapObject BitmapObject{get{return _bitmapObject;}set{_bitmapObject=value;}}
		public RectangleArray RectangleArray{get{return _rectangleArray;}set{_rectangleArray=value;}}

		public DDHandler DDHandleR{get{return _dDHandler;}set{_dDHandler=value;}}
		public Surface BitmapSurface{get{return _bitmapSurface;}set{_bitmapSurface=value;}}

		public BmpRectCombo(ref BitmapObject bitmapObject, ref RectangleArray rectangleArray, ref DDHandler dDHandler)
		{
			_bitmapObject=bitmapObject;
			_rectangleArray=rectangleArray;
			_dDHandler=dDHandler;

			initializeSurfaceDescription();
			initializeSurface();
		}

		/// <summary>
		/// 初始化surface描述
		/// </summary>
		protected void initializeSurfaceDescription()
		{
			_surfaceDesc = new SurfaceDescription();
			_surfaceDesc.SurfaceCaps.OffScreenPlain = true;

			_surfaceDesc.Width = _bitmapObject.Size.Width;
			_surfaceDesc.Height = _bitmapObject.Size.Height;
		}

		/// <summary>
		/// 初始化surface
		/// </summary>
		protected void initializeSurface()
		{
			this._bitmapSurface = new Surface(_bitmapObject.BitmapSource, _surfaceDesc, _dDHandler.Device);
			
			if (_bitmapObject.BitmapDisplayType == BitmapDisplayType.Transparent)
			{
				//创建黑色的 colorkey
				ColorKey tempKey = new ColorKey();
				tempKey.ColorSpaceHighValue = 0;
				tempKey.ColorSpaceLowValue = 0;

				_bitmapSurface.SetColorKey(ColorKeyFlags.SourceDraw, tempKey);
			}
		}
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -