Click here to Skip to main content
16,007,163 members
Home / Discussions / C#
   

C#

 
QuestionEvent Pin
abalfazl15-Mar-07 3:07
abalfazl15-Mar-07 3:07 
AnswerRe: Event Pin
b0ksah19-Mar-07 0:51
b0ksah19-Mar-07 0:51 
QuestionCould not find the Sender's mailbox.(CDO Library for exchange) Pin
Nitin198115-Mar-07 2:56
Nitin198115-Mar-07 2:56 
Questionscheduled task Pin
arkiboys15-Mar-07 2:54
arkiboys15-Mar-07 2:54 
QuestionUpdating combobox display value after binding Pin
Alvaro Enriquez15-Mar-07 2:48
Alvaro Enriquez15-Mar-07 2:48 
AnswerRe: Updating combobox display value after binding Pin
N a v a n e e t h15-Mar-07 3:06
N a v a n e e t h15-Mar-07 3:06 
QuestionRe: Updating combobox display value after binding Pin
Alvaro Enriquez15-Mar-07 4:35
Alvaro Enriquez15-Mar-07 4:35 
QuestionMoving a sprite problem. Pin
lee.hallows15-Mar-07 1:30
lee.hallows15-Mar-07 1:30 
I’m trying to load a sprite into my form and move it with the cursor keys. I have added:

private Bitmap player; (player is my sprite name and has been added as a resource)

This is at the top of my file. I have then added the code to move the sprite:

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Left:
player. **** Problem is here ******

After the player. I am trying to get intellisense to offer me the .left option which I then want to add:

player.left--;

I have tested a similar functionality using a picturebox1 which I just stuck on my form and was able to move this using the code above. Am I missing something to do with loading my sprite in, as the picture box was already on the form and i managed to move this using the code above?

Here’s the code in full:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Media;


namespace Game
{
public partial class Form1 : Form
{
// insert private bitmap background
// and movement int x/y move etc.....

private Bitmap background = new Bitmap(640, 320);
//private Bitmap car;
private Bitmap player;


public Form1()
{
InitializeComponent();

player = new Bitmap(GetType(), "player.jpg");
//car = new Bitmap(GetType(), "car.jpg");
Bitmap background = Game.Properties.Resources.background;
this.BackgroundImage = background;

SoundPlayer sndPing = new SoundPlayer(@"c:\lee\traffic.wav");
sndPing.Play();

this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.UserPaint, true);


}

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Left:
player.


}
}


}
}


Thanks Smile | :)


AnswerRe: Moving a sprite problem. Pin
Colin Angus Mackay15-Mar-07 1:48
Colin Angus Mackay15-Mar-07 1:48 
QuestionClient Notification Pin
justindhas15-Mar-07 1:06
justindhas15-Mar-07 1:06 
AnswerRe: Client Notification Pin
coolestCoder15-Mar-07 2:00
coolestCoder15-Mar-07 2:00 
GeneralRe: Client Notification Pin
justindhas15-Mar-07 18:59
justindhas15-Mar-07 18:59 
QuestionHelp regarding online update Pin
anu8115-Mar-07 0:52
anu8115-Mar-07 0:52 
AnswerRe: Help regarding online update Pin
Rudolf Jan15-Mar-07 1:11
Rudolf Jan15-Mar-07 1:11 
QuestionThread Synchronisation: Producer-Consumer Pin
blackjack215015-Mar-07 0:35
blackjack215015-Mar-07 0:35 
AnswerRe: Thread Synchronisation: Producer-Consumer Pin
Russell Jones15-Mar-07 0:59
Russell Jones15-Mar-07 0:59 
Questioncombobox ok and browse button Pin
hiremath7114-Mar-07 23:43
hiremath7114-Mar-07 23:43 
AnswerRe: combobox ok and browse button Pin
Keshav V. Kamat14-Mar-07 23:51
Keshav V. Kamat14-Mar-07 23:51 
GeneralRe: combobox ok and browse button Pin
hiremath7115-Mar-07 0:37
hiremath7115-Mar-07 0:37 
GeneralRe: combobox ok and browse button Pin
Keshav V. Kamat15-Mar-07 0:43
Keshav V. Kamat15-Mar-07 0:43 
GeneralRe: combobox ok and browse button Pin
Keshav V. Kamat15-Mar-07 0:44
Keshav V. Kamat15-Mar-07 0:44 
QuestionHL RCON Query Pin
NaNg1524114-Mar-07 23:34
NaNg1524114-Mar-07 23:34 
Questionconnect to shared mdb file Pin
hamid_m14-Mar-07 23:30
hamid_m14-Mar-07 23:30 
Questionfill the datagrid rows with database content. Pin
Keshav V. Kamat14-Mar-07 23:12
Keshav V. Kamat14-Mar-07 23:12 
AnswerRe: fill the datagrid rows with database content. Pin
coolestCoder15-Mar-07 2:04
coolestCoder15-Mar-07 2:04 

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.