4、应用程序2. 找到窗体的Load事件,双击进行编辑3. 编写方法,主要的代码如下: 代码 class BitmapRegion { public BitmapRegion() { } /// /// Create and apply the region on the supplied control /// 创建支持位图区域的控件(目前有button和form) /// ///
5、am name="control">The Control object to apply the region to控件 /// The Bitmap object to create the region from位图 public static void CreateControlRegion(Control control, Bitmap bitmap) { // Return if contro
6、l and bitmap are null //判断是否存在控件和位图 if (control == null
7、
8、 bitmap == null) return; // Set our control''s size to be the same as the bitmap //设置控件大小为位图大小 control.Width = bitmap.Width; control.Hei
9、ght = bitmap.Height; // Check if we are dealing with Form here //当控件是form时 if (control is System.Windows.Forms.Form) { // Cast to a Form object //强制转换为FORM Form form = (Form)control;
10、 // Set our form''s size to be a little larger that the bitmap