C
C#•2y ago
BambiAria

This isnt working really confused help

17 Replies
Pobiega
Pobiega•2y ago
$code
MODiX
MODiX•2y ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat If your code is too long, post it to: https://paste.mod.gg/
BambiAria
BambiAriaOP•2y ago
oh mb
Pobiega
Pobiega•2y ago
close, just needs a blank line after the cs part
BambiAria
BambiAriaOP•2y ago
im tryna index it properly it looks awful
private void graphPanel_Paint(object sender, PaintEventArgs e)
{//List<PointF> pointsToDraw = new List<PointF>();


NoHorizontalAcceleration instanceGraphing = new NoHorizontalAcceleration(Convert.ToDouble(storeStartingElevation.Text), Convert.ToDouble(angleOfProjection), Convert.ToDouble(startingVelocity), Convert.ToDouble(verticalAcceleration));
instanceGraphing.NoHorizontalAccelerationCalculation();
List<PointF> pointsToDraw = instanceGraphing.drawingGraphLogic(instanceGraphing._timeOfFlight, instanceGraphing._equationForXDisplacement, instanceGraphing._equationForYDisplacement);
//pointsToDraw null only here and it shouldnt be 13/04/23 //isnt now 14/04/2023

Graphics graphics = e.Graphics;
Pen pen = new Pen(Color.Black, 5);

for (int i = 0; i < pointsToDraw.Count; i ++)
{
if (i ++ == pointsToDraw.Count)
{

graphics.DrawLine(pen, pointsToDraw[i] , pointsToDraw[i]);
}
graphics.DrawLine(pen, pointsToDraw[i],pointsToDraw[i++] );
}



}
private void graphPanel_Paint(object sender, PaintEventArgs e)
{//List<PointF> pointsToDraw = new List<PointF>();


NoHorizontalAcceleration instanceGraphing = new NoHorizontalAcceleration(Convert.ToDouble(storeStartingElevation.Text), Convert.ToDouble(angleOfProjection), Convert.ToDouble(startingVelocity), Convert.ToDouble(verticalAcceleration));
instanceGraphing.NoHorizontalAccelerationCalculation();
List<PointF> pointsToDraw = instanceGraphing.drawingGraphLogic(instanceGraphing._timeOfFlight, instanceGraphing._equationForXDisplacement, instanceGraphing._equationForYDisplacement);
//pointsToDraw null only here and it shouldnt be 13/04/23 //isnt now 14/04/2023

Graphics graphics = e.Graphics;
Pen pen = new Pen(Color.Black, 5);

for (int i = 0; i < pointsToDraw.Count; i ++)
{
if (i ++ == pointsToDraw.Count)
{

graphics.DrawLine(pen, pointsToDraw[i] , pointsToDraw[i]);
}
graphics.DrawLine(pen, pointsToDraw[i],pointsToDraw[i++] );
}



}
Pobiega
Pobiega•2y ago
okay, so what exactly are you trying to do and what "isnt working"?
BambiAria
BambiAriaOP•2y ago
yeah thats indexed really bad I assure u its not that bad in the code pointsToDraw has values and im tryna just the drawline to actually draw for me and its just not like no errors or anything just not showing up on my panel
Pobiega
Pobiega•2y ago
have you set a breakpoint? to verify oh dear god uhm
if (i ++ == pointsToDraw.Count)
{

graphics.DrawLine(pen, pointsToDraw[i] , pointsToDraw[i]);
}
graphics.DrawLine(pen, pointsToDraw[i],pointsToDraw[i++] );
if (i ++ == pointsToDraw.Count)
{

graphics.DrawLine(pen, pointsToDraw[i] , pointsToDraw[i]);
}
graphics.DrawLine(pen, pointsToDraw[i],pointsToDraw[i++] );
this is.... what the fuck
BambiAria
BambiAriaOP•2y ago
yeah
Pobiega
Pobiega•2y ago
i++ actually modifies the value of i, fyi
BambiAria
BambiAriaOP•2y ago
oh shit ;-; how did I not see that
Pobiega
Pobiega•2y ago
so if you just want i+1, type i+1 😛
BambiAria
BambiAriaOP•2y ago
theres a lot wrong here I promise you to check theres values in pointsToDraw? or that graphics.DrawLine runs?
Pobiega
Pobiega•2y ago
to check pointsToDraw
BambiAria
BambiAriaOP•2y ago
well i changed my ++'s to + 1's where they should be and now ive got an error but in this case I think thats progress yep ive fixed the error still no drawing tho
Pobiega
Pobiega•2y ago
¯\_(ツ)_/¯
BambiAria
BambiAriaOP•2y ago
damn thank u tho you definitely did help a bit Oh wait I think its just off screen tho idk how cause my panel is in the top left hand corner anyway
Want results from more Discord servers?
Add your server