|
Hi,
Now I have two questions here.
1.
I am using the graphics object to create a customized report from a database. To ensure WYSIWIG, I use the same functions in the paint event of the panel with the printPage event of a PrintDocument after passing the necessary event arguments.
So far there is no trouble. Printing and previewing works just the way I want.
(NB - Did not use the printPreviewControl as I felt it was way slower than a panel. Don't know if I am right.)
So, Am I going the right way to create a WYSIWIG compliant application?
2.
I want to save the created report into a XML format. I used the XMLWriter class, and was almost succesful in saving the report. I was ready to pat myself in the back and call it a day when it occured that I knew no way to serialize a Brush object. All I want to store is just the brush color.
How can I get the color of a brush object? Because I don't see any properties exposed. Any workarounds?
modified 30-Jan-13 7:49am.
|
|
|
|
|
Here is an advanced print preview dialog/control[^]. That may help.
As for the brush, figure out the type (likely a solid brush), cast it to that type, and serialize the properties you want.
e.g. (for a solid brush)
if(brush is SolidBrush)
{
SolidBrush sb = (SolidBrush)brush;
}
else if(brush is LinearGradientBrush)
{
}
Bob Dole The internet is a great way to get on the net.
2.0.82.7292 SP6a
|
|
|
|
|
Thanks a lot.
Casting the brush object was exactly what I needed. So simple.
And yeah, it was a SolidBrush.
Will have to study the PrintPreviewControl article a bit though.
Thanks again.
|
|
|
|