减少白色空间行 [英] Reduce White Space Row
本文介绍了减少白色空间行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目标:
在richtextbox顶部的行中减少空白区域。我有列名但它不可见。列名称占用了richtextbox顶部的空格。我想删除列名以减少空间。
问题:
它有空格行的原因是由于无形的专栏名称,我想知道我该怎样做才能满足目标?
Goal:
Less white space in the row on the top of the richtextbox. I have column name but it is not visible. Column name takes space in the top of richtextbox. I want to remove the column name in order to reduce space.
Problem:
The reason why it has white space row is due to invisibly column name and I wonder how should I do in order to fullfill the goal?
private void btn_test_Click(object sender, RoutedEventArgs e)
{
Table table = newRtb.FindName("MyTable") as Table;
foreach (TableRow row in table.RowGroups[0].Rows)
{
if (row.Background == Brushes.SpringGreen)
{
//get value of third cell:
BlockUIContainer container = row.Cells[2].Blocks.ElementAt(0) as BlockUIContainer;
TextBlock textBlock = container.Child as TextBlock;
MessageBox.Show(textBlock.Text);
}
}
}
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
var tab = new Table();
tab.Name = "MyTable";
newRtb.RegisterName("MyTable", tab);
var gridLenghtConvertor = new GridLengthConverter();
tab.Columns.Add(new TableColumn() { Name = "Column1", Width = (GridLength)gridLenghtConvertor.ConvertFromString("*") });
tab.Columns.Add(new TableColumn() { Name = "Column2", Width = (GridLength)gridLenghtConvertor.ConvertFromString("*") });
tab.Columns.Add(new TableColumn() { Name = "Column3", Width = new GridLength(0) });
tab.RowGroups.Add(new TableRowGroup());
for (int i = 0; i < 10; i++)
{
TableRow tr = new TableRow();
tr.MouseLeftButtonDown += tr_MouseLeftButtonDown;
tab.RowGroups[0].Rows.Add(tr);
var tabRow = tab.RowGroups[0].Rows[i];
tabRow.Cells.Add(new TableCell(new Paragraph(new Run("Row" + (i + 1).ToString() + " Column1"))) { TextAlignment = TextAlignment.Center });
tabRow.Cells.Add(new TableCell(new Paragraph(new Run("Row" + (i + 1).ToString() + " Column2"))));
BlockUIContainer container = new BlockUIContainer();
container.Child = new TextBlock(){ Text = "Test"};
tabRow.Cells.Add(new TableCell(container));
}
newRtb.Document.Blocks.Add(tab);
}
推荐答案
这篇关于减少白色空间行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文