0
嗨,我是全新的mirosoft视觉工作室,我想创建一个基本的圆形,但我有以下错误:不能将类型'双'转换为int。存在明确的转换。 (?你缺少强制)微软视觉工作室基本形式
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int radius = Convert.ToInt32(textBox1.Text);
int circumference = 2 * Math.PI * radius;
int area = Math.PI * Math.Pow(radius, 2);
int volume = (4 * Math.PI/3) * Math.Pow(radius, 3);
Graphics paper;
paper = pictureBox1.CreateGraphics();
Pen pen = new Pen(Color.Red);
paper.DrawEllipse(pen, 0, circumference, area, volume);
}
}
}
是否有可能只做双打?我尝试了这种方式,但然后我在我的最后一行“paper.DrawEllipse(笔,0,周长,面积,体积)有一个错误;”说它必须是诠释。 – mrName
你也必须在其他部分也加上括号 – MikeB
谢谢大家回答我的问题,你们都帮助我解决了我的问题,我真的赞赏你在解决我的问题时付出的努力和时间;) – mrName