473,729 Members | 2,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Library question

I am getting these errors:

DrawListViewIte mEventArgs' could not be found
DrawListViewSub ItemEventArgs' could not be found
DrawListViewCol umnHeaderEventA rgs' could not be found

I am already referencing both:
System.Drawing
System.Drawing. Design

Which else should I reference to get rid of these errors?

Adrian.
Feb 9 '07 #1
10 1804
Hello Adrian,

all the three classes are defined in System.Windows. Forms namespace, so add
"using System.Windows. Forms;" to your C# code.

That should do it!

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
ja***@removethi s.dystopia.fi
http://www.saunalahti.fi/janij/
Feb 9 '07 #2
Adrian:

Maybe a silly question, but are you including a "using" directive?

jpuopolo

"Adrian <" <no*@home.anywh erewrote in message
news:45******** ************@dr eader2.news.tis cali.nl...
>I am getting these errors:

DrawListViewIte mEventArgs' could not be found
DrawListViewSub ItemEventArgs' could not be found
DrawListViewCol umnHeaderEventA rgs' could not be found

I am already referencing both:
System.Drawing
System.Drawing. Design

Which else should I reference to get rid of these errors?

Adrian.


Feb 9 '07 #3
Not a silly question at all,
however "using" is there.
Adrian

--

P. de Ridder, drs econ., bsc psych.
Pearltree Software Development
www.pearltree.nl
www.pearltree.us
"jpuopolo" <jp******@hotma il.comwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Adrian:

Maybe a silly question, but are you including a "using" directive?

jpuopolo

"Adrian <" <no*@home.anywh erewrote in message
news:45******** ************@dr eader2.news.tis cali.nl...
I am getting these errors:

DrawListViewIte mEventArgs' could not be found
DrawListViewSub ItemEventArgs' could not be found
DrawListViewCol umnHeaderEventA rgs' could not be found

I am already referencing both:
System.Drawing
System.Drawing. Design

Which else should I reference to get rid of these errors?

Adrian.


Feb 9 '07 #4
If have that reference in.
So that isn't the cause.
Adrian.

"Jani Järvinen [MVP]" <ja***@removeth is.dystopia.fiw rote in message
news:OG******** ******@TK2MSFTN GP03.phx.gbl...
Hello Adrian,

all the three classes are defined in System.Windows. Forms namespace, so
add
"using System.Windows. Forms;" to your C# code.

That should do it!

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
ja***@removethi s.dystopia.fi
http://www.saunalahti.fi/janij/


Feb 9 '07 #5
Hello,

can you post your code that shows the error and the complete error message?

There must be something else going on in your code if you have the
references/using statements already in place.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
ja***@removethi s.dystopia.fi
http://www.saunalahti.fi/janij/
Feb 9 '07 #6
"Adrian <" <no*@home.anywh erewrote in message
news:45******** ************@dr eader2.news.tis cali.nl...
>I am getting these errors:

DrawListViewIte mEventArgs' could not be found
DrawListViewSub ItemEventArgs' could not be found
DrawListViewCol umnHeaderEventA rgs' could not be found

I am already referencing both:
System.Drawing
System.Drawing. Design

Which else should I reference to get rid of these errors?

Adrian.

Are you sure you are using Framework v2.0?

Willy.

Feb 9 '07 #7
The code was taken from MSDN

using System;
using System.Drawing;
using System.Drawing. Drawing2D;
using System.Globaliz ation;
using System.Windows. Forms;

