Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Get transparent Image of a node (Read 3038 times)
feugen24
YaBB Newbies
*
Offline



Posts: 27
Joined: Sep 22nd, 2006
Get transparent Image of a node
Nov 23rd, 2006 at 8:12am
Print Post  
Hi,
I want to obtain a transparent Image of a node.
I tried somthing like this:

Rectangle rf = Rectangle.Round(_flowChart.FindBox (_boxGraphic.Tag).BoundingRect);
Bitmap bmp = new Bitmap(rf.Width, rf.Height);
_flowChart.DrawToBitmap(bmp, rf);
bmp.MakeTransparent(_flowChart.BackColor);
pictureBox1.Image = bmp;

I think "DrawToBitmap" does not work and I can't find it in the documentation either.

How can I obtain the Image?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Get transparent Image of a node
Reply #1 - Nov 23rd, 2006 at 11:05am
Print Post  
The control doesn't yet support .NET 2 -specific features, and DrawToBitmap is one such feature. You might use FlowChart.CreateImage to get a bitmap containing all boxes in the DocExtents. Or call flowChart.FindBox (_boxGraphic.Tag).Draw(Graphics.FromImage(someImage)) to draw the box shape in "someImage".

Stoyan
  
Back to top
 
IP Logged
 
feugen24
YaBB Newbies
*
Offline



Posts: 27
Joined: Sep 22nd, 2006
Re: Get transparent Image of a node
Reply #2 - Nov 23rd, 2006 at 1:24pm
Print Post  
There are problems on both cases:
1. Using FlowChart.CreateImage
when I call the method both flowchart size and docExtends size are 336,272 (same as the control they are in)but when I open the saved bitmap it has 447,362 milimeters. So when I try to use Bitmap Clone() method (to get the picture of the box)I can't use the boundingRect of the box because of the coordonates difference.

How can I get theese coordonates and where did I go wrong so the size of the bitmap is not the same with docextends?

2. Using "flowChart.FindBox (_boxGraphic.Tag).Draw(Graphics.FromImage(someImage)) "

This creates a bitmap wich has the box in it but it is not at 0,0. So I have to create a larger bitmap to have the node in it...depending on the box coordonates. Second, the box has it's shape but no color/image.....it's just grey.

So the second question: How can I get this box with it's color and image in the bitmap?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Get transparent Image of a node
Reply #3 - Nov 23rd, 2006 at 2:14pm
Print Post  
Hi,

Use the Graphics.TranslateTransform(-box, -boxy) method to make the box draw itself at the 0,0 point.

Probably what you see is the box shadow. Call Draw a second time with the boolean parameter set to false to draw the box itself.

Stoyan
  
Back to top
 
IP Logged
 
feugen24
YaBB Newbies
*
Offline



Posts: 27
Joined: Sep 22nd, 2006
Re: Get transparent Image of a node
Reply #4 - Nov 24th, 2006 at 12:41pm
Print Post  
Tks for help. Now it works fine.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint