Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 6 > BOOK: C# 24-Hour Trainer 2nd Edition
|
BOOK: C# 24-Hour Trainer 2nd Edition
This is the forum to discuss the Wrox book C# 24-Hour Trainer, 2nd Edition by Rod Stephens; ISBN: 978-1-119-06566-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: C# 24-Hour Trainer 2nd Edition section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 23rd, 2016, 11:13 AM
Registered User
 
Join Date: Jul 2016
Posts: 4
Thanks: 3
Thanked 0 Times in 0 Posts
Default 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?

Thank you.

Last edited by euriloco; July 23rd, 2016 at 11:16 AM..
 
Old July 23rd, 2016, 11:34 AM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

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.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
The Following User Says Thank You to Rod Stephens For This Useful Post:
euriloco (July 23rd, 2016)
 
Old July 23rd, 2016, 12:02 PM
Registered User
 
Join Date: Jul 2016
Posts: 4
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Thank you very much.
I understood it.
Sorry, It was my fault.
These problems appears because English is not my first language.
I'm learning C# and improving my English with your book.
 
Old July 23rd, 2016, 01:33 PM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

No problem. Let me know if you have other questions!
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting Alternative Font Colors trtyler BOOK: Beginning ASP.NET 4.5.1 : in C# and VB 2 October 12th, 2016 09:21 AM
no colors when printing Hylsan Beginning PHP 0 May 28th, 2007 05:06 AM
Colors scandalous Access 1 February 8th, 2007 01:01 PM
Row colors in listbox canmex Access 1 November 18th, 2006 09:01 PM
Problems with colors Sara Access VBA 4 January 21st, 2005 11:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.