How TO Insert A Menu at a Properties of that UserControl or componet
-
Monday, April 16, 2012 4:35 AM
like this
it's imagelist
All Replies
-
Monday, April 16, 2012 5:54 AM
You can declare the property of ImageList like this in the user control file.
[DefaultValue("")] [MergableProperty(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ImageList.ImageCollection Images { get; set; }// This i copied from the ImageList control definition
Resolving n Evolving in C# (http://jeanpaulva.com)
- Edited by Jean Paul V.A Monday, April 16, 2012 5:54 AM
-
Monday, April 16, 2012 6:18 AM
so i wanted a openfiledialog to show on there and rightclickmenu
like that chooseimage.
-
Wednesday, April 18, 2012 3:42 AMModerator
Hi Deepest,
Welcome to the MSDN forum.
It seems that you want to choose images and add them to a listView, if so you can try the sample below.
private void button1_Click(object sender, EventArgs e) { this.openFileDialog1.Filter = "Images (*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|" + "All files (*.*)|*.*"; // Allow the user to select multiple images. this.openFileDialog1.Multiselect = true; this.openFileDialog1.Title = "My Image Browser"; DialogResult dr = this.openFileDialog1.ShowDialog(); if (dr == System.Windows.Forms.DialogResult.OK) { // Read the files foreach (String file in openFileDialog1.FileNames) { try { listView1.SmallImageList = imageList1; listView1.View = View.SmallIcon; imageList1.Images.Add(Image.FromFile(file)); listView1.Items.Add(file, imageList1.Images.Count-1); } catch (SecurityException ex) { // The user lacks appropriate permissions to read files, discover paths, etc. MessageBox.Show("Security error. Please contact your administrator for details.\n\n" + "Error message: " + ex.Message + "\n\n" + "Details (send to Support):\n\n" + ex.StackTrace ); } catch (Exception ex) { // Could not load the image - probably related to Windows file system permissions. MessageBox.Show("Cannot display the image: " + file.Substring(file.LastIndexOf('\\')) + ". You may not have permission to read the file, or " + "it may be corrupt.\n\nReported error: " + ex.Message); } } } }
Have a nice day.Bob Shen [MSFT]
MSDN Community Support | Feedback to us
- Marked As Answer by Bob ShenMicrosoft Contingent Staff, Moderator Tuesday, May 01, 2012 3:27 AM
-
Saturday, April 21, 2012 6:59 AM
actually this question hasn't done,
but thank everyone
-
Tuesday, April 24, 2012 3:04 AMModerator
Hi Deepest,
How’s it going? Do you have any updates about the previous issue? If I misunderstood you, please tell me and provide more detailed information about this issue.
Bob Shen [MSFT]
MSDN Community Support | Feedback to us
-
Tuesday, May 01, 2012 3:29 AMModerator
Hi Deepest,
I temporarily mark my last response as an answer. You can unmark it if they provide no help.
Bob Shen [MSFT]
MSDN Community Support | Feedback to us

