Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Print - ControlNode (Read 3738 times)
Tx2000
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Oct 18th, 2007
Print - ControlNode
Oct 18th, 2007 at 8:28am
Print Post  
Hi,

Is it possible to print the user controls introduced in a ControlNode?

Thank you.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Print - ControlNode
Reply #1 - Oct 18th, 2007 at 8:47am
Print Post  
Hi,

FlowChart.NET automatically prints controls that paint themselves by implementing the Control.OnPaint method. If a control is a wrapper around a native Win32 control, it cannot be printed automatically.

To work around that, you can handle the PaintControl event and draw the controls yourself. E.g. the PaintControl help topic contains an example showing how to do that for a TextBox.

Some .NET 2 controls implement the DrawToBitmap method, which you could call from your PaintControl event handler to draw the controls.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Tx2000
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Oct 18th, 2007
Re: Print - ControlNode
Reply #2 - Oct 18th, 2007 at 11:36am
Print Post  
I implemented the DrawToBitmap method succesfully but only work corretly in "overview" control.

Code:

       private void controls_paint (object sender, PaintControlEventArgs e)
       {
           if (e.Node.Control is Control_Notas.Control_Notas )
           {
               Control_Notas.Control_Notas cn = (Control_Notas.Control_Notas)e.Node.Control;

               Rectangle rf = Rectangle.Round(e.Node.Control.DisplayRectangle);
               Bitmap bmp = new Bitmap(rf.Width, rf.Height);
               e.Node.Control.DrawToBitmap(bmp, rf);

               Rectangle rf2 = Rectangle.FromLTRB(0,0,bmp.Width,bmp.Height );

               e.Graphics.DrawImage(bmp, e.PaintRect,rf2, GraphicsUnit.Pixel);

           }

When I launch printpreview, not work correctly.

Thank You.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Print - ControlNode
Reply #3 - Oct 18th, 2007 at 12:10pm
Print Post  
Hi,

Set DiagramView.PrintOptions.PaintControls = true and it should work when printing / previewing too.

Stoyan
  
Back to top
 
IP Logged
 
Tx2000
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Oct 18th, 2007
Re: Print - ControlNode
Reply #4 - Oct 18th, 2007 at 12:45pm
Print Post  
Undecided

Not work correctly.

       private void PrintPreview_Button_Click(object sender, EventArgs e)
       {
           this.Vista_Diagrama.PrintOptions.PaintControls = true;
           this.Vista_Diagrama.PrintPreview();
       }



****
Visual Studio 2005
C#
NET 2.0
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Print - ControlNode
Reply #5 - Oct 18th, 2007 at 1:00pm
Print Post  
Isn't the event raised at all, or you don't like how the bitmap is drawn?
  
Back to top
 
IP Logged
 
Tx2000
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Oct 18th, 2007
Re: Print - ControlNode
Reply #6 - Oct 18th, 2007 at 1:58pm
Print Post  
Example:

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Print - ControlNode
Reply #7 - Oct 18th, 2007 at 3:43pm
Print Post  
Set PrintOptions.TargetView = this.Vista_Diagrama before calling the PrintPreview method. The control should do that automatically, but it seems we have omitted it.

Stoyan
  
Back to top
 
IP Logged
 
Tx2000
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Oct 18th, 2007
Re: Print - ControlNode
Reply #8 - Oct 18th, 2007 at 4:59pm
Print Post  
THANK YOU!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint