Files
602_WGJ/LargeSquareOne/FrmMesParamMsgBoxWithAck.cs
T

79 lines
2.3 KiB
C#
Raw Normal View History

2025-07-16 18:08:40 +08:00
using System;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
namespace LargeSquareOne
{
public partial class FrmMesParamMsgBoxWithAck : Form
{
DataTable dataTable = new DataTable();
string strLblMessage = "";
public FrmMesParamMsgBoxWithAck(DataTable _dataTable, string _strLblMessage)
{
InitializeComponent();
this.TopMost = true;
dataTable = _dataTable;
strLblMessage = _strLblMessage;
this.Text = _strLblMessage;
}
private void btn_Sure_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
private void btn_Cancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.No;
this.Close();
}
private void btn_Close_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
#region 无边框拖动
private Point mPoint;
private void Panel_MouseDown(object sender, MouseEventArgs e)
{
2025-07-31 11:18:43 +08:00
mPoint = new Point(e.X, e.Y);
2025-07-16 18:08:40 +08:00
}
private void Panel_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
2025-07-31 11:18:43 +08:00
this.Location = new Point(this.Location.X + e.X - mPoint.X, this.Location.Y + e.Y - mPoint.Y);
2025-07-16 18:08:40 +08:00
}
}
#endregion
private void FrmMesParamMsgBoxWithAck_Load(object sender, EventArgs e)
{
dataGridView1.DataSource = dataTable;
lblMessage.Text = strLblMessage;
}
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
//自动编号,与数据无关
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
e.RowBounds.Location.Y,
dataGridView1.RowHeadersWidth - 4,
e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics,
(e.RowIndex + 1).ToString(),
dataGridView1.RowHeadersDefaultCellStyle.Font,
rectangle,
dataGridView1.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
}
}