C#非矩形窗體實(shí)現(xiàn)方法
更新時(shí)間:2015年06月11日 12:30:36 作者:zhuzhao
這篇文章主要介紹了C#非矩形窗體實(shí)現(xiàn)方法,涉及C#窗體操作的相關(guān)技巧,需要的朋友可以參考下
本文實(shí)例講述了C#非矩形窗體實(shí)現(xiàn)方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; namespace WindowsApplication1 { public partial class Form3 : Form { Point downPoint = Point.Empty; public Form3() { InitializeComponent(); } void Set() { Rectangle rect = this.ClientRectangle; using (GraphicsPath path = new GraphicsPath()) { path.AddEllipse(rect); this.Region = new Region(path); } } private void Form3_Load(object sender, EventArgs e) { Set(); } private void Form3_MouseDown(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left) return; downPoint = new Point(e.X, e.Y); } private void Form3_MouseMove(object sender, MouseEventArgs e) { if (downPoint == Point.Empty) return; Point location = new Point(this.Left + e.X - downPoint.X, this.Top + e.Y - downPoint.Y); this.Location = location; } private void Form3_MouseUp(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left) return; downPoint = Point.Empty; } } }
希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。
相關(guān)文章
C#三種方法獲取文件的Content-Type(MIME Type)
這篇文章介紹了C#獲取文件Content-Type(MIME Type)的三種方法,文中通過示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-01-01C#/VB.NET實(shí)現(xiàn)HTML轉(zhuǎn)為XML的示例代碼
可擴(kuò)展標(biāo)記語言(XML)文件是一種標(biāo)準(zhǔn)的文本文件,它使用特定的標(biāo)記來描述文檔的結(jié)構(gòu)以及其他特性。本文將利用C#實(shí)現(xiàn)HTML轉(zhuǎn)為XML,需要的可以參考一下2022-06-06C# .NET實(shí)現(xiàn)掃描識(shí)別圖片中的文字
本文以C#及VB.NET代碼為例,介紹如何掃描并讀取圖片中的文字。文中的示例代碼介紹詳細(xì),對(duì)我們學(xué)習(xí)C#有一定的幫助,感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2021-12-12C#對(duì)XML文件的各種操作實(shí)現(xiàn)方法
C#對(duì)XML文件的各種操作實(shí)現(xiàn)方法,需要的朋友可以參考一下2013-04-04對(duì)int array進(jìn)行排序的實(shí)例講解
下面小編就為大家分享一篇對(duì)int array進(jìn)行排序的實(shí)例講解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2017-12-12