Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Add Image to Shape Node. (Read 4162 times)
SandeepGowda
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 50
Joined: Jan 6th, 2009
Add Image to Shape Node.
Apr 15th, 2009 at 4:23pm
Print Post  
Hi,
  I am using Same functionality as Sample FlowCharter example. Can we add the Images on the top of Shape Nodes in selection pane.(in Scroll pane,holding number of shape nodes)

Regards
Sandeep.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Add Image to Shape Node.
Reply #1 - Apr 15th, 2009 at 6:45pm
Print Post  
Do you need images over the shapes in the listbox control?
  
Back to top
 
IP Logged
 
SandeepGowda
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 50
Joined: Jan 6th, 2009
Re: Add Image to Shape Node.
Reply #2 - Apr 16th, 2009 at 6:06am
Print Post  
Stoyo,

Your absolutely correct,the Nodes which we transfer on to main Diagram View. On Top of Nodes i need to add images aligned center.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Add Image to Shape Node.
Reply #3 - Apr 16th, 2009 at 8:05am
Print Post  
If you need this only for the nodes that are in the ShapeListBox, try this:

Code
Select All
private void Form1_Load(object sender, EventArgs e)
{
	Image img = Image.FromFile(@"C:\img\harley%204.jpg");
	foreach (ShapeNode node in ((ListBox)shapeListBox).Items)
		node.Image = img;
}
 



You might as well set the Image of the Shapes defined in the shape library that's shown in the listbox.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
SandeepGowda
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 50
Joined: Jan 6th, 2009
Re: Add Image to Shape Node.
Reply #4 - Apr 16th, 2009 at 9:48am
Print Post  
Stoyon,
i tried to set image as below. Can you please help me where i am doing mistake.

ShapeNode taskShapeNode = m_taskSelectionDiagram.getFactory()
.createShapeNode(1, 1, 25, 25);
taskShapeNode.setShape(m_arrayTaskShapeNodes[index].getShape());
BufferedImage image = m_taskSelectionDiagram.createImage();
//Trying to set Image from Local Directory.taskShapeNode.setImage(imageIcon.getImage());

//taskShapeNode.setImageAlign(ImageAlign.Center);
// add to the Diagram view.
m_taskSelectionDiagram.getNodes().add(taskShapeNode);

nodeRenderer.createBufferedImage(index,
m_arrayTaskShapeNodes[index].getText(), image);

taskShapeNode.setHandlesStyle(HandlesStyle.DashFrame);

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Add Image to Shape Node.
Reply #5 - Apr 16th, 2009 at 10:09am
Print Post  
In Java you can load an image using the ImageIO.read() method, if that's your problem. Also, you should call ShapeNode.setImage() before calling createImage() and adding the result to the node renderer.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
SandeepGowda
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 50
Joined: Jan 6th, 2009
Re: Add Image to Shape Node.
Reply #6 - Apr 16th, 2009 at 10:30am
Print Post  
Thanks Stoyo,

i Set image prior to Creating Image. its working fine.

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint