出力する小数の桁数を指定する場合はこちらの記事を参照してください。
{(インデックス番号):f}
または、{(インデックス番号):F}
の文字列を与えます。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 NumericFormatDemo
{
public partial class FormFloating : Form
{
public FormFloating()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double value = 0.32;
textBox_Output.Text += string.Format("{0:f}\r\n", value);
value = 1.496;
textBox_Output.Text += string.Format("{0:f}\r\n", value);
value = 0.0000042;
textBox_Output.Text += string.Format("{0:f}\r\n", value);
value = 1.0;
textBox_Output.Text += string.Format("{0:f}\r\n", value);
}
}
}