set Margin to 0 all around(left, right, top, bottom)
try to print on BIXOLON SRP-350plusII, but it can't get my design right
-
02-10-2022 - |
質問
i have a task to do on "POS" system, instead the old system witch was VB 6.0 and Access, i try to make a new one with SQL Server, ADO.NET and C#, so i try to print bills out of BIXOLON printer, but when i design my report it doesn't appear correct, it looks like this: here is some shots of my test project (this isn't my real project, its just testing) Some code:
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();
}
}
now i need help to make it out like this:
解決
所属していません StackOverflow