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;
}
}
}
希望本文所述對大家的C#程序設(shè)計(jì)有所幫助。
相關(guān)文章
C#自動給文章關(guān)鍵字加鏈接實(shí)現(xiàn)代碼
這篇文章主要介紹了C#自動給文章關(guān)鍵字加鏈接實(shí)現(xiàn)代碼,有需要的朋友可以參考一下2013-12-12
C#連接Oracle數(shù)據(jù)庫的多種方法總結(jié)
最近小項(xiàng)目當(dāng)中要使用C#來連接Oracle數(shù)據(jù)庫來完成系統(tǒng)的操作,這篇文章主要給大家介紹了關(guān)于C#連接Oracle數(shù)據(jù)庫的多種方法,文中通過實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-04-04
C#中動態(tài)顯示當(dāng)前系統(tǒng)時(shí)間的實(shí)例方法
想在網(wǎng)頁中動態(tài)地顯示當(dāng)前系統(tǒng)的時(shí)間,找了好多,不過都是一些停在那里不動的。。。不過皇天不負(fù)有心人,終于讓我找到了2013-05-05
C#中的IEnumerable簡介及簡單實(shí)現(xiàn)實(shí)例
這篇文章主要介紹了C#中的IEnumerable簡介及簡單實(shí)現(xiàn)實(shí)例,本文講解了IEnumerable一些知識并給出了一個(gè)簡單的實(shí)現(xiàn),需要的朋友可以參考下2015-03-03
C#常用多線程(線程同步,事件觸發(fā),信號量,互斥鎖,共享內(nèi)存,消息隊(duì)列)
這篇文章主要介紹了C#常用多線程(線程同步,事件觸發(fā),信號量,互斥鎖,共享內(nèi)存,消息隊(duì)列),本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2023-09-09
C# 正則判斷一個(gè)數(shù)字的格式是否有逗號的代碼
c#正則判斷一個(gè)格式化數(shù)字里是否有逗號的解決方法2008-07-07

