p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: C# 24-Hour Trainer 2nd Edition (http://p2p.wrox.com/forumdisplay.php?f=795)
-   -   Lesson 2 - Setting colors in WPF (http://p2p.wrox.com/showthread.php?t=99105)

euriloco July 23rd, 2016 11:13 AM

Lesson 2 - Setting colors in WPF
 
I'm watching the video named "Setting colors in WPF".
The author says:
Quote:

"The StartPoint and the EndPoint give the coodinates on a 0 to 1 scale of the starting and the end of gradient.
0 means the gradient starts half way across the control horizontally and at the top vertically"
I draw the coordinate origin on a picture:

http://i67.tinypic.com/2e6akyf.jpg

He puts the StartPoint in the lower right corner so he changes it to (1,1) and the EndPoint to the upper left corner so he changes it to (0,0).
I don't understand these coordinates. I think they would be for the lower right corner (1,-1) and (-1,0) for the upper right corner.

Please, what am I doing wrong?[:o]

Thank you.

Rod Stephens July 23rd, 2016 11:34 AM

The key is that the coordinates go from (0, 0) in the upper left corner to (1, 1) in the lower right corner.

You have the quote from the video just a little bit wrong, and I think that's causing the confusion. The correct quote is:

Quote:

The StartPoint and the EndPoint give the coodinates on a 0 to 1 scale of the start and the end of the gradient. The 0.5 and the 0 for the start point means this gradient starts halfway across the control horizontally and at the top vertically.
So the coordinates go from (0, 0) in the upper left corner to (1, 1) in the lower right corner.

When you first create the control, the gradient starts at (0.5, 0) and ends at (0.5, 1) so the gradient moves from the top middle to the bottom middle.

In the video I change the gradient's coordinates so it starts at (1, 1) and ends at (0, 0).

I hope that helps. Let me know if it's still unclear.

euriloco July 23rd, 2016 12:02 PM

Thank you very much.
I understood it.
Sorry, It was my fault[:I].
These problems appears because English is not my first language.
I'm learning C# and improving my English with your book.[:D]

Rod Stephens July 23rd, 2016 01:33 PM

No problem. Let me know if you have other questions! [:)]


All times are GMT -4. The time now is 10:18 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.