PDA

Click to See Complete Forum and Search --> : BmpBitmapEncoder Background is alway black


bflosabre91
Dec 1st, 2009, 04:15 PM
i am converting the multiple children of an inkcanvas to a flattened bitmap. But when i create it, it puts in a black background no matter what. I just want it to have a white background... here is my code if anyone has any pointers i would really appreciate it. thanks


ink1.Background = Brushes.White
Dim rtb As New RenderTargetBitmap(675, 624, 96D, 96D, PixelFormats.Default)
rtb.Render(ink1.Children.Item(0))
For i As Int32 = 0 To gridcontent.Children.Count - 1
If gridcontent.Children.Item(i).GetType.FullName = GetType(Button).FullName Then
rtb.Render(gridcontent.Children.Item(i))
End If
Next i
Dim encoder As New BmpBitmapEncoder
encoder.Frames.Add(BitmapFrame.Create(rtb))
Dim fs As FileStream = File.Open(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\AssessmentImages" & "\Report" & ".bmp", FileMode.Create)
encoder.Save(fs)
fs.Close()


ink1 is my inkcanvas, obviously.