|
I mean that if you just set that Certain Point to be 10 above the box, it will never make it to the point; the point will always be 10 above.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
When the box first moves, certainpoint will be 10. If you move the box up towards this point by 1 each time, decreament certainpoint by 1. So, if the box pos initially is 100, and certainpoint is 10 above this, the target turnaround point will be boxpos + certainpoint = 100 + 10. Move the box up by one. Boxpos = 101. Take one from CertainPoint : 101 + 9. And so on, until certainpoint is zero. Then negate the delta, and start adding to certainpoint again and mving the box down, until certainpoint is 10. I think...
|
|
|
|
|
How do you decrament an int? I tried this with a timer: --x;, but that just did it once. No every tick.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
--x; is good. Where is x being assigned? If it is being assigned to 10 in your tick handler, then it will only ever appear to decrement once.
|
|
|
|
|
Yeah. Why does it only do it once, while ++ keeps looping?
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
Post your code - it's got to be something simple. Only saying that as it is nearly midnight and my brain can only cope with 'simple' at the moment!!
|
|
|
|
|
I don't have the code for it. I just had a mishap with code project. It kept wanting to load me in but couldn't! I'm working on the code...
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
I need to decrament the point every time. So how do I do that?
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
Put the decrementing inside your timer tick handler.
|
|
|
|
|
Try this...
(I've just written this without testing it so there may be bugs)
Timer myTimer = new Timer();
bool goingUp = true;
int bottom = 0;
int distance = 0;
public void myTimerTick(object sender, EventArgs e)
{
if (goingUp)
{
myPictureBox.Top--;
if (myPictureBox.Top + myPictureBox.Height < bottom - distance) goingUp = false;
}
else
{
myPictureBox.Top++;
if (myPictureBox.Top + myPictureBox.Height > bottom) myTimer.Stop();
}
}
public void StartJump(int bot, int dist)
{
bottom = bot;
distance = dist;
goingUp = true;
myTimer.Interval = 50;
myTimer.Start();
}
I hope this helps.
You then just need to call StartJump whenever needed.
Matthew Butler
|
|
|
|
|
I tried something like this but it didn't work: BECAUSE IT DIDN"T ++X.
myTimer_Tick(blahbity, blahbity...)<br />
{<br />
int x = 1;<br />
<br />
if (x == 1)<br />
{<br />
move the box up<br />
}<br />
if (x == 2)<br />
{<br />
move the box up<br />
}<br />
if (x == 3)<br />
{<br />
move the box up<br />
}<br />
if (x == 4)<br />
{<br />
move the box DOWN<br />
}<br />
if (x == 5)<br />
{<br />
move the box DOWN<br />
}<br />
if (x == 6)<br />
{<br />
move the box DOWN<br />
}<br />
if (x == 7)<br />
{<br />
x = 1;<br />
myTimer.Enabled = false;<br />
}<br />
<br />
}
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
MasterSharp wrote: myTimer_Tick(blahbity, blahbity...)
{
int x = 1;
if (x == 1)
{
move the box up
}
x will always equal 1. Take the assignment x outside the event handler.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
Yeah. I figured it out. BUT, now I need to know how to use more than one key at a time.
protected override ProcessCmdKey(stuff)<br />
{<br />
<br />
switch (keydata)<br />
{<br />
case Keys.Whatever<br />
}<br />
<br />
}
how to use more than one? THanks.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
2 problems:
1) How do I publish a program so i cna give it anyone so they can use it?
2) When I try to download source code off this site, I get errors, such as nothaving the right version of C# and just not running. How do I fix that so I can use examples?
THanks.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart?"
|
|
|
|
|
1) Search the web for ClickOnce. Alternately, you can manually give someone your compiled C# programs (the .exe file and any .dll files that you used). The only requirement is that the end user has the .NET framework installed. Windows Vista has this installed by default, Windows XP and earlier don't have it installed by default.
2) Give us an example error, the exact text. (If I were to guess, my psychic debugging powers tell me you're trying to open Visual Studio 2005 solution files inside Visual Studio 2003.)
|
|
|
|
|
Um, oops. DUh for the last one. Probably IS 2003. Oh, shame...
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
How do i use ClickOnce? Just download it, or??? Add as a reference?
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
ClickOnce overview on MSDN[^]. In short, it's a deployment technology built into .NET and Visual Studio. Basically, you use it to publish your files to a website, and end users can run it right from the web.
|
|
|
|
|
Is there anything for Flash Drives or CDs? EMail? THat's more of what I need.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
ClickOnce works with CDs, and can be deployed to flash drives. You can also email people the link to your ClickOnce application. For example, here's a dummy application deployed with ClickOnce: Hey check out this rockin' program I made!!![^]
There, I just opened my source code solution inside Visual Studio 2005, right-clicked on my project, clicked properties, clicked the Publish tab, filled out my website information, then clicked publish.
Like I said, though, you don't have to publish to a website; you can publish to most anywhere.
|
|
|
|
|
So how would I publish a program with it, ince it is built in? Sorry if I sound like an idiot here.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
Do you have Visual Studio 2005 or 2008? Visual Studio 2005 and later can do the publish automatically for you with a few clicks. (I described this in the above post.)
If you don't have Visual Studio, you can still publish using ClickOnce, though it's a little more involved. You'd need to look up the free tool included in the .NET SDK called MageUI[^].
FYI, Visual Studio 2005 Express[^] is free; if you're working with C# a lot you should download that if you haven't already.
|
|
|
|
|
I have VS 05 and C#. But, every time I publish something and send it in an eMail, it ALWAYS says the program is missing files, so I thinksit's in the publishing.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
What are you emailing - the link to the published .application file? That's what you should email.
Can you give us the exact error message? We can better help you then.
|
|
|
|
|
I tr to eMail the entire program. Say you attach a file to an eMail. I attach the program. When they get the eMail, it syas certain vital files are missing.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|