Hello!
Can someone help me, please? It's 6am, I don't have concentration,
feel desperate and I have a deadLine for my project (exam at my
university)..
How can I display ListView onMouse Click event?
Let's say that I just need a detailed view of columnHeaders. Somewhere
in my code there is already prepared array:
ArrayOfCharacte rs - definition of the columns of my ListView.
This is something I've done so far (I call function DrawTable
onMouseClick event):
public class GenDKA : System.Windows. Forms.UserContr ol
private System.Windows. Forms.ListView listViewDKA;
[... <cut> ...]
protected override void Dispose (bool disposing)
{
if (disposing)
{
if(components != null)
{
components.Disp ose();
}
}
base.Dispose (disposing);
}
private void InitializeCompo nent()
{
this.Name = "GenDKA";
this.Size = new System.Drawing. Size(504, 248);
this.listViewDK A = new System.Windows. Forms.ListView( );
this.listViewDK A.GridLines = true;
this.listViewDK A.HeaderStyle =
System.Windows. Forms.ColumnHea derStyle.Noncli ckable;
this.listViewDK A.Location = new System.Drawing. Point(8, 8);
this.listViewDK A.Name = "listViewDK A";
this.listViewDK A.Size = new System.Drawing. Size(488, 232);
this.listViewDK A.TabIndex = 0;
this.listViewDK A.View = System.Windows. Forms.View.Deta ils;
}
public void DrawTable()
{
ListView listViewDKA = new ListView();
listViewDKA.Ite ms.Clear();
ListViewItem item = new ListViewItem("N ewItem");
item.UseItemSty leForSubItems = false;
for (int i = 0; i < ArrayOfCharacte rs.Count; i++)
{
MessageBox.Show (ArrayOfCharact ers[i].ToString());
listViewDKA.Col umns.Add(new ColumnHeader()) ;
listViewDKA.Col umns[i].Text = ArrayOfCharacte rs[i].ToString();
listViewDKA.Col umns[i].Width = 25;
}
listViewDKA.Vie w = View.Details;
this.Controls.A dd(listViewDKA) ;
}
public GenDKA()
{
InitializeCompo nent();
}
} 2 4194
I think you are forgetting to set the event.
I am not sure what the MouseClick looks like at the moment but this is how
the ColumnClick would jook like.
Add it to your Methedos InitializeCompo nent() and DrawTable
listViewListen. ColumnClick += new
System.Windows. Forms.ColumnCli ckEventHandler( this.DrawTable) ;
Hope this helps
Mark Johnson, Berlin Germany mj*****@mj10777 .de
"Mad Joe" <jo*@net.hr> schrieb im Newsbeitrag
news:66******** *************** **@posting.goog le.com... Hello!
Can someone help me, please? It's 6am, I don't have concentration, feel desperate and I have a deadLine for my project (exam at my university)..
How can I display ListView onMouse Click event?
Let's say that I just need a detailed view of columnHeaders. Somewhere in my code there is already prepared array:
ArrayOfCharacte rs - definition of the columns of my ListView.
This is something I've done so far (I call function DrawTable onMouseClick event):
public class GenDKA : System.Windows. Forms.UserContr ol
private System.Windows. Forms.ListView listViewDKA;
[... <cut> ...]
protected override void Dispose (bool disposing) { if (disposing) { if(components != null) { components.Disp ose(); } } base.Dispose (disposing); }
private void InitializeCompo nent() { this.Name = "GenDKA"; this.Size = new System.Drawing. Size(504, 248); this.listViewDK A = new System.Windows. Forms.ListView( );
this.listViewDK A.GridLines = true; this.listViewDK A.HeaderStyle = System.Windows. Forms.ColumnHea derStyle.Noncli ckable; this.listViewDK A.Location = new System.Drawing. Point(8, 8); this.listViewDK A.Name = "listViewDK A"; this.listViewDK A.Size = new System.Drawing. Size(488, 232); this.listViewDK A.TabIndex = 0; this.listViewDK A.View = System.Windows. Forms.View.Deta ils; }
public void DrawTable() { ListView listViewDKA = new ListView();
listViewDKA.Ite ms.Clear(); ListViewItem item = new ListViewItem("N ewItem"); item.UseItemSty leForSubItems = false;
for (int i = 0; i < ArrayOfCharacte rs.Count; i++) { MessageBox.Show (ArrayOfCharact ers[i].ToString()); listViewDKA.Col umns.Add(new ColumnHeader()) ; listViewDKA.Col umns[i].Text = ArrayOfCharacte rs[i].ToString(); listViewDKA.Col umns[i].Width = 25; } listViewDKA.Vie w = View.Details; this.Controls.A dd(listViewDKA) ; }
public GenDKA() { InitializeCompo nent(); }
}
Thank you Mark!
I solved the problem the next morning. I guess that for this mistake I
could blame my lack of sleep... Thanks anyway! :)
Joe
"Mark Johnson" <mj*****@mj1077 7.de> wrote in message news:<3f******* *************** *@newsread2.arc or-online.net>... I think you are forgetting to set the event. I am not sure what the MouseClick looks like at the moment but this is how the ColumnClick would jook like. Add it to your Methedos InitializeCompo nent() and DrawTable listViewListen. ColumnClick += new System.Windows. Forms.ColumnCli ckEventHandler( this.DrawTable) ;
Hope this helps Mark Johnson, Berlin Germany mj*****@mj10777 .de This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tee |
last post by:
Hi,
I have a listview control that has a column displaying path.
I need to change the StringTrimming of text in this column to
StringTrimming.EllipsisPath, but there is no paint event available for
ListView control, anyone know how can I achieve that?
Thanks,
Tee
|
by: Danny |
last post by:
I have this code below to do a rollover image. IT doesnt work with the
onmouseclick event. But it wil lwork fine with the onmouseover so when the
user hovers over the image, the main image changes. I am trying to do an
onmouseclick event so when the user clicks on the link, it will change the
main image, but it doesnt work. What can I do?
<img name="rollover" src="/images/image1.jpg" border=0 width="200"
height="300" >
<a href...
|
by: andrewcw |
last post by:
I have a simple winform with the following code.
But although I can read back the info, the display fails
to provide the text or the cell background color changes.
private void ListViewBroke()
{
listView.View = View.Details;
ArrayList LVcolTitles= new ArrayList();
LVcolTitles.Add("Drive");
LVcolTitles.Add("Cust");
|
by: andrewcw |
last post by:
The clcik event on the ListView control seems to trigger
off the item level ( the first column ). I would like to
be able to trap the click event on a particular subitem (
a specific column's row ). If possible, what do I do to
activate that 'cell' - thanks.
I thought that listView.LabelEdit = true; would enable me
to navigate into the cells or something like listView.items
.subitems.LabelEdit - but I did not see such
a property....
|
by: PeacError |
last post by:
Using Microsoft Visual Studio .NET 2003, Visual C# .NET 1.1:
I apologize if this question has been addressed elsewhere, but I could not
find a reference to it in the search engine for this board.
I have a form that contains a ListView and a GroupBox control. The GroupBox
control itself contains several TextBox Controls. I have Validating and
Validated event handlers set for the GroupBox control, and a
SelectedIndexChanged event...
| |
by: amber |
last post by:
Hello
I have a listview that displays a list of choices
When the mouse moves over each item, I would like text (the name of the item that is being hovered over) to show u
in a seperate label or textbox
How do I set this
Thanks
Ambe
|
by: Peter |
last post by:
Hi,
I have a problem with Listview using checkboxes.
If i check items by code BEFORE the form is shown the Listview.Items
are confused during the ItemChecked Event !!!
After showing the form every thing works fine: checking items by code
as well as checking with mouse:
Using the CheckdItems Property is confused too.
|
by: Peter |
last post by:
Hi,
I have a problem with Listview using checkboxes.
If i check items by code BEFORE the form is shown the Listview.Items
are confused during the ItemChecked Event !!!
After showing the form every thing works fine: checking items by code
|
by: phpfreak2007 |
last post by:
Hello All,,,
I am using Following code to change the back color of list view. I don't want the Windows default gray color when Listview is Enable false.so I have crated one class by inheriting the ListView and override some method. OnEnableChange event i just call Refresh. so it paint the background with the color i specified. and in column click event i am sorting the column.. when i click on the column header back color change to widows...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |