We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Resize Bitmapnode

Hi,

I have a problem. I append a bitmap node in a diagram with a 37*39 size. If I change the image associate it changes, but not resizes the bitmap node (16*16 in my case).

Could you help me?

Thank you.

   Blanca

Attachment: Video_1459515264_e215171c.zip

21 Replies

NG Naganathan Ganesh Babu Syncfusion Team April 4, 2016 06:13 AM UTC

Hi Blanca,
 
Thanks for contacting Syncfusion product.

 

In Diagram Control, by default the image size depends on the node’s size and if you do not set the size of the node, then the image’s size will be set to the node’s size.

 

You have mentioned in your response that the node is resized from original size while appending the image with the size of the image contains 16*16. Please check and let us know if the node‘s size is set or not in your project while appending the node into the diagram.

 

If we have misunderstood your requirement, please share us more information about your requirement probably a code example or sample or explain us on how you are resizing the image/Node in your project. 


 

Regards,


 

Naganathan K G





BC Blanca Calderon April 6, 2016 08:34 AM UTC

I have a nodeSeleccionado with 16x16. 

Syncfusion.Windows.Forms.Diagram.BitmapNode bitmapNode = nodoSeleccionado as Syncfusion.Windows.Forms.Diagram.BitmapNode;

bitmapNode.Image = new Bitmap(image, image.Width, image.Height);
float widthImage = float.Parse(image.Width.ToString());
float heightImage = float.Parse(image.Height.ToString());


When I change the image with another one (33x33) the image change but not the size.

bitmapNode.Size = new SizeF(widthImage, heightImage);

bitmapNode. Size continue with 16x16 after the assigment.



BC Blanca Calderon April 6, 2016 09:02 AM UTC

I'm going to explain it a little bit.

1) I create by default a bitmapnode with 37*39 (a blank image).
2) I attach an image with a size of 16*16 that replaces blank image.

These two steps work fine.

3)  If I change the image with another one, the image changes but not the size (its size is 33*33 but continues with 16*16).

I send you a video with the process.

Attachment: Video_1459939345_8f2a72ca.zip


BC Blanca Calderon April 7, 2016 07:51 AM UTC

Sorry, could you send me the sample in framework 2.0 versión 13.4200.0.53?

Thanks


NG Naganathan Ganesh Babu Syncfusion Team April 7, 2016 09:14 AM UTC

Hi Blanca,
 
Sorry for the inconvenience caused.
 
We have modified the sample under framework version 2.0 as per your request which has attached in the below link.
 
Sample:
 
Sample
 
Regards,
 
Naganathan K G



BC Blanca Calderon April 13, 2016 01:19 PM UTC

it doesn't work. 

Attachment: Doc1_b179c1af.zip


NG Naganathan Ganesh Babu Syncfusion Team April 14, 2016 06:48 AM UTC

Hi Blanca,
 

While unzipping your provided attachment, we are getting error as shown below. Please refer to the below attachment, 




Regards,
 

Naganathan K G





BC Blanca Calderon April 14, 2016 06:54 AM UTC

I hope this .zip will work.

Attachment: Video_1460623950_1e7e384d.zip


NG Naganathan Ganesh Babu Syncfusion Team April 14, 2016 09:42 AM UTC

Hi Blanca,


Thanks for your update.


From the attached video, we found that the Syncfusion’s Diagram.Windows and Shared.Base assembly’s framework versions are different. 


Before executing the sample, please check whether the attached DLLs framework are under same version or not? If not, refer to the DLLs under same framework/version.


Here are the details of referring the DLLs version for particular .NET framework:


.Net Framework

Dlls

2.0

13.1200.0.53

3.5

13.1350.0.53

4.0

13.1400.0.53

4.5

13.1450.0.53

4.5.1

13.1451.0.53

4.6

13.1460.0.53



Regards,
 
Naganathan K G




BC Blanca Calderon April 14, 2016 03:22 PM UTC

Another error.
Attachment: Video_1460654354_1f785aa.zip


NG Naganathan Ganesh Babu Syncfusion Team April 15, 2016 08:36 AM UTC

Hi Blanca,

After analyzing the attached video, we found that still you didn’t change Syncfusion.Shared.Base assembly framework version as we mentioned in the previous update which will be the cause for the reported issue. We suggest you to refer the assemblies under 2.0 framework version which will resolve the reported issue. However we have attached sample containing the assemblies under 2.0 framework version.


Sample:


Sample


Regards,


Naganathan K G



NG Naganathan Ganesh Babu Syncfusion Team April 15, 2016 08:59 AM UTC

Hi Blanca,
Please ignore our previous update.

After analyzing the attached video, we found that still you didn’t change Syncfusion.Shared.Base assembly framework version as we mentioned in the previous update which will be the cause for the reported issue. Please refer to the below screenshots and we have highlighted the errors which are captured from your video,


Diagram.Base Assembly


Diagram.Windows Assembly


Shared.Base



