473,327 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Context menu with icons in c#

Hi
How to create a context menu with icons??
I know there is no straight way of doing it.And i have the code
downloaded for vb.net. does anybody have code written in c#??
Anushya
Nov 15 '05 #1
4 10906
"Anushya" <v_*******@hotmail.com> wrote in message
news:80**************************@posting.google.c om...
Hi
How to create a context menu with icons??
* Buy a professional UI framework.
* Use an open source implementation.
I know there is no straight way of doing it.And i have the code
So what?
downloaded for vb.net. does anybody have code written in c#??


Well, there are surely C# sample around, too.

And yes, I DO have the code written in C# (actually for the whole
Infragistics suite), but no, I can not give it to you - illegal.

Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
Nov 15 '05 #2
You might find something at planet-source-code.com
"Anushya" <v_*******@hotmail.com> wrote in message
news:80**************************@posting.google.c om...
Hi
How to create a context menu with icons??
I know there is no straight way of doing it.And i have the code
downloaded for vb.net. does anybody have code written in c#??
Anushya

Nov 15 '05 #3
Why don't you try your hand at it? Make the menu items owner drawn and draw
the menu item yourself... It's not that difficult. You will need to
sub-class the menu-item and over-ride the OnDrawItem method on the menu
item.

Something like this:

using System.Windows.Form;
using System.Drawing;

public class MyMenuItem : MenuItem
{
private Image itemImage;

public MyMenuItem() : base ()
{
this.OwnerDraw = true;
}

/// Gets/sets the menu item's image
public Image
{
get
{
return itemImage;
}

set
{
itemImage = value;
}
}

protected override void OnDrawItem(DrawItemEventArgs e)
{
// Draw your item here
// DrawItemEventArgs provides you with the font, the
// back color, the fore color, the text, the state of the control
// the graphics canvas, etc... (all that you ever need to draw the
// control.

base.OnDrawItem(e);
}
}

-vJ

"Anushya" <v_*******@hotmail.com> wrote in message
news:80**************************@posting.google.c om...
Hi
How to create a context menu with icons??
I know there is no straight way of doing it.And i have the code
downloaded for vb.net. does anybody have code written in c#??
Anushya

Nov 15 '05 #4
Why don't you try your hand at it? Make the menu items owner drawn and draw
the menu item yourself... It's not that difficult. You will need to
sub-class the menu-item and over-ride the OnDrawItem method on the menu
item.

Something like this:

using System.Windows.Form;
using System.Drawing;

public class MyMenuItem : MenuItem
{
private Image itemImage;

public MyMenuItem() : base ()
{
this.OwnerDraw = true;
}

/// Gets/sets the menu item's image
public Image
{
get
{
return itemImage;
}

set
{
itemImage = value;
}
}

protected override void OnDrawItem(DrawItemEventArgs e)
{
// Draw your item here
// DrawItemEventArgs provides you with the font, the
// back color, the fore color, the text, the state of the control
// the graphics canvas, etc... (all that you ever need to draw the
// control.

base.OnDrawItem(e);
}
}

-vJ

"Anushya" <v_*******@hotmail.com> wrote in message
news:80**************************@posting.google.c om...
Hi
How to create a context menu with icons??
I know there is no straight way of doing it.And i have the code
downloaded for vb.net. does anybody have code written in c#??
Anushya

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Dennis C. Drumm | last post by:
Is there a way to modify the standard context menu shown when someone right clicks in a windows text box and that would work for all open windows applications? The standard context menu for...
4
by: ssg31415926 | last post by:
I've got a ListView which can show many different types of object. I need to display a ContextMenu whose MenuItems depend on the object type. I was planning to pre-create the ContextMenus when...
6
by: Bob | last post by:
I'd like to be able to do three things with the context menu 1. change the width 2. change the borderstyle to none 3. change the back color I don't think it's possible, so what's the best way...
0
by: Robert Smith | last post by:
Hello, I have written some context menus in my application, however I see lots of nice icons on the menus that microsoft use. It is not obvious how one would add these icons to the menu items....
1
by: Matt Michael | last post by:
Hi, is there any way to add menu items to a context menu with icons next to them. When I declare a menuitem, it does not seem like there is a .icon property or anything similar or intuitive like...
1
by: goRide | last post by:
Hi, I'm looking of a way (preferred - a ready class or dll) to customize the context menu. many application has more controls inside the context menu (like textbox, sliders, checkbox, panel...
3
by: Steven | last post by:
Hello, I want to a context menu extension dll like WinZIP, and it supports Windows Vista 32bit & 64bit. Where is it? Thank you Steven
23
by: kigoobe | last post by:
Hi friends, I'm having a menu like this - http://www.kigoobe.com/offshoring/bugs/javascript/treeMenuCheckToggle.gif that I've fetched from the database, using recursive function, where data...
2
by: David Veeneman | last post by:
I'm just getting started with WPF and XAML, and I am trying to create a traditional menu bar. Everything works until I get to the menu icons. I can add a bitmap icon to a menu item using this XAML...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.