Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Draw Image (Read 2581 times)
donep
YaBB Newbies
*
Offline


Love MindFusion

Posts: 3
Joined: Jul 30th, 2009
Draw Image
Jun 5th, 2023 at 8:21am
Print Post  
I just tried Mindfusion MAUI diagram and need help displaying an image on  "override Draw(IGraphics graphics, RenderOptions options)" ShapeNode.

Could you help me how to draw image on "\Resource\image.png" with graphics.DrawImage method.

Thanks for help.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3187
Joined: Oct 19th, 2005
Re: Draw Image
Reply #1 - Jun 5th, 2023 at 2:36pm
Print Post  
You should be able to load the image file by calling ImageSource.FromFile("image.png"); You can set ShapeNode's Image, ImageAlign and ImagePadding properties to display the image in specific area of the node. If you need to draw a second image,call IGraphics.DrawImage method from the override.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
donep
YaBB Newbies
*
Offline


Love MindFusion

Posts: 3
Joined: Jul 30th, 2009
Re: Draw Image
Reply #2 - Jun 15th, 2023 at 8:20am
Print Post  
I attached an example file to display the image, but it still doesn't work.
  

DrawImage.zip ( 952 KB | 83 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3187
Joined: Oct 19th, 2005
Re: Draw Image
Reply #3 - Jun 19th, 2023 at 7:35am
Print Post  
It seems to draw the plus image in my test. On what OS and .NET versions isn't it working for you?

The ImageAlign property will only align if you use standard Image property. Try using this overload to apply alignment for custom-drawn image:

Code
Select All
void DrawImage(ImageSource image, Rectangle rect,
	ImageAlignment imageAlign, double rotationAngle, Point pivot); 



Regards,
Slavcho
Mindfusion
  

image_2023_06_19T07_27_47_790Z.png ( 118 KB | 44 Downloads )
image_2023_06_19T07_27_47_790Z.png
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint