C# 尝试在BIXOLON SRP-350plusII上打印,但它可以';我的设计不对
我要在“POS”系统上完成一项任务,而不是旧的系统,即VB 6.0和Access,我尝试使用SQL Server、ADO.NET和C#制作一个新的系统,因此我尝试用BIXOLON打印机打印账单,但当我设计报告时,它看起来不正确,如下所示: 下面是我的测试项目的一些快照(这不是我真正的项目,只是测试) 一些代码:C# 尝试在BIXOLON SRP-350plusII上打印,但它可以';我的设计不对,c#,sql-server,visual-studio,reportviewer,C#,Sql Server,Visual Studio,Reportviewer,我要在“POS”系统上完成一项任务,而不是旧的系统,即VB 6.0和Access,我尝试使用SQL Server、ADO.NET和C#制作一个新的系统,因此我尝试用BIXOLON打印机打印账单,但当我设计报告时,它看起来不正确,如下所示: 下面是我的测试项目的一些快照(这不是我真正的项目,只是测试) 一些代码: private void ID() { cn.Open(); try { SqlCommand cmd
private void ID()
{
cn.Open();
try
{
SqlCommand cmd = new SqlCommand("SELECT Max(ID)+1 FROM Info", cn);
cmd.ExecuteNonQuery();
int i = Convert.ToInt32(cmd.ExecuteScalar());
textBox1.Text = i.ToString();
}
catch
{
textBox1.Text = "1";
}
cn.Close();
}
private void LoadGrid()
{
dataGridView1.DataSource = null;
dataGridView1.Rows.Clear();
SqlDataAdapter ADAP = new SqlDataAdapter("Select * from Info", cn);
DataSet DS = new DataSet();
ADAP.Fill(DS, "Info");
dataGridView1.DataSource = DS.Tables["Info"];
textBox2.SelectAll();
textBox2.Focus();
}
private void Insert()
{
if (textBox2.Text != "")
{
SqlCommand cmd;
cn.Open();
cmd = new SqlCommand("INSERT INTO Info (Name, Date) VALUES (@Name, @Date)", cn);
cmd.Parameters.AddWithValue("@Name", textBox2.Text.Trim());
cmd.Parameters.AddWithValue("@Date", DateTime.Now.ToString());
cmd.ExecuteNonQuery();
cn.Close();
}
else
{
MessageBox.Show("Empty!");
textBox2.Focus();
}
}
private void Delete()
{
SqlCommand cmd = new SqlCommand("DELETE Info WHERE ID = @ID", cn);
cn.Open();
cmd.Parameters.AddWithValue("@ID", textBox1.Text);
cmd.ExecuteNonQuery();
cn.Close();
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'infoDataSet1.Info' table. You can move, or remove it, as needed.
this.InfoTableAdapter.Fill(this.infoDataSet1.Info);
LoadGrid();
ID();
this.reportViewer1.RefreshReport();
this.reportViewer1.RefreshReport();
}
private void button3_Click(object sender, EventArgs e)
{
LoadGrid();
}
private void button2_Click(object sender, EventArgs e)
{
Insert();
LoadGrid();
ID();
textBox2.Focus();
textBox2.Text = "";
}
private void textBox2_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
Insert();
LoadGrid();
ID();
textBox2.Focus();
textBox2.Text = "";
}
}
private void button1_Click(object sender, EventArgs e)
{
Delete();
LoadGrid();
ID();
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.Rows.Count != 0)
{
button1.Enabled = true;
textBox1.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
textBox2.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
}
}
private void button4_Click(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'infoDataSet1.Info' table. You can move, or remove it, as needed.
this.InfoTableAdapter.Fill(this.infoDataSet1.Info);
this.reportViewer1.RefreshReport();
}
}
现在我需要帮助,让它像这样:
将四周(左、右、上、下)的边距设置为0