消えゆく世界と流れる未来に最後の灯を since 2006/4/3
private void onWindowLoaded(object sender, RoutedEventArgs e) {
int num_col = (int)this.Height/50;
int num_row = (int)this.Width/50;
for (int i=0; i<num_col; i++) {
RowDefinition rd = new RowDefinition();
imageGrid.RowDefinitions.Add(rd);
}
for (int i=0; i<num_row; i++) {
ColumnDefinition cd = new ColumnDefinition();
imageGrid.ColumnDefinitions.Add(cd);
}
for (int i=0; i<num_col; i++) {
for (int j=0; j<num_row; j++) {
Label l = new Label();
l.Content = (j+i*num_row).ToString();
Grid.SetRow(l,i);
Grid.SetColumn(l,j);
imageGrid.Children.Add(l);
}
}
}
<window x:class="ImageViewer.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="MainWindow" height="350" width="525" loaded="onWindowLoaded">
<grid x:name="imageGrid" horizontalalignment="Stretch" verticalalignment="Stretch" showgridlines="True" margin="0" />
</window>
とりあえず縦横の線を引いてみた。