C# C# Passing color into a method.

  • Thread starter Thread starter kiwijoey
  • Start date Start date
  • Tags Tags
    Color Method
AI Thread Summary
To pass a color into a C# method and create a new pen using that color, the method should be defined as MethodName(Color color). Inside the method, a new Pen can be instantiated using the provided color with the syntax: Graphics pen1 = new Pen(color, 1);. This approach effectively utilizes the Color object to create a pen with the specified color and a width of 1. The discussion confirms that this method definition and implementation are correct for achieving the desired outcome.
kiwijoey
Messages
2
Reaction score
0
How would you go about passing a color into a C# method and using that color inside the method to create a new pen? Assuming everything else is defined

Is it MethodName(Color color)
Graphics pen1 = new Pen(color.Color,1);



or is it something completely different?
 
Technology news on Phys.org
that should do it
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Back
Top