|
楼主 |
发表于 2013-11-26 15:34:13
|
显示全部楼层
<!--[if !vml]-->file:///C:/Users/ADMINI~1/AppData/Local/Temp/msohtml1/01/clip_image002.gif<!--[endif]-->
如何设置控件及菜单,编写代码将该窗体上显示的结果页面打印输出?刚那个例子看不太懂,刚学不久,求教
图片按那操作还是上传不了,接一个form窗口,上面放了11个标签和文本框,用于输入参数输出结果,还有两个命令按钮,一个datagridview控件
namespace 底水驱油藏水平井三位稳态解产能曲线
{
public partial class Form1 : Form
{
#region 参数变量声明
//底水驱油藏水平井
double Dbl_BoundaryPressure_MPa;//边界压力Pe,Mpa
double Dbl_BottomHolePressure_MPa;//井底压力Pwf,Mpa
double Dbl_zw_m;//井距油水界面的距离zw,m
double Dbl_WellboreRadius_m;//井筒半径rw,m
double Dbl_HorizontalWellLength_m;//水平井长度L,m
double Dbl_ReservoirThickness_m;//油藏厚度h,m
double Dbl_TheViscosityOfCrudeOil_mPas;//原油粘度μo,mPa*s
double Dbl_HorizontalPermeability_mD;//水平地层渗透率kh,mD
double Dbl_VerticalPermeability_mD;//垂直地层渗透率kv,mD
double Dbl_CrudeOilVolumeFacto;//原油体积系数Bo
//定义生成图表变量
double NewPwf;//参数横轴井底流压
double Q;//纵轴参数油井产能
#endregion
public Form1()
{
InitializeComponent();
}
public void button1_Click(object sender, EventArgs e)
{
#region 参数赋值并计算产能值
Dbl_BoundaryPressure_MPa = Convert.ToDouble(textBox1.Text);//把textBox1中的文本赋给变量边界压力
Dbl_BottomHolePressure_MPa = Convert.ToDouble(textBox2.Text);//把textBox2中的文本赋给变量井底压力
Dbl_zw_m = Convert.ToDouble(textBox3.Text);//把textBox3中的文本赋给变量井距油水界面的距离
Dbl_WellboreRadius_m = Convert.ToDouble(textBox4.Text);//把textBox4中的文本赋给变量井筒半径
Dbl_HorizontalWellLength_m = Convert.ToDouble(textBox5.Text);//把textBox5中的文本赋给变量水平井长度
Dbl_ReservoirThickness_m = Convert.ToDouble(textBox6.Text);//把textBox6中的文本赋给变量油藏厚度
Dbl_TheViscosityOfCrudeOil_mPas = Convert.ToDouble(textBox7.Text);//把textBox7中的文本赋给变量原油粘度
Dbl_HorizontalPermeability_mD = Convert.ToDouble(textBox8.Text);//把textBox8中的文本赋给变量水平地层渗透率
Dbl_VerticalPermeability_mD = Convert.ToDouble(textBox9.Text);//把textBox9中的文本赋给变量垂直地层渗透率
Dbl_CrudeOilVolumeFacto = Convert.ToDouble(textBox10.Text);//把textBox10中的文本赋给变量原油体积系数
textBox12.Text = 底水驱油藏水平井三位稳态解产能.HorizontalWellsInBottomWater(this.Dbl_BoundaryPressure_MPa,
this.Dbl_BottomHolePressure_MPa, this.Dbl_zw_m, this.Dbl_WellboreRadius_m,
this.Dbl_HorizontalWellLength_m,this.Dbl_ReservoirThickness_m,
this.Dbl_TheViscosityOfCrudeOil_mPas, this.Dbl_HorizontalPermeability_mD,
this.Dbl_VerticalPermeability_mD, this.Dbl_CrudeOilVolumeFacto).ToString();
#endregion
}
private void button2_Click(object sender, EventArgs e)
{
#region 生成Q-Pwf折线图
//折线图坐标轴设定
double Dbl_temp = Dbl_BoundaryPressure_MPa / 10;
List<double> xList = new List<double>();
List<double> yList = new List<double>();
for (double Dbl_i = 0; Dbl_i < Dbl_BoundaryPressure_MPa; Dbl_i += Dbl_temp)
{
NewPwf = Dbl_i;//生成参数井底流压的值
xList.Add(NewPwf);
Q = 底水驱油藏水平井三位稳态解产能.HorizontalWellsInBottomWater(this.Dbl_BoundaryPressure_MPa,
this.NewPwf, this.Dbl_zw_m, this.Dbl_WellboreRadius_m, this.Dbl_HorizontalWellLength_m,
this.Dbl_ReservoirThickness_m, this.Dbl_TheViscosityOfCrudeOil_mPas, this.Dbl_HorizontalPermeability_mD, this.Dbl_VerticalPermeability_mD, this.Dbl_CrudeOilVolumeFacto);//返回参数油井产能的值
yList.Add(Q);
}
chart1.Series[0].Points.Clear();
for (int Int_j = 0; Int_j < xList.Count - 1; Int_j += 2)
{
chart1.Series[0].Points.AddXY(xList[Int_j], yList[Int_j]);
}
#endregion
}
}
}
|
|