最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
DotNet中不规则窗体的创建方法
时间:2008-01-12 编辑:简简单单 来源:一聚教程网
ShapedForms
http://www.c-sharpcorner.com/Graphics/Shaped1.jpg
Today Windows always appear with a rectangular shape. What if you could have a window that was shaped like a circle, a square or a triangle or any shape you want.
I discovered tonight you could use regions to in effect clip a window to any shape you want. The effect is almost to look like an active desktop component as you cannot move these shaped windows. Having done this and created some animation on your desktop I wonder if you could load a bitmap as the basis for your windows. Note you lose the titlebars etc but it looks like a useful technique.
Here is the source code. Apologies if its messy but its been a long night searching for how to do this. I have attached the exe as well for Beta 2
Enjoy
John
Source Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Drawing2D;
namespace ShapedForm
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Timer timer1;
private System.ComponentModel.IContainer components;
http://www.c-sharpcorner.com/Graphics/Shaped1.jpg
Today Windows always appear with a rectangular shape. What if you could have a window that was shaped like a circle, a square or a triangle or any shape you want.
I discovered tonight you could use regions to in effect clip a window to any shape you want. The effect is almost to look like an active desktop component as you cannot move these shaped windows. Having done this and created some animation on your desktop I wonder if you could load a bitmap as the basis for your windows. Note you lose the titlebars etc but it looks like a useful technique.
Here is the source code. Apologies if its messy but its been a long night searching for how to do this. I have attached the exe as well for Beta 2
Enjoy
John
Source Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Drawing2D;
namespace ShapedForm
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Timer timer1;
private System.ComponentModel.IContainer components;
相关文章
- C#复制数组的两种方式及效率比较解读 10-24
- ASP.NET Identity用法解析 10-24
- ASP.NET MVC使用Identity增删改查用户介绍 10-24
- C语言中atoi函数模拟实现介绍 10-18
- .Net反向代理组件Yarp用法介绍 10-10
- .NET使用YARP通过编码方式配置域名转发实现反向代理教程 10-10