I have a label and on this label I have a field that is very large.
I need to break the line, to go to the bottom line when it reaches a certain number of characters.
etqfracpic1.Add("Cas: " + reader[10].ToString());
// como estou passando o comando
How can I do this?
I'm sorry to follow the complete code.
List<string> etqfracpic = new List<string>();
List<string> etqfracpic1 = new List<string>();
public frmEtqFracPic(string guiapic)
{
InitializeComponent();
txt_guia.Text = guiapic;
}
private void etqfrac()
{
conex.Open();
SqlCommand comando;
StringBuilder Query = new StringBuilder();
Query.Append(" SELECT ");
Query.Append(" CAST(0 AS bit) AS SELECIONAR ");
Query.Append(" ,SC.C2_NUM ");
Query.Append(" ,SB.B1_DESC ");
Query.Append(" ,SC.C2_XNOMFA ");
Query.Append(" ,SC.C2_XNPAIS ");
Query.Append(" ,SC.C2_XLOTEF ");
Query.Append(" ,CONVERT(VARCHAR(10),CAST(SB.B1_PESO AS NUMERIC(15, 3))) + ' ' + SB.B1_XSEGUM AS PESO ");
Query.Append(" ,CONVERT(VARCHAR(10),CAST(SB.B1_PESBRU AS NUMERIC(15, 3))) + ' ' + SB.B1_XSEGUM AS PESBRU ");
Query.Append(" ,CONVERT(VARCHAR(10), CAST( SC.C2_XDTFAB AS DATE),103) AS DATAF ");
Query.Append(" ,CONVERT(VARCHAR(10), CAST( SC.C2_XDTVALI AS DATE),103) AS DATAV ");
Query.Append(" ,SB.B1_XCAS ");
Query.Append(" ,CB.CB0_CODETI AS [COD. BARRAS] ");
Query.Append(" FROM SC2020 AS SC ");
Query.Append(" INNER JOIN SB1020 AS SB WITH (NOLOCK) ON SB.B1_COD = SC.C2_PRODUTO ");
Query.Append(" INNER JOIN CB0020 AS CB WITH (NOLOCK) ON CB.CB0_LOTE = SC.C2_XLOTE ");
Query.Append(" WHERE C2_NUM = @C2_NUM ");
comando = conex.CreateCommand();
comando.CommandText = Query.ToString();
comando.Parameters.Add("@C2_NUM", SqlDbType.VarChar).Value = txt_guia.Text.Trim();
DataTable tableGrid = (DataTable)DGW_EtqPic.DataSource;
DataTable tableRelatorio = null;
var filter = from DataRow row in tableGrid.Rows
where Convert.ToBoolean(row["SELECIONAR"])
select row;
if (filter.Count() > 0)
{
tableRelatorio = filter.CopyToDataTable();
SqlDataReader reader = comando.ExecuteReader();
{
while (reader.Read())
{
txt_codbarraspic.Text = reader[11].ToString();
txt_cas.Text = reader[10].ToString();
etqfracpic.Add("PRODUTO: " + " " + reader[2].ToString());
etqfracpic.Add("FABRICANTE: " + " " + reader[3].ToString());
etqfracpic.Add("ORIGEM: " + " " + reader[4].ToString());
etqfracpic.Add("LOTE" + " " + reader[5].ToString());
etqfracpic.Add("P. BRUTO: " + reader[7].ToString() + " " + "P. LIQUIDO: " + " " + reader[6].ToString());
etqfracpic.Add("FABRICAÇÃO: " + " " + reader[9].ToString() + " " + "VALIDADE: " + " " + reader[9].ToString());
etqfracpic1.Add("CAS: " + txt_cas.Text.Replace("-", "").Replace(" ", ""));
etqfracpic.Add("Guia: " + reader[1].ToString());
BarcodeLib.Barcode codbarraspic = new BarcodeLib.Barcode();
codbarraspic.IncludeLabel = true;
PB_codbarraspic.BackgroundImage = codbarraspic.Encode(BarcodeLib.TYPE.CODE128, txt_codbarraspic.Text.Replace(" ", ""), Color.Black, Color.White, 300, 60);
Etqpic.Print();
etqfracpic.Clear();
etqfracpic1.Clear();
break;
}
}
conex.Close();
}