|
Ok, I think this is what you're going to want to do.
On the parent form get the selected index of the listbox and pass that into the child form. On the child form take that index id and set that in the imagelist and picturebox controls to display the correct image when that form is loaded.
Parent form code:
int iLBID = listbox1.SelectedIndex;
ChildForm CForm = new ChildForm( iLBID );
CForm.ShowDialog( this );
CForm.Dispose();
this.Focus();
Child form code:
private int m_iSelID;
// Constructor code.
public ChildForm( int iLBID )
{
m_iSelID = iLBID;
pictureBox1.Image = imageList1.Images[m_iSelID];
}
** remember to add a picturebox and an imagelist control to your child form. Load up the imagelist control in design mode and then set the picturebox image index to the index selected in the parent listbox.
Hope this helps.
|
|
|
|
|
This is whats in my parentForm:
private void tbimage_SelectedIndexChanged(object sender, System.EventArgs e)<br />
{<br />
<br />
<br />
<br />
switch (tbimage.SelectedIndex) <br />
{<br />
case 0 :<br />
myImgForm.pBox1.Image = Image.FromFile("magic5.gif");<br />
break;<br />
case 1 :<br />
myImgForm.pBox1.Image = Image.FromFile("magic5.gif");<br />
break;<br />
case 2 :<br />
myImgForm.pBox1.Image = Image.FromFile("magic5.gif");<br />
break;<br />
case 3 :<br />
myImgForm.pBox1.Image = Image.FromFile("magic5.gif");<br />
break; <br />
case 4:<br />
myImgForm.pBox1.Image = Image.FromFile("magic5.gif");<br />
break;<br />
case 5 :<br />
myImgForm.pBox1.Image = Image.FromFile("magic5.gif");<br />
break;<br />
case 6 :<br />
myImgForm.pBox1.Image = Image.FromFile("magic5.gif");<br />
break;<br />
case 7 :<br />
myImgForm.pBox1.Image = Image.FromFile("magic5.gif");<br />
break; <br />
case 8 :<br />
myImgForm.pBox1.Image = Image.FromFile("magic5.gif");<br />
break;<br />
}
My parent Form is called FmMain
MyChild Form is called PreImg
My Picture Box is called pBox1
My Combo Box is called tbimage
My imagelist is called imagelist1
please help
just tell me when im gettin annoying
im just tryin to get through this final part
Da Intern
|
|
|
|
|
How do i use this....................okay, i have a form that has a list of file names, when those file names are selected i want a seprate form to pop-up showing each selected image. so if i selected image 1 then a form should pop-up showing image 1.
Please help
P.s. i've done alot already i think my brain is on "E", so could please help!!!
Thanks
Da Intern
|
|
|
|
|
and its member function?
|
|
|
|
|
I have several lists with different items. All of them should have copy, cut paste, delete and custom capabilities working from context menus, main menu and toolbar.
If no item of a given type is selected, the buttons and menus entries for that kind should be grey.
When selecting an item the menus and items should change accordingly.
When choosing a menu entry or toolbar button, the action should be applied to the selected item.
Basically, have the same behaviour office or developer studio have.
What is the best way of implementing such thing?
Who’s responsible to recognize the selected item? How?
How do I apply actions over the selected Item? Using events?
Does Visual Studio or .Net framework natively support a specific way of solving this?
Thanks.
|
|
|
|
|
Microsoft solves this problem by using a Command Manager class:
http://msdn.microsoft.com/library/default.asp?url=/msdnmag/issues/02/10/commandmanagement/TOC.ASP
|
|
|
|
|
I have created a diagram building application (something
like a "diet Visio" ) with an abstract Shape class every
drawing shape have to inherit.
My program has plug-in support so users can create their
own shapes (derived from my abstract Shape class). The
plug-ins are placed in a separat folder. The dll files in
this folder are dynamically loaded at startup.
Of course, I want my program to be able to save and load a
drawing. I use the BinaryFormatter and Stream classes to
serialize the drawing. This looks ok, but when I
deserialize the same file, I get an exception
(i.e) "Rectangle.dll not found" (or something like that),
because this file is a plug-in, dynamically loaded at
startup.
So (finally) my question is: What is the best way to
serialize and deserialize an object (consisting of
dynamically loaded objects) like my drawing object?
Any help and suggestion are appreciated.
Øyvind.
|
|
|
|
|
Hi,
I'm trying to get several browser panels on top of each other each with a different opacity. I was wondering if there was any way of setting the opacity for a panel, or if any one had any ideas as to how to go about achieving this effect.
thanks
dror.
|
|
|
|
|
Please take a look at this article on devhood, http://www.devhood.com/messages/message_view-2.aspx?thread_id=70534
What I want to do is essentially have a class which contains all static members of my applications settings and have it serialized out.
Something along the lines of this,
class MySettings
{
public static bool isConstant;
public static bool doReports;
}
After serialization using the XmlSerializer class, I hope to get something like this,
<?xml version="1.0"?>
<appSettings>
<add name="isConstant" value="true">
<add name="doReports" value="false">
</appSettings>
The main reason for serializing this is because the App.exe.config is read-only, so any changes to the settings don't persist. This is where the serialization comes into play. If I can get it to output into the xml file above, I'm golden.
The problem now, is getting it into the correct format. I see two problems with this.
One, the class contains all static members so when I call XmlSerializer.Serialize( <stream>, <object to serialize> ) I don't have an object to use.
Problem two, for each member variable how to output the xml <add key="isConstant" value="true" />, etc.
This is about as far as I get . . .
[XmlRoot("appSettings")]
class Settings
{
public static bool isConstant;
public static bool doReports;
}
Which as you can see, isn't far. I don't know how to have the <add> element for each member variable. It won't let me add [XmlElement("add")] before each member variable. (it complains about using the same element name) And I don't know how to get the correct attributes into the xml.
Any ideas? Or better ways of doing this?
Thanks.
|
|
|
|
|
Is there a C# equivalent of the VB.net keyword Shared ?
IE:
Public <big>Shared </big>Function DoSomething(ByVal MyValue As Integer) As String
{
'do something
}
Steve
McLenithan
Is Bert Evil? | Homer: "Hello, operator, gimme the number for 911!"
|
|
|
|
|
static
Do you not have the documentation install it is all there.
Bo Hunter
|
|
|
|
|
That's what I thought... Just wanted to be sure;) Thanks
Steve
McLenithan
Is Bert Evil? | Homer: "Hello, operator, gimme the number for 911!"
|
|
|
|
|
Hi all,
I am trying to figure out what I need to do to write an Add in for internet explorer using C#.
What interfaces do I have to implement and where is the documentation for the IE object model.
Any help will be appreciated.
Regards,
Rahul
kingtiny@cs.cmu.edu
|
|
|
|
|
I don't know anything about this topic but if you like it I know that Wrox press has about exacctly about this topic. You can check wrox.com for more information or at least get source code for somme sample.
Mazy
No sig. available now.
|
|
|
|
|
Check out this[^] article.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
|
leppie wrote:
Check out this[^] article.
That is too cool. I was interested in this a few months ago. Did not see that one sneek in, it is bookmarked now
Rocky Moore <><
|
|
|
|
|
hi guys,
I build a class using C# Library class option. How can i make this class available in a web service?
Thanks
|
|
|
|
|
The same as you you add class to other projects. Add its assemblies to your project with ADD REFRENCE.
Mazy
No sig. available now.
|
|
|
|
|
Hi guys,
I have System.Web available,
but I don't have System.Web.Services avalaible. What should I do?
Thanks
|
|
|
|
|
Right click on REFRENCE in Solution Explorer andd click add refrence. Add your namespace from the list. The same way for your other question but you have to browse your dll .
Mazy
No sig. available now.
|
|
|
|
|
Hi All,
I add a comobobox to my form and I can't use the mouse in the edit portion. I can use it to click and move the caret, but if I try to select anything it doesn't work. Anyone know what this is? I do have the style set to the one where you can edit the box (don't remember what it's called at the moment though).
- monrobot13
|
|
|
|
|
|
monrobot13 wrote:
Anyone know what this is?
Its a bug in .NET 1.0, fixed in 1.1.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
First thanks,
Second, how would I start using the .NET 1.1 controls?
Thanks!
- monrobot13
|
|
|
|