469,356 Members | 2,656 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

Moving a picture inside a picturebox

Hi,

I am trying to set the position of a picture inside a picturebox with the
folowing code:

pctOutput.Picture = LoadPicture(App.Path & "\picture.bmp", [Size],
[ColorDepth], [X], [Y])

I didn't know what to fill in at [Size] and [ColorDepth] so the result was:

pctOutput.Picture = LoadPicture(App.Path & "\picture.bmp", (315) - (315),
1, x2, y2)
'(x2 and y2 are declared variables)

My problem is that the picture hasn't moved at all, it's still in the upper
left corner :(
Does anyone here know how to set the position of a picture inside a
picturebox?

Thanks for your help.

Chris
Jul 17 '05 #1
4 15141
Is that VB.NET ?

If so you would be better of in a dotnet NG

On Fri, 26 Mar 2004 10:29:33 +0100, "Chris" <c9*****@hotmail.com>
wrote:
Hi,

I am trying to set the position of a picture inside a picturebox with the
folowing code:

pctOutput.Picture = LoadPicture(App.Path & "\picture.bmp", [Size],
[ColorDepth], [X], [Y])

I didn't know what to fill in at [Size] and [ColorDepth] so the result was:

pctOutput.Picture = LoadPicture(App.Path & "\picture.bmp", (315) - (315),
1, x2, y2)
'(x2 and y2 are declared variables)

My problem is that the picture hasn't moved at all, it's still in the upper
left corner :(
Does anyone here know how to set the position of a picture inside a
picturebox?

Thanks for your help.

Chris


Jul 17 '05 #2
> I am trying to set the position of a picture inside a picturebox with the
folowing code:

pctOutput.Picture = LoadPicture(App.Path & "\picture.bmp", [Size],
[ColorDepth], [X], [Y])

I didn't know what to fill in at [Size] and [ColorDepth] so the result was:
pctOutput.Picture = LoadPicture(App.Path & "\picture.bmp", (315) - (315), 1, x2, y2)
'(x2 and y2 are declared variables)

My problem is that the picture hasn't moved at all, it's still in the upper left corner :(
Does anyone here know how to set the position of a picture inside a
picturebox?


You could always put an Image control **IN** (not merely on top of) the
PictureBox, load your picture into the Image control and place the picture
wherever you want via the Image control's Top and Left properties.

Rick - MVP
Jul 17 '05 #3
On Fri, 26 Mar 2004 09:36:42 +0000 (UTC), er*****@nowhere.com (J
French) wrote:
Is that VB.NET ?

If so you would be better of in a dotnet NG


Ah, sorry, it is a VB6 enhancement

Size should be: vbLPCustom

ColorDepth try : vbLPDefault

Here is the link - watch for wrapping:

http://msdn.microsoft.com/library/de...oadpicture.asp

Here is the same:
http://tinyurl.com/2o6m8


Jul 17 '05 #4
"Rick Rothstein" <ri************@NOSPAMcomcast.net> wrote in message news:<0d********************@comcast.com>...
I am trying to set the position of a picture inside a picturebox with the
folowing code:

pctOutput.Picture = LoadPicture(App.Path & "\picture.bmp", [Size],
[ColorDepth], [X], [Y])

The x and y arguments specify width & height, not top & left; top &
left are always 0,0
You could always put an Image control **IN** (not merely on top of) the
PictureBox, load your picture into the Image control and place the picture
wherever you want via the Image control's Top and Left properties.


that or load it into an image or picturebox (or form or anything that
accepts an image) and the use the PaintPicture method to re-draw it
where it should be
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Steven | last post: by
6 posts views Thread by Dick | last post: by
1 post views Thread by sagi | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.