Click here to Skip to main content
15,887,331 members
Home / Discussions / C#
   

C#

 
GeneralRe: MenuStript Pin
Keypress23-Nov-14 3:47
Keypress23-Nov-14 3:47 
GeneralRe: MenuStript Pin
BillWoodruff23-Nov-14 3:50
professionalBillWoodruff23-Nov-14 3:50 
QuestionConverting Y up to Y down coordinates Pin
SledgeHammer0122-Nov-14 20:08
SledgeHammer0122-Nov-14 20:08 
AnswerRe: Converting Y up to Y down coordinates Pin
Richard MacCutchan22-Nov-14 22:25
mveRichard MacCutchan22-Nov-14 22:25 
GeneralRe: Converting Y up to Y down coordinates Pin
OriginalGriff22-Nov-14 22:53
mveOriginalGriff22-Nov-14 22:53 
GeneralRe: Converting Y up to Y down coordinates Pin
Richard MacCutchan22-Nov-14 23:11
mveRichard MacCutchan22-Nov-14 23:11 
GeneralRe: Converting Y up to Y down coordinates Pin
OriginalGriff22-Nov-14 23:15
mveOriginalGriff22-Nov-14 23:15 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 9:01
SledgeHammer0123-Nov-14 9:01 
Hmm... seems more like this is the correct answer:

C#
double Y = ((y + Math.Abs(dMin)) * (dHeight - 1)) / (dMax - dMin);
Y = dHeight - 1 - Y;


This works with:

C#
//lst.Add(-5);
lst.Add(0);
lst.Add(3);
lst.Add(7);
lst.Add(10);
//lst.Add(15);


With the commented and uncommented values.

dHeight = 30 (since the control is 30 pixels high, but the pixel range is 0 through 29)

With the original formula, the 0 would get to 29 correctly, but the 10 would only go to 1.72. With the -5 / 15 range, it would go to 0.43.

With this new formula, both ways got to 0 & 29.
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 9:08
SledgeHammer0123-Nov-14 9:08 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 9:14
SledgeHammer0123-Nov-14 9:14 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 8:10
SledgeHammer0123-Nov-14 8:10 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 8:11
SledgeHammer0123-Nov-14 8:11 
GeneralRe: Converting Y up to Y down coordinates Pin
Richard MacCutchan23-Nov-14 22:03
mveRichard MacCutchan23-Nov-14 22:03 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 8:31
SledgeHammer0123-Nov-14 8:31 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 8:46
SledgeHammer0123-Nov-14 8:46 
AnswerRe: Converting Y up to Y down coordinates Pin
BillWoodruff23-Nov-14 1:00
professionalBillWoodruff23-Nov-14 1:00 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 8:13
SledgeHammer0123-Nov-14 8:13 
QuestionLooking for books recommendations to learn specifically about DB using .NET and C# Pin
Member 1000166322-Nov-14 8:04
Member 1000166322-Nov-14 8:04 
AnswerRe: Looking for books recommendations to learn specifically about DB using .NET and C# Pin
BillWoodruff22-Nov-14 8:33
professionalBillWoodruff22-Nov-14 8:33 
QuestionIBM - ILog Diagram: Find node position in pixel Pin
hassan faghihi21-Nov-14 22:20
professionalhassan faghihi21-Nov-14 22:20 
QuestionPocketSphinx Pin
Member 1001593821-Nov-14 7:54
Member 1001593821-Nov-14 7:54 
AnswerRe: PocketSphinx Pin
Dave Kreskowiak21-Nov-14 8:39
mveDave Kreskowiak21-Nov-14 8:39 
AnswerRe: PocketSphinx Pin
BillWoodruff21-Nov-14 9:31
professionalBillWoodruff21-Nov-14 9:31 
Questionhow to solve System.OutOf Memory Exception was thrown Pin
cicill21-Nov-14 5:24
cicill21-Nov-14 5:24 
AnswerRe: how to solve System.OutOf Memory Exception was thrown Pin
Eddy Vluggen21-Nov-14 5:35
professionalEddy Vluggen21-Nov-14 5:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.