winfrom button变圆形。。。。

tcxluck 2010-01-08 01:08:47
怎么改变winfrom button形状? 我想变成圆形。。。。 急。。
...全文
203 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
caresong 2011-12-12
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 wartim 的回复:]
C# code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawin……
[/Quote]
这个方法没错,不过怎么调节设置的值,我试了只是固定在左边,放在其他地方数值不好调
hejialin666 2010-01-08
  • 打赏
  • 举报
回复
自定义控件了
mjp1234airen4385 2010-01-08
  • 打赏
  • 举报
回复
虽然没有试验过,
但3楼的是一种方法了。
其他的方法,就是使用WindowsAPI CreateWindowsRGN了。
wulei33031108 2010-01-08
  • 打赏
  • 举报
回复
自己做个控件,这有现成的。
http://www.codeproject.com/KB/cs/Industrial_Controls2.aspx
wartim 2010-01-08
  • 打赏
  • 举报
回复
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 WindowsApplication282
{
public partial class Form1 : Form
{
Button B = new Button();

public Form1()
{
InitializeComponent();

B.Parent=this;
B.Size = new Size(100, 100);

GraphicsPath GP = new GraphicsPath();
GP.AddEllipse(10,10, 80, 80);

B.Region = new Region(GP);

B.Paint += new PaintEventHandler(B_Paint);
}

void B_Paint(object sender, PaintEventArgs e)
{
Pen P = new Pen(Color.Gray);
P.Width = 10;

e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
e.Graphics.DrawEllipse(P, new Rectangle(10, 10, 80, 80));

if (this.ActiveControl == B && Control.MouseButtons == MouseButtons.Left)
e.Graphics.DrawEllipse(Pens.Black, new Rectangle(15, 15, 70, 70));
}
}
}
tcxluck 2010-01-08
  • 打赏
  • 举报
回复
怎么做?能贴出代码吗?
Dobzhansky 2010-01-08
  • 打赏
  • 举报
回复
方的 Button 用户不喜欢点击么?

自己用个 Control paint 吧

110,545

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