基本信息
源码名称:winform 温度计控件 示例源码(mvc)
源码大小:0.02M
文件格式:.zip
开发语言:C#
更新时间:2017-12-22
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍


namespace MVC_Example
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class MVCForm : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public TemperatureModel temperature = new TemperatureModel();

public MVCForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();


}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null) 
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
// 
// MVCForm
// 
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(520, 443);
this.IsMdiContainer = true;
this.Name = "MVCForm";
this.Text = "MVC Example";
this.Load = new System.EventHandler(this.MVCForm_Load);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() 
{
Application.Run(new MVCForm());
}

private void MVCForm_Load(object sender, System.EventArgs e)
{
TemperatureForm celsius = new TemperatureForm("Celsius");
TemperatureForm farenheit = new TemperatureForm("Farenheit");
FarenheitGauge farenheitGauge = new FarenheitGauge();
CelsiusScroll celsiusScroll = new CelsiusScroll();

celsius.MdiParent = this;
celsius.valueStrategy = new CelsiusStrategy(temperature);
celsius.Location = new Point(0,0);
celsius.Show();
temperature.TemperatureChanged = new TemperatureModel.TemperatureChangedHandler(celsius.TemperatureDisplay);

farenheit.MdiParent = this;
farenheit.valueStrategy = new FarenheitStrategy(temperature);
farenheit.Show();
temperature.TemperatureChanged = new TemperatureModel.TemperatureChangedHandler(farenheit.TemperatureDisplay);

farenheitGauge.MdiParent = this;
farenheitGauge.valueStrategy = new ValueDecorator(new FarenheitStrategy(temperature),300,-200);
farenheitGauge.MaxTemp = 300;
farenheitGauge.MinTemp = -200;
farenheitGauge.Show();
temperature.TemperatureChanged = new TemperatureModel.TemperatureChangedHandler(farenheitGauge.TemperatureDisplay);

celsiusScroll.MdiParent = this;
celsiusScroll.valueStrategy = new ValueDecorator(new CelsiusStrategy(temperature),150,-100);
celsiusScroll.MaxTemp = 150;
celsiusScroll.MinTemp = -100;
celsiusScroll.Show();
temperature.TemperatureChanged = new TemperatureModel.TemperatureChangedHandler(celsiusScroll.TemperatureDisplay);

}

}
}