namespace WindowsApplicat ion1
{
public class Form1: Form
{
private ListView listView1 = new ListView();
private ContextMenu contextMenu1 = new ContextMenu();

public Form1()
{
// Initialize the ListView control.
listView1.BackC olor = Color.Black;
listView1.ForeC olor = Color.White;
listView1.Dock = DockStyle.Fill;
listView1.View = View.Details;
listView1.FullR owSelect = true;

// Add columns to the ListView control.
listView1.Colum ns.Add("Name", 72, HorizontalAlign ment.Center);
listView1.Colum ns.Add("First", 72, HorizontalAlign ment.Center);
listView1.Colum ns.Add("Second" , 72, HorizontalAlign ment.Center);
listView1.Colum ns.Add("Third", 72, HorizontalAlign ment.Center);

// Create items and add them to the ListView control.
ListViewItem listViewItem1 = new ListViewItem(ne w string[] { "One", "20",
"30", "-40" }, -1);
ListViewItem listViewItem2 = new ListViewItem(ne w string[] { "Two",
"-250", "145", "37" }, -1);
ListViewItem listViewItem3 = new ListViewItem(ne w string[] { "Three",
"200", "800", "-1,001" }, -1);
ListViewItem listViewItem4 = new ListViewItem(ne w string[] { "Four", "not
available", "-2", "100" }, -1);
listView1.Items .AddRange(new ListViewItem[] { listViewItem1,
listViewItem2, listViewItem3, listViewItem4 });

// Initialize the shortcut menu and
// assign it to the ListView control.
contextMenu1.Me nuItems.Add("Li st", new EventHandler(me nuItemList_Clic k));
contextMenu1.Me nuItems.Add("De tails", new
EventHandler(me nuItemDetails_C lick));
listView1.Conte xtMenu = contextMenu1;

// Configure the ListView control for owner-draw and add
// handlers for the owner-draw events.
listView1.Owner Draw = true;
listView1.DrawI tem += new
DrawListViewIte mEventHandler(l istView1_DrawIt em);
listView1.DrawS ubItem += new
DrawListViewSub ItemEventHandle r(listView1_Dra wSubItem);
listView1.DrawC olumnHeader += new
DrawListViewCol umnHeaderEventH andler(listView 1_DrawColumnHea der);

// Add a handler for the MouseMove event to compensate for an
// extra DrawItem event that occurs the first time the mouse
// moves over each row.
listView1.Mouse Move += new MouseEventHandl er(listView1_Mo useMove);

// Add a handler for the MouseUp event so an item can be
// selected by clicking anywhere along its width.
listView1.Mouse Up += new MouseEventHandl er(listView1_Mo useUp);

// Initialize the form and add the ListView control to it.
this.ClientSize = new Size(292, 79);
this.FormBorder Style = FormBorderStyle .FixedSingle;
this.MaximizeBo x = false;
this.Text = "ListView OwnerDraw Example";
this.Controls.A dd(listView1);
}

// Clean up any resources being used.
protected override void Dispose(bool disposing)
{
if (disposing)
{
contextMenu1.Di spose();
}
base.Dispose(di sposing);
}

[STAThread]
static void Main()
{
Application.Ena bleVisualStyles ();
Application.Run (new ListViewOwnerDr aw());
}

// Sets the ListView control to the List view.
private void menuItemList_Cl ick(object sender, EventArgs e)
{
listView1.View = View.List;
listView1.Inval idate();
}

// Sets the ListView control to the Details view.
private void menuItemDetails _Click(object sender, EventArgs e)
{
listView1.View = View.Details;

// Reset the tag on each item to re-enable the workaround in
// the MouseMove event handler.
foreach (ListViewItem item in listView1.Items )
{
item.Tag = null;
}
}

// Selects and focuses an item when it is clicked anywhere along
// its width. The click must normally be on the parent item text.
private void listView1_Mouse Up(object sender, MouseEventArgs e)
{
ListViewItem clickedItem = listView1.GetIt emAt(5, e.Y);
if (clickedItem != null)
{
clickedItem.Sel ected = true;
clickedItem.Foc used = true;
}
}

// Draws the backgrounds for entire ListView items.
private void listView1_DrawI tem(object sender, DrawListViewIte mEventArgs
e)
{
if ((e.State & ListViewItemSta tes.Selected) != 0)
{
// Draw the background and focus rectangle for a selected item.
e.Graphics.Fill Rectangle(Brush es.Maroon, e.Bounds);
e.DrawFocusRect angle();
}
else
{
// Draw the background for an unselected item.
using (LinearGradient Brush brush =
new LinearGradientB rush(e.Bounds, Color.Orange,
Color.Maroon, LinearGradientM ode.Horizontal) )
{
e.Graphics.Fill Rectangle(brush , e.Bounds);
}
}

// Draw the item text for views other than the Details view.
if (listView1.View != View.Details)
{
e.DrawText();
}
}

// Draws subitem text and applies content-based formatting.
private void listView1_DrawS ubItem(object sender,
DrawListViewSub ItemEventArgs e)
{
TextFormatFlags flags = TextFormatFlags .Left;

using (StringFormat sf = new StringFormat())
{
// Store the column text alignment, letting it default
// to Left if it has not been set to Center or Right.
switch (e.Header.TextA lign)
{
case HorizontalAlign ment.Center:
sf.Alignment = StringAlignment .Center;
flags = TextFormatFlags .HorizontalCent er;
break;
case HorizontalAlign ment.Right:
sf.Alignment = StringAlignment .Far;
flags = TextFormatFlags .Right;
break;
}

// Draw the text and background for a subitem with a
// negative value.
double subItemValue;
if (e.ColumnIndex 0 && Double.TryParse (
e.SubItem.Text, NumberStyles.Cu rrency,
NumberFormatInf o.CurrentInfo, out subItemValue) &&
subItemValue < 0)
{
// Unless the item is selected, draw the standard
// background to make it stand out from the gradient.
if ((e.ItemState & ListViewItemSta tes.Selected) == 0)
{
e.DrawBackgroun d();
}

// Draw the subitem text in red to highlight it.
e.Graphics.Draw String(e.SubIte m.Text,
listView1.Font, Brushes.Red, e.Bounds, sf);

return;
}

// Draw normal text for a subitem with a nonnegative
// or nonnumerical value.
e.DrawText(flag s);
}
}

// Draws column headers.
private void listView1_DrawC olumnHeader(obj ect sender,
DrawListViewCol umnHeaderEventA rgs e)
{
using (StringFormat sf = new StringFormat())
{
// Store the column text alignment, letting it default
// to Left if it has not been set to Center or Right.
switch (e.Header.TextA lign)
{
case HorizontalAlign ment.Center:
sf.Alignment = StringAlignment .Center;
break;
case HorizontalAlign ment.Right:
sf.Alignment = StringAlignment .Far;
break;
}

// Draw the standard header background.
e.DrawBackgroun d();

// Draw the header text.
using (Font headerFont =
new Font("Helvetica ", 10, FontStyle.Bold) )
{
e.Graphics.Draw String(e.Header .Text, headerFont,
Brushes.Black, e.Bounds, sf);
}
}
return;
}

// Forces each row to repaint itself the first time the mouse moves over
// it, compensating for an extra DrawItem event sent by the wrapped
// Win32 control.
private void listView1_Mouse Move(object sender, MouseEventArgs e)
{
ListViewItem item = listView1.GetIt emAt(e.X, e.Y);
if (item != null && item.Tag == null)
{
listView1.Inval idate(item.Boun ds);
item.Tag = "tagged";
}
}
}
}
"Jani Järvinen [MVP]" <ja***@removeth is.dystopia.fiw rote in message
news:eu******** ******@TK2MSFTN GP03.phx.gbl...
Hello,

can you post your code that shows the error and the complete error
message?
>
There must be something else going on in your code if you have the
references/using statements already in place.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
ja***@removethi s.dystopia.fi
http://www.saunalahti.fi/janij/


Feb 9 '07 #8
Yes I have it on board
Adrian

"Willy Denoyette [MVP]" <wi************ *@telenet.bewro te in message
news:Od******** ******@TK2MSFTN GP03.phx.gbl...
"Adrian <" <no*@home.anywh erewrote in message
news:45******** ************@dr eader2.news.tis cali.nl...
I am getting these errors:

DrawListViewIte mEventArgs' could not be found
DrawListViewSub ItemEventArgs' could not be found
DrawListViewCol umnHeaderEventA rgs' could not be found

I am already referencing both:
System.Drawing
System.Drawing. Design

Which else should I reference to get rid of these errors?

Adrian.

Are you sure you are using Framework v2.0?

Willy.

Feb 9 '07 #9
I have got it to run. It would not run on VS2003, but it will run on V2005.
I did make some changes though. However the header back color is read only,
so I am stuck, because specifically that I wanted to change.

Adrian
"Adrian <" <no*@home.anywh erewrote in message
news:45******** ************@dr eader2.news.tis cali.nl...
Yes I have it on board
Adrian

"Willy Denoyette [MVP]" <wi************ *@telenet.bewro te in message
news:Od******** ******@TK2MSFTN GP03.phx.gbl...
"Adrian <" <no*@home.anywh erewrote in message
news:45******** ************@dr eader2.news.tis cali.nl...
>I am getting these errors:
>
DrawListViewIte mEventArgs' could not be found
DrawListViewSub ItemEventArgs' could not be found
DrawListViewCol umnHeaderEventA rgs' could not be found
>
I am already referencing both:
System.Drawing
System.Drawing. Design
>
Which else should I reference to get rid of these errors?
>
Adrian.
>
>
Are you sure you are using Framework v2.0?

Willy.



Feb 10 '07 #10

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

Similar topics

0
2148
by: porschberg | last post by:
Hi, I have question regarding the pool library. In my application I read a lot of data records from a database into a small data class and therefor I thought object_pool could help me to reduce memory consumption. So I wrote: class OuterClass
8
1406
by: Eric | last post by:
I want to have one statement in my web page that includes a single file (for example "Mylib.inc" that contains a list of ".js" files to include. Is that possible? And if so can some one show me the basic format to use? This would allow me to add and remove scripts from my pages without having to edit each page, only w3ouyld need to make a change in the MyLib.inc file I'm envisioning MyLib.inc to look something like this: <script...
1
1390
by: Elephant | last post by:
Hello, quesion, in a managed c++ class library I create a namespace ( MyNS ). In namespace a struct ( MyStruct) and a class ( MyClass ). public __value struct MyStruct{...}; public __gc class MyClass{...}; I get 2 errors that I don't understand:
0
1417
by: Jonathan Wilson | last post by:
acording to http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=oMoJFXNlDHA.2624%40cpmsftngxa06.phx.gbl one "Ed Dore" said "The VC libraries team is looking at getting more of the sources out with future releases though." Can someone from Microsoft explain A.if this is happening or not and B.why the source code in question is not included in the first place Checking my Visual Studio .NET 2003 folder, I can see the following non-open...
2
1396
by: Dan | last post by:
Hi - does anyone know if it's possible to install 2 versions of MSDN library? I recently installed MSDN 2005 Library for my VB.NET from my MSDN subscription, and now I noticed I don't have any more help in my VB6. I just figured MSDN 2005 would have all the help for prior versions of VB. Does having the Help in VB6 require an older version of MSDN, and if so, can more than one version be installed? Thanks a lot for any help - Dan
5
475
by: David T. Ashley | last post by:
I've occasionally had trouble compiling and linking programs that use shared libraries. That never made a lot of sense to me, because I thought the operating system went hunting for the symbols and libraries at runtime (and not before). Questions: a)How do the development tools know that a given symbol (a function entry point, for example) is located in a shared library and won't be linked in statically?
4
1495
by: Rainer Queck | last post by:
Hello NG, I started to build me a little class library. This library I added to a Project which also surves me to test the library. This library holds a namespace: namespace <myLib>.<some function> Now I added a extended Namespace to my library like: namespace <myLib>.<some other function>
2
1420
by: Paul Czubilinski | last post by:
Hello, Do you maybe know how to replace all the object content (with its <div id="x"and </div>) using Ajax.Updater class instead of inserting request inside it? Best regards, Paul Czubilinski
5
1510
by: Michael Press | last post by:
I already compiled and installed the GNU multiprecision library on Mac OS X, and link to it in C programs. How do I link to the library from Python? I do not want to download and install redundant material. (I am new to Python) -- Michael Press
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8148
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.