2
격자 배열을 가지고 있으며 모든 grid.each 그리드를 그의 셀 텍스트 상자에 가지고 있습니다. 격자를 ShowGridLines = false;
으로 설정하고 메소드에 텍스트 상자 테두리를 제거하십시오.GridLines없이 WPF 격자 인쇄
private void DeletBorder()
{
Thickness bor = new Thickness(0.0);
for (int i = 0; i < this.gridArray.Length; i++)
{
foreach (Control ctrl in this.gridArray[i].Children)
{
if (ctrl.GetType() == typeof(TextBox))
{
((TextBox) ctrl).BorderThickness = bor;
}
}
}
}
나는이 방법으로 배열에있는 모든 그리드를 인쇄하려고 :
private void button1_Click(object sender, RoutedEventArgs e)
{
if (this.comboBox1.SelectedIndex > -1)
{
PrintDialog printDlg = new PrintDialog();
this.DeletBorder();
if (printDlg.ShowDialog() == true)
{
this.DeletBorder();
foreach (Grid item in this.gridArray)
{
printDlg.PrintVisual(item, "Stiker Print Job");
}
}
}
else
{
MessageBox.Show("you must select the page layout first");
}
}
하지만 결과는 첫 번째 페이지 테두리/눈금 선없이 인쇄하지만, 다른 하나는 여전히 테두리를 인쇄한다는 것입니다/gridLines