Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) want to change color of Adorner (Read 11367 times)
Bala
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
want to change color of Adorner
May 18th, 2009 at 2:47pm
Print Post  
Hi,

I have used node.HandlesStyle = HandlesStyle.HatchHandles3; in which adorner color is by default Red.I want to change adorner's color.
How I can do this?

Thanks,
Bala
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: want to change color of Adorner
Reply #1 - May 19th, 2009 at 7:27am
Print Post  
Have you tried setting the DisabledHandlesColor property?
  
Back to top
 
IP Logged
 
Bala
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
Re: want to change color of Adorner
Reply #2 - May 19th, 2009 at 12:18pm
Print Post  
Thanks Stoyo,

Can I change its size as well?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: want to change color of Adorner
Reply #3 - May 19th, 2009 at 1:29pm
Print Post  
Try with AdjustmentHandlesSize.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: want to change color of Adorner
Reply #4 - May 19th, 2009 at 3:49pm
Print Post  
Thanks stoyo, its working Smiley
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: want to change color of Adorner
Reply #5 - Sep 24th, 2009 at 7:35am
Print Post  
Hi Stoyan,

I want to display RectangleBorder to select the node but if the node is active item of the diagram than RectangleBorder should have some adorner inside it.

How can I get this?

I have tried this code; please suggest where to need make changes?

Code
Select All
private void diagram_DrawAdjustmentHandles(object sender, MindFusion.Diagramming.Wpf.DrawItemEventArgs e)

  {


if (e.Item is DiagramNode)


{


    ShapeNode node = e.Item as ShapeNode;


    if (node != null)


    {



  double hatchSize = diagram.AdjustmentHandlesSize;



  Pen pen;







  if(node == diagram.ActiveItem)



  {




node.HandlesStyle = HandlesStyle.HatchHandles3;




diagram.DisabledHandlesColor = Brushes.Blue;




diagram.AdjustmentHandlesSize = 5;




pen = new Pen(Brushes.Blue, MindFusion.Diagramming.Wpf.Constants.GetPixel(diagram.MeasureUnit) * 3);






  }



  else



  {




pen = new Pen(Brushes.Blue, MindFusion.Diagramming.Wpf.Constants.GetPixel(diagram.MeasureUnit) * 3);



  }






  Rect nRect = new Rect(0, 0, node.Bounds.Width, node.Bounds.Height);



  e.Graphics.DrawRectangle(null, pen, nRect);



  Keyboard.Focus(diagram);


    }


}

  }

 




Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: want to change color of Adorner
Reply #6 - Sep 24th, 2009 at 12:51pm
Print Post  
Hi,

What exactly do you need to draw in the ActiveItem case? Note that if you keep the node.HandlesStyle = HandlesStyle.HatchHandles3 assignment there, you won't get this event raised anymore, unless you revert the style to Custom later.

Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: want to change color of Adorner
Reply #7 - Sep 24th, 2009 at 12:59pm
Print Post  
I want a custom implementation.
For active node. Rectangle selection should also have four/eight adorner while in case of other nodes only Rectangle selection should be there.
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: want to change color of Adorner
Reply #8 - Sep 29th, 2009 at 1:29pm
Print Post  
Hi Stoyan,

Any update for the above post ?


Regards,
Anshul
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: want to change color of Adorner
Reply #9 - Sep 29th, 2009 at 4:08pm
Print Post  
Hi Stoyan,

I am sending a sample image to show the behavior of handle on active node which I want in my application.

1). Handle should have rectangle border around it for all other nodes other than active node.

2). For active node, handle style should have rectangle border with some adorner around it.


Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: want to change color of Adorner
Reply #10 - Sep 29th, 2009 at 7:51pm
Print Post  
You could set HandlesStyle to Custom and handle DrawAdjustmentHandles like this:

Code
Select All
void diagram_DrawAdjustmentHandles(object sender, DrawItemEventArgs e)
{
	var node = e.Item as DiagramNode;
	if (node != null)
	{
		if (node == diagram.ActiveItem)
		{
			node.HandlesStyle = HandlesStyle.HatchHandles3;
			node.DrawHandles(e.Graphics, Brushes.Red);
			node.HandlesStyle = HandlesStyle.Custom;
		}
		else
		{
			node.HandlesStyle = HandlesStyle.MoveOnly;
			node.DrawHandles(e.Graphics, Brushes.Black);
			node.HandlesStyle = HandlesStyle.Custom;
		}
	}
}
 

  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: want to change color of Adorner
Reply #11 - Sep 30th, 2009 at 7:05am
Print Post  
Hi stoyan,

Thanks for the code sample. Its working well but need some clearity in selection border. I have set selection border color as DarkBlue but it has some black dots. I have tried with some other color(Red, Yellow etc.) as well but that black dots are always coming. can we remove these black dots?

Code which I have used is

Code
Select All
double hatchSize = diagram.AdjustmentHandlesSize;



  if (node == diagram.ActiveItem)



  {




node.HandlesStyle = HandlesStyle.HatchHandles3;




node.DrawHandles(e.Graphics, Brushes.DarkBlue);




node.HandlesStyle = HandlesStyle.Custom;



  }



  else



  {




node.HandlesStyle = HandlesStyle.MoveOnly;




node.DrawHandles(e.Graphics, Brushes.DarkBlue);




node.HandlesStyle = HandlesStyle.Custom;



  }




  Pen pen = new Pen(Brushes.DarkBlue, MindFusion.Diagramming.Wpf.Constants.GetPixel(diagram.MeasureUnit) * 3);



  Rect nRect = new Rect(0, 0, node.Bounds.Width, node.Bounds.Height);



  if (node.Shape == textOnTheRightRound)




e.Graphics.DrawRoundedRectangle(null, pen, nRect, nRect.Width / 9, nRect.Height / 3);




  else




e.Graphics.DrawRectangle(null, pen, nRect); 



Regards,
Anshul
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: want to change color of Adorner
Reply #12 - Sep 30th, 2009 at 7:19am
Print Post  
Hi Stoyo,

In case of e.Graphics.DrawRoundedRectangle(null, pen, nRect, nRect.Width / 9, nRect.Height / 3);

I am still getting Rectangular Black Colored Dotted Border along with my DarkBlue RoundRectangle.

How can I remove this RectangularBlackColoredDotted Border?

Regards,
Anshul


A general question: If I want to attach an Image in the Post, how can I do this? I have selected and putted some image path inside it but not able to attach image.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: want to change color of Adorner
Reply #13 - Sep 30th, 2009 at 11:33am
Print Post  
Hi Anshul,

Do not call the built-in node.DrawHandles method if you don't need the standard dotted border. You can't upload images here; you might upload it on flickr.com or your server, paste the URL, select it, and click the "insert image" button from the toolbar above the message field.

Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: want to change color of Adorner
Reply #14 - Sep 30th, 2009 at 12:07pm
Print Post  
Thanks Stoyan Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint