private void CreateBitmap()
        {
            var border = new Border {
                Background = Brushes.Red
            };
            var text = new TextBlock {
                Text = "hoge"
            };

            border.Child = text;
            border.Arrange(new System.Windows.Rect(0, 0, 200, 200));

            var bitmap = new RenderTargetBitmap(200, 200, 96, 96, PixelFormats.Default);

            bitmap.Render(border);
            bitmap.Freeze();
        }
        private void NiceCreateBitmap()
        {
            var border = new Border {
                Background = Brushes.Red
            };
            var text = new TextBlock {
                Text = "hoge"
            };

            border.Child = text;
            border.Arrange(new System.Windows.Rect(0, 0, 200, 200));

            var bitmap = new RenderTargetBitmap(200, 200, 96, 96, PixelFormats.Default);

            bitmap.Render(border);
            bitmap.Freeze();

            Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.SystemIdle);
            Dispatcher.Run();
        }