Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to pass the color object from one Event function to the second Event function
How can I do this?


C#
// form thet evant function 


 private void recgreen_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            

        }



// to that evant function

  private void myCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {

            
            _startPoint = e.GetPosition(myCanvas);
            _line = new Polyline();
// Here I want to change the color according to evant function activated

            _line.Stroke = new SolidColorBrush(Colors.Black); //the black shoude be any color according to evant function activated
            _line.StrokeThickness = 1;

            myCanvas.Children.Add(_line);

        }
Posted
Updated 8-Nov-13 2:43am
v3
Comments
José Amílcar Casimiro 8-Nov-13 8:51am    
Please improve your question. I don't understand what you need.
BillWoodruff 8-Nov-13 10:20am    
How you communicate between one Event and another really depends on where the two Events are located: if they are located in the same Form, or Class, that's one thing; if they are located on two different Forms, or Classes, that's another.

So, please describe where each Event is located in your code.

1 solution

Use a class member to store such a variable, for later retrieval.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900