文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>【C#】[窗体]不规则窗体

【C#】[窗体]不规则窗体

时间:2011-01-25  来源:isaced

 

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.Runtime.InteropServices;//

namespace 不规则窗体
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        
        //---------------------

        [DllImport("gdi32")]
        private static extern IntPtr CreatePolygonRgn(Point[] lpPoint, int nCount, int nPolyFillMode);  
        [DllImport("user32")]
        private static extern IntPtr SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool bRedraw);
        const int WINDING = 2;

        private void Form1_Load(object sender, EventArgs e)
        {
            Point[] pt ={
                            new Point(0,0),
                            new Point(0,this.Height/2),
                            new Point(this.Width/2,this.Height),
                            new Point(this.Width,this.Height/2),
                            new Point(this.Width,0)
                        };


            IntPtr m_rgn;
            m_rgn = CreatePolygonRgn(pt, 5, WINDING);
            SetWindowRgn(this.Handle, m_rgn, true);
        }
    }
}
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载