In above table, the assemblies of Diagram.Base and Diagram.Windows are same framework version in 2.0. But the Shared.Base assembly referred in 3.5 framework version.


We suggest you to refer the assemblies under 2.0 framework version which will resolve the reported issue. However we have attached sample containing the assemblies under 2.0 framework version.


Sample:


Sample


Regards,


Naganathan K G



BC Blanca Calderon April 15, 2016 09:08 AM UTC

Ok, now it works. 


BC Blanca Calderon April 15, 2016 11:07 AM UTC

I don't know what happen with my diagram but the problem cames when I save .edd and open after this .edd saved. In this moment when I try to change the image the size never changes.



Attachment: Video_1460723060_8d84c12a.zip


NG Naganathan Ganesh Babu Syncfusion Team April 18, 2016 11:16 AM UTC

Hi Blanca,


On further analyzing your attached video, we suspect that the Node.EditStyle’s AllowChangeHeight/AllowChangeWidth/Enable properties are set to false while saving/loading the diagram. Please check and let us know whether these properties are enabled while saving/loading the diagram in your environment.


Regards,


Naganathan K G 




BC Blanca Calderon April 18, 2016 12:05 PM UTC

Yes I used this properties because I don't want than, when you click on an image appear an editor to change the properties of the bitmap (textnode, etc). In a previous thread you told me that.

nodoActivo.EditStyle.AllowChangeHeight = false
nodoActivo.EditStyle.AllowChangeWidth = false;

Attachment: Video_1460988009_3d9246b1.zip


NG Naganathan Ganesh Babu Syncfusion Team April 19, 2016 12:36 PM UTC

Hi Blanca,


Thanks for your update.

In your previously attached video, before saving and loading the diagram file the bitmap node is resized while changing the image in your environment. 

If you have disabled Node.EditStyle’s “AllowChangingHeight/AllowChangingWidth” property before saving/loading the bitmap node will not be resized while changing the image.

Please confirm us whether you are disabling those properties while saving/loading the diagram file, if so this will be the cause for the reported issue. 

Regards,


Naganathan K G




BC Blanca Calderon May 11, 2016 07:33 AM UTC

If I don't use:

nodoActivo.EditStyle.AllowChangeHeight = false;
nodoActivo.EditStyle.AllowChangeWidth = false;    

When I double clicked in a bitmap node this appears. I don't want to see that.

Attachment: EditorText_fe493a0.zip


NG Naganathan Ganesh Babu Syncfusion Team May 12, 2016 09:40 AM UTC

Hi Blanca,  
 
The Node.EditStyle’s “AllowChangeHeight” and “AllowChangeWidth” properties are used to enable/disable the changing of Node’s size.  
 
As informed previously, we have provided the support for adding label into the Diagram’s BitmapNode in the version 13.4.0.53. So, InplaceEditor is activated while double clicking the BitmapNode. 
 
We have created a sample to achieve your requirement. Please use Diagram.EventSink’s “NodeDoubleClick” event and set False to the diagram1.Controller’s “InPlaceEditing” property while double clicking the BitmapNode.   
  
Please refer to the sample and code example. 
 
Code example:
 
[C#]
 
diagram1.EventSink.NodeDoubleClick += EventSink_NodeDoubleClick;
 
void EventSink_NodeDoubleClick(Syncfusion.Windows.Forms.Diagram.NodeMouseEventArgs evtArgs) 
{ 
diagram1.View.Grid.SnapToGrid = false; 
if (evtArgs.Node is BitmapNode) 
{ 
//Disable the InplaceEditing 
diagram1.Controller.InPlaceEditing = false; 
} 
else 
{ 
//Enable the InplaceEditing 
diagram1.Controller.InPlaceEditing = true; 
}
}
 
Sample:
 
Sample
 
Regards,
 
Naganathan K G
 
 



BC Blanca Calderon May 13, 2016 06:54 AM UTC

it doesn't work the first time on a diagram. From the first time it works fine.



Attachment: Video_1463129453_e5c1336a.zip


NG Naganathan Ganesh Babu Syncfusion Team May 17, 2016 12:28 PM UTC

Hi Blanca, 
 
We have modified the sample to achieve your requirement. We suggest you to inherit the Diagram’s controller and override the “OnDoubleClick” method to achieve your requirement. Please refer to the below sample and code example. 
 
Code example: 
 
[C#] 
 
public override void OnDoubleClick(EventArgs evtArgs) 
{ 
NodeCollection nodes = this.GetAllNodesAtPoint(this.Model, this.MouseLocation, false); 
Node nodeHit = null; 
if ((nodes != null) && (nodes.Count > 0)) 
nodeHit = nodes.First; 
if (nodeHit is BitmapNode) 
{ 
//Disable the InplaceEditing 
this.InPlaceEditing = false; 
} 
else 
{ 
//Enable the InplaceEditing 
this.InPlaceEditing = true; 
} 
base.OnDoubleClick(evtArgs); 
} 
 
Sample: 
 
 
Regards, 
 
Naganathan K G 
 


Loader.
Up arrow icon