-
May 21st, 2009, 04:46 AM
#1
Creating a Picturebox at Runtime (windows forms applications)
Hi,I want to create a picturebox at runtime.i mean when i click a button then,the picturebox is created.
i have tried this code, but it doesnt work.
Code:
PictureBox^ pct;
pct=gcnew PictureBox;
pct->Location = Point(240,210);
pct->Size.Height= 30;
pct->Size.Width= 30;
pct->BackColor.Aquamarine;
Controls->Add(pct);
pct->Visible=true;
i am using visual c++ 2008.
after i create a picturebox,i want to create an array of pictureboxes.can anybody please tell me how to create a picturebox and its array.
Thanks
-
May 21st, 2009, 04:56 AM
#2
Re: Creating a Picturebox at Runtime (windows forms applications)
I suggest if you cannot figure out how to properly create a PictureBox then drop one with the designer and look into its code how the designer did it, then try to do the same
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
May 21st, 2009, 05:02 AM
#3
Re: Creating a Picturebox at Runtime (windows forms applications)
i have tried that too...it doesnt work....
-
May 21st, 2009, 05:06 AM
#4
Re: Creating a Picturebox at Runtime (windows forms applications)
then could you be more specific about what doesnt work? are there any errors? are those picture boxes not visible? null references or so?
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
May 21st, 2009, 07:52 AM
#5
Re: Creating a Picturebox at Runtime (windows forms applications)
hey,i can make the picture box now.Thanks Anyways.can you please explain how to make an array of objects in windows form?
-
May 21st, 2009, 07:58 AM
#6
Re: Creating a Picturebox at Runtime (windows forms applications)
there are many "arrays", the classic one or .net collections, take a look at this namespace and
Code:
System.Collections.Generic
I'm sure you'll find something that suits your needs
Last edited by memeloo; May 21st, 2009 at 08:01 AM.
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
May 21st, 2009, 08:01 AM
#7
Re: Creating a Picturebox at Runtime (windows forms applications)
hmm...i have no idea what you are talking about,but i will try search.thanks!
-
May 21st, 2009, 08:05 AM
#8
Re: Creating a Picturebox at Runtime (windows forms applications)
...so you'll have to learn some basics first ;]
Last edited by memeloo; May 21st, 2009 at 08:16 AM.
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
May 21st, 2009, 08:15 AM
#9
Re: Creating a Picturebox at Runtime (windows forms applications)
ya, i need to learn the basics.Our University sucks,they didnt even teach us Programming in GUI and gave us a project to make a Generic Predator/Prey Game.....
-
May 21st, 2009, 08:24 AM
#10
Re: Creating a Picturebox at Runtime (windows forms applications)
one of my favourite websites where you can learn something http://functionx.com/cppcli/
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
May 21st, 2009, 08:46 AM
#11
Re: Creating a Picturebox at Runtime (windows forms applications)
yeah its my favorite too!....
thanks
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|