Commit 954dc085 authored by liu's avatar liu

新增自定义提示控件,解决了中后检测器保护温度设定无效的问题

parent 14a202a3
......@@ -144,6 +144,7 @@
this.OMAXTemp.Name = "OMAXTemp";
this.OMAXTemp.Size = new System.Drawing.Size(82, 24);
this.OMAXTemp.TabIndex = 2;
this.OMAXTemp.TextChanged += new System.EventHandler(this.OMAXTemp_TextChanged);
this.OMAXTemp.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxDec_KeyPress);
//
// label3
......
......@@ -484,5 +484,16 @@ namespace GcDevicePc.ConfigMethod
}
}
private void OMAXTemp_TextChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.OMAXTemp.Text))
{
if (globaldata.m_hwconfig.hwconfiginfo.u16ColPTemp < Convert.ToInt32(this.OMAXTemp.Text))
{
MessageBox.Show("最高温度不能大于保护温度");
this.OMAXTemp.Text = "0";
}
}
}
}
}
......@@ -1090,12 +1090,12 @@ namespace GcDevicePc.GCBuffer
HwConfigFile.WriteInteger("辅助设置", "辅助1", hwconfiginfo.u16AuxHeater1);
HwConfigFile.WriteString("辅助设置", "辅助名字1", hwconfiginfo.u16AuxHeaterName1);
HwConfigFile.WriteInteger("辅助设置", "辅助1保护温度", hwconfiginfo.u16AuxHeaterPTemp1);
HwConfigFile.WriteInteger("检测单元", "中检测器保护温度", hwconfiginfo.u16AuxHeaterPTemp1);
//HwConfigFile.WriteInteger("检测单元", "中检测器保护温度", hwconfiginfo.u16AuxHeaterPTemp1);
HwConfigFile.WriteInteger("辅助设置", "辅助2", hwconfiginfo.u16AuxHeater2);
HwConfigFile.WriteString("辅助设置", "辅助名字2", hwconfiginfo.u16AuxHeaterName2);
HwConfigFile.WriteInteger("辅助设置", "辅助2保护温度", hwconfiginfo.u16AuxHeaterPTemp2);
HwConfigFile.WriteInteger("检测单元", "后检测器保护温度", hwconfiginfo.u16AuxHeaterPTemp2);
//HwConfigFile.WriteInteger("检测单元", "后检测器保护温度", hwconfiginfo.u16AuxHeaterPTemp2);
}
catch
......
......@@ -587,6 +587,12 @@
<Compile Include="ListViewTest.designer.cs">
<DependentUpon>ListViewTest.cs</DependentUpon>
</Compile>
<Compile Include="LMessageBox.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LMessageBox.Designer.cs">
<DependentUpon>LMessageBox.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
......@@ -903,6 +909,9 @@
<EmbeddedResource Include="ListViewTest.resx">
<DependentUpon>ListViewTest.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LMessageBox.resx">
<DependentUpon>LMessageBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
......
namespace GcDevicePc
{
partial class LMessageBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (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()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button1.Location = new System.Drawing.Point(40, 88);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(83, 36);
this.button1.TabIndex = 0;
this.button1.Text = "确 定";
this.button1.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button2.Location = new System.Drawing.Point(158, 88);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(83, 36);
this.button2.TabIndex = 0;
this.button2.Text = "取 消";
this.button2.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(21, 34);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 1;
this.label1.Text = "label1";
//
// LMessageBox
//
this.AcceptButton = this.button1;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.button2;
this.ClientSize = new System.Drawing.Size(273, 136);
this.Controls.Add(this.label1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "LMessageBox";
this.Text = "提示";
this.Load += new System.EventHandler(this.LMessageBox_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label1;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace GcDevicePc
{
public partial class LMessageBox : Form
{
public LMessageBox()
{
InitializeComponent();
}
public LMessageBox(Point fp,Size fs, bool isup, string Title, string Tips, MessageBoxPosition mbp)
{
InitializeComponent();
switch (mbp)
{
case MessageBoxPosition.MBP_BottomLeft:
this.StartPosition = FormStartPosition.Manual; //窗体的位置由Location属性决定
this.Location = (Point)new Size(fp.X, fp.Y + fs.Height - this.Height);
break;
case MessageBoxPosition.MBP_Center:
this.StartPosition = FormStartPosition.Manual; //窗体的位置由Location属性决定
this.Location = (Point)new Size(fp.X + (fs.Width / 2) - this.Width, fp.Y + (fs.Height / 2) - this.Height);
break;
case MessageBoxPosition.MBP_BottomRight:
this.StartPosition = FormStartPosition.Manual; //窗体的位置由Location属性决定
this.Location = (Point)new Size(fp.X+ fs.Width- this.Width, fp.Y + fs.Height - this.Height);
break;
default:
break;
}
this.TopMost = isup;
if (!string.IsNullOrEmpty(Title))
{
this.Text = Title;
}
if (!string.IsNullOrEmpty(Tips))
{
TipsText = Tips;
}
}
private string TipsText { get; set; }
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
int x = ((this.Width - label1.Width)/2);
int y = label1.Location.Y;
label1.Location = new System.Drawing.Point(x, y);
}
public enum MessageBoxType
{
MBT_NoButton,
MBT_ButtonOK,
MBT_ButtonOKCancel,
MBT_ButtonYesNo
}
public enum MessageBoxPosition
{
MBP_BottomLeft,
MBP_Center,
MBP_BottomRight
}
private void LMessageBox_Load(object sender, EventArgs e)
{
label1.Text = TipsText;
OnResize(e);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
This diff is collapsed.
......@@ -39,7 +39,7 @@
this.ClientSize = new System.Drawing.Size(1008, 730);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "MainForm";
this.Text = "VOCs在线监测-1.5.1 用户窗口";
this.Text = "Tetchrom色谱工作站-1.5.2 用户界面";
this.ResumeLayout(false);
this.PerformLayout();
......
......@@ -15,6 +15,7 @@ namespace GcDevicePc
{
public partial class TestForm : Form
{
private Button MyButton;//创建Button
public TestForm()
{
InitializeComponent();
......@@ -22,9 +23,44 @@ namespace GcDevicePc
//title.Show();
//bgWorker.RunWorkerCompleted += BgWorker_RunWorkerCompleted;
this.FormClosed += CloseDialog;
MyButton = new Button();//实例化Button
MyButton.Left = 30;//设置控件离form左边的距离
MyButton.Top = 130;//设置控件离form上边的距离
MyButton.Width = 200;//设置控件的宽度
MyButton.Text = "弹出对话框";//按钮显示名称
MyButton.Click += ShowMessage;//按钮单机事件
this.Controls.Add(MyButton);//将控件加入到form中
}
//GCTitle title = new GCTitle();
/// <summary>
/// 弹出对话框
/// </summary>
/// <param name="sender">出发事件的对象</param>
/// <param name="e">事件信息</param>
private void ShowMessage(object sender, EventArgs e)
{
MessageBox.Show("这是最简单的弹出框", "弹出对话框");
}
/// <summary>
/// 关闭提示
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CloseDialog(object sender, EventArgs e)
{
//创建我的提示框
LMessageBox dialog = new LMessageBox(this.Location,this.Size, true, "123456", "11111111111111111111", LMessageBox.MessageBoxPosition.MBP_BottomRight);
//注意提示框的返回值,是DialogResult这个枚举
if (dialog.ShowDialog() == DialogResult.No)
{
((System.ComponentModel.CancelEventArgs)e).Cancel = true;
}
}
BackgroundWorker bgWorker = new BackgroundWorker();
PrompBox loadingCtl = new PrompBox(162, true);//定义加载控件
private void BgWorker_DoWork(object sender, DoWorkEventArgs e)
......@@ -77,21 +113,9 @@ namespace GcDevicePc
//this.pictureMenu1.PMOptbtnstatus = 4;
//(this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 3;
//tinfliang
if (form1 == null)
{
form1 = new Form1(1111);
form1.Show();
}
else if (form1.IsDisposed)
{
form1 = new Form1(1111);
form1.Show();
}
else
{
form1.Activate();
}
//LMessageBox box = new LMessageBox();
//box.Show(100, 100, this.Location, true, "1230", "3214", LMessageBox.MessageBoxType.MBT_ButtonOK);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment