473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Setting a picturebox image at runtime and offsetting

I am programming a "craps table", and I would like to randomize where the
dice land.
The first one is no problem. To fit on the "table" I have the following:
picDie1.Location = New Point(Rnd() * 469, Rnd() * 245)

The second die is a little harder. I don't want any overlap of the dice,
and the second die must also fit on the table. The horz. width of the dice
is 80, and the vert. ht. is 100. Any suggestions on this (game or animation
guys)?

I also cannot seem to find the syntax for changing the image. I have
imported the resources, so they are embedded, and they are named die1.bmp,
die2.bmp, die3.bmp, etc.

I tried picDie1.image = "die" &die1 'and tried converting die1 to a
string type.
Suggestions here??

Thanks!

--
Jeff Ciaccio
Physics and AP Physics Teacher
Sprayberry High School; Marietta, GA
Blog: http://sprayberry.typepad.com/ciaccio

Jun 28 '08 #1
3 8636
On Jun 28, 5:50 am, "Jeff Ciaccio" <non...@noreply.orgwrote:
I am programming a "craps table", and I would like to randomize where the
dice land.
The first one is no problem. To fit on the "table" I have the following:
picDie1.Location = New Point(Rnd() * 469, Rnd() * 245)

The second die is a little harder. I don't want any overlap of the dice,
and the second die must also fit on the table. The horz. width of the dice
is 80, and the vert. ht. is 100. Any suggestions on this (game or animation
guys)?

I also cannot seem to find the syntax for changing the image. I have
imported the resources, so they are embedded, and they are named die1.bmp,
die2.bmp, die3.bmp, etc.

I tried picDie1.image = "die" &die1 'and tried converting die1 to a
string type.
Suggestions here??

Thanks!

--
Jeff Ciaccio
Physics and AP Physics Teacher
Sprayberry High School; Marietta, GA
Blog:http://sprayberry.typepad.com/ciaccio
'To set a new image from file location, you location property

picDie1.ImageLocation = "c:\die1.bmp"

like that...

Hope this helps,

Onur Güzel
Jun 28 '08 #2
What if I have imported the files into my Resources so I can embed the
images with the app? Will it include the project name or maybe the form
name in its qualifier?

Thanks a bunch!
- Jeff

"kimiraikkonen" <ki*************@gmail.comwrote in message
news:17**********************************@r66g2000 hsg.googlegroups.com...
On Jun 28, 5:50 am, "Jeff Ciaccio" <non...@noreply.orgwrote:

'To set a new image from file location, you location property

picDie1.ImageLocation = "c:\die1.bmp"

like that...

Hope this helps,

Onur Güzel

Jun 28 '08 #3
On Jun 28, 5:13 pm, "Jeff Ciaccio" <non...@noreply.orgwrote:
What if I have imported the files into my Resources so I can embed the
images with the app? Will it include the project name or maybe the form
name in its qualifier?

Thanks a bunch!
- Jeff

"kimiraikkonen" <kimiraikkone...@gmail.comwrote in message

news:17**********************************@r66g2000 hsg.googlegroups.com...
On Jun 28, 5:50 am, "Jeff Ciaccio" <non...@noreply.orgwrote:

'To set a new image from file location, you location property

picDie1.ImageLocation = "c:\die1.bmp"

like that...

Hope this helps,

Onur Güzel
I'm not such familiar with resources for now, but after you add and
embed a image into your resources you can call it using:

' Assuming your image is named "Image1"
PictureBox1.Image = My.Resources.Image1

HTH,

Onur Güzel
Jun 28 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jeff | last post by:
I've seen a couple of posts on the Internet with others having this problem, however, no one seems to have a good answer. I am working on a C# Smart Device application and have been able to...
2
by: **Developer** | last post by:
During debug I noticed that a picturebox image does not have a Location Is the image object always located at the upper left of the clientsize of the picturebox. If the picturebox clientsize...
0
by: dlamar | last post by:
I'm using VB.NET with 2.0 - I have a number of PictureBoxes in my application - all of which use a context menu to change the associated Image to one of 5 options. I need to maintain the state of...
2
by: Frank | last post by:
For various reasons I want to use a PictureBox to display images. That is I want sometimes to assign an Image to the PictureBox Sometimes I want to draw on that Image. What are the reasons for...
3
by: Andrzej | last post by:
I have a picturebox on my C# .NET form. The picturebox size mode is set to zoom. I then load an image into that form and display it. As the user moves the mouse over the form, I want to get and...
4
by: Jerry West | last post by:
I have a routine that updates a PictureBox image every x seconds. I do this by first loading an array with the path to all of the images. I then generate a random number to use as the index of the...
0
by: irtehnoob | last post by:
Hi there, I'm pretty new to c# (started up a few days ago) and I'm making a simple program, so far everything is going good except I can't figure somethine out.. hence why I'm here. Anyways, in my...
2
Computer Guru
by: Computer Guru | last post by:
Like the title, How do I open a picturebox image for editing durring runtime?
1
by: Krushangi | last post by:
Hi Code for: How to change picturebox during Runtime. I want this Code in C#.net I have one picturebox Image and i want to change it during MouseUp Event at Runtime. Tell me how can i give...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.