|
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
?"
|
|
|
|
|
You should zip up all your application files -- go to the folder where your source code is, go in to the bin\debug directory, and zip up all the files there. Email that zip file.
|
|
|
|
|
I have created a user control,right now i want to have attribute of usercontrol which it's String type,and I don't input by hand which instead of I will chose a name for my attribute,same same chose combobox.
Example in Form 'S attribute ,there is a attribute about color
we don't input,instead of we will chose,I also want that
|
|
|
|
|
I can't understand what you are saying. Are you talking about enumerations[^]?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Ok,I will repeat what I have said,and please help me
I have a usercontrol which Mycontrol and I want create it's attribute
exam:
protected bool m_TrangThai;
[Browsable(true)]
public Boolean TrangThaiQuanCo
{
get { return this.m_TrangThai; }
set { this.m_TrangThai = value; }
}
My problem I don't know create a combobox as backcolor attribute of Form,so I want to ask you about it
|
|
|
|
|
Hi,
Does anyone know if it's possible to trigger an event whenever a video frame is being refreshed (e.g., every 50 ms for a 20 fps frame rate)? It can be either with DirectX or WMP SDK (or anything else within .NET. Alternatively, I could poll the video player and ask which frame is being played. Can't do that either at this point.
Thank you,
Yigal Agam
|
|
|
|
|
|
I'm not sure if this is the right forum to post this in, but I'm not sure where it fits.
My company distributes some reference books on CD-ROM using 3rd party software called Folio Views. The actual content stays on the CD, but what is called a shadow file gets installed on the user's drive. The shadow file allows the user to highlight and annotate the text with out modifying the actual content (the shadow file acts like an overlay). Because of this the shadow file needs to be modifiable by the user. On Vista, the software gets installed as administrator (after UAC click), but when the user launches the software it loads with the users permissions so they can't write to the shadow file and the load fails. I'm using the setup project built into Visual Studio 2005 right now, but we may buy InstallShield if its better, for this and I can't find an option to set permissions on the files. Is there a custom action I can assign to make the file writable by the "users" group?
Thanks.
|
|
|
|
|
You could fiddle with the permissions in a custom action, yes. This isn't really addressing the root cause of the problem, which is that your shadow file is in the wrong place. I'm guessing you've stuck it in the program files directory - it really should be in the user's profile, under application data, or Documents.
|
|
|
|
|
Yeah, unfortunately I have to work within the bounds of some third party software and there isn't a way to automatically generate a new shadow file for each user so I need to do it this way. Do you know what the command should be in the custom action?
|
|
|
|