Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

C# Assign bigger images (bigger than default 16x16 icons) in ContextMenuStrip

Posted on 2009-02-15
6
Medium Priority
?
1,122 Views
Last Modified: 2012-05-06
Hi
How to set bigger images instead of the default 16x16 iconsin ContextMenuStrip.

Attached is an image - and it will explain more. The icons that are circled with red color should be changed to 48x48  icons.

How can I do that ??

Wael
1.JPG
0
Comment
Question by:waelali
  • 4
  • 2
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 23653896
How are you referencing the images?  Is there an ImageList?
0
 

Author Comment

by:waelali
ID: 23653958
yes ofcourse. imagelist.
but could not resie the image susing that .
I have tried but could not see any effect-
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 23653982
What is the ImageList.ImageSize set to?  It should be 48 x 48, if you have images with that size.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:waelali
ID: 23654274
i have did that but nothing was changed
0
 

Author Comment

by:waelali
ID: 23654495
I have done the following

ImageList myImages = new ImageList();
myImages.Images.Add(Image.FromFile("..\\..\\..\\TabStripApp\\Resources\\Add.jpg"));
myImages.ImageSize.Height = 48;
myImages.ImageSize.Width = 48;


but I got a compilation error:

Error 1 Cannot modify the return value of 'System.Windows.Forms.ImageList.ImageSize' because it is not a variable
 
May you can help??
 
Wael
0
 

Accepted Solution

by:
waelali earned 0 total points
ID: 23655484
Ok

I have found the solution.
In addition to
            myImages.ImageSize = new System.Drawing.Size(48, 48);

you must do the following also
            contextMenu1.ImageScalingSize = new System.Drawing.Size(48, 48);

The calling order is not important and you can put them before or after
                   myImages.Images.Add(Image.FromFile("..\\..\\..\\TabStripApp\\Resources\\Add.jpg"));


0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question