|
In my Windows Explorer, there are five viewing modes:
Miniature, Tiles, Symbols, List, Details, in that order.
The only view the selected icon doesn't get some kind of "overlayed" with the selection color is "Miniature". Instead, a frame in selection color is painted around the icon.
This view doesn't seem to be supported by ListView out of the box. But you could
- set View = System.Windows.Forms.View.Tile;
- set TileSize = YourPreferredTileSize;
- Set OwnerDraw = true;
- override OnDrawItem() and draw icons in whichever way you want them to appear.
(Inspired by http://www.tutorials.de/net-windows-forms/307597-c-explorer-listview-mit-miniaturansicht.html)
Ciao,
luker
|
|
|
|
|
hey people,
i still have a problem about how to moove from a DataTable full with csv Value to a multi-line chart.
The fact is,in my DataTable,i have many value of censor(in °C,KWh,Mwh..)and i want to represent for each censor value a multi-line chart,with Date and time in X Axis,and with two Y axis the Legend and value of censor.
i joined a sample of csv to fell my DataTable
that is the part of my code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using Microsoft.VisualBasic;
using System.Globalization;
using System.Drawing.Drawing2D;
using ZedGraph;
using System.Linq;
using System.Windows.Forms.Integration;
public DataTable BuildDataTable(string fileFullPath, char seperator)
{
const int EOF = -1;
DataTable myTable = new DataTable("MyTable");
DataRow myRow;
StreamReader myReader = new StreamReader(fileFullPath);
string Set_Data = myReader.ReadLine();
int Set_len = Set_Data.Length;
try
{
myReader = new StreamReader(fileFullPath);
}
catch (Exception ex)
{
MessageBox.Show("Fout bij openen bestand: " + ex.Message);
return new DataTable("Empty");
}
try
{
string[] fieldValues = new string[Set_len];
fieldValues = myReader.ReadLine().Split(new Char[] { seperator, '\t', });
for (int i = 0; i < fieldValues.Length; i++)
{
myTable.Columns.Add(new DataColumn(fieldValues[i].ToString().Trim()));
}
while (myReader.Peek() != EOF)
{
fieldValues = myReader.ReadLine().Split(new Char[] { seperator, '\t' });
myRow = myTable.NewRow();
for (int i = 0; i < fieldValues.Length; i++)
{
myRow[i] = fieldValues[i].ToString().Trim();
}
myTable.Rows.Add(myRow);
}
}
catch (Exception ex)
{
MessageBox.Show("Error building datatable: " + ex.Message);
return new DataTable("Empty");
}
finally
{
if (myReader != null)
{
myReader.Close();
}
}
myTable.AcceptChanges();
if (myReader != null)
{
myReader.Close();
}
dataGridView1.DataSource = myTable;
return myTable;
}
public void Proces_File()
{
char[] Separator = { ';', ':' };
String Choose_File;
DataTable DT;
OpenFD.InitialDirectory = "Y:\\";
OpenFD.Filter = "txt files(*.txt)|*.txt|All Files(*.*)|*.*";
OpenFD.FilterIndex = 2;
OpenFD.RestoreDirectory = true;
if (OpenFD.ShowDialog() != DialogResult.Cancel)
{
Choose_File = OpenFD.FileName;
richTextBox1.LoadFile(Choose_File, RichTextBoxStreamType.PlainText);
DT = BuildDataTable(OpenFD.FileName, ';');
this.dataGridView1.DataSource = DT;
}
private void button3_Click(object sender, EventArgs e)
{
Proces_File();
}
thx in advance
|
|
|
|
|
What is your problem? There is no graph related code in that sample at all.
|
|
|
|
|
That is my Problem,a want to get vlue in my DataTAble als Point for a multi line chart,but i don´t know how to do it
|
|
|
|
|
So basically you want someone to solve your entire problem for you? That's not how CodeProject works. Go away and read the documentation for the chart control you are trying to use (looks like ZedGraph) and work out how to do it. And learn how to type while you're at it ... a typo here or there will happen but your posts read like you just don't care.
|
|
|
|
|
don´t misinterpret the way i try to expose my Problem, i am not looking for somebody who can make the work for me,but i am here because i hope that may be somebody can have the answer of my unsolved questions by the way you (may be not ) so about the use a Zedgraph i have a powerful documentation,and i try to make practicaly sample to understand Functionment of that tools
hier is a part of my code where i take the values(contain) in a DataTable in a List and try to Buuild Point for my Chart,just look about it please and tell me what is wrong.
thx
public void ADD_Chart_Style( ZedGraphControl ZGC, DataTable My_DT)
{
Graphics G= this.CreateGraphics() ;
DataRow Dat_Row;
DataColumn Dat_Colm;
int Index = 0;
List<DateTime> XDate = new List<DateTime>();
List<double> Value = new List<double>();
List<DataRow> My_Ro_List = new List<DataRow>();
foreach (DataRow My_DT_Rows in My_DT.Rows)
{
My_Ro_List.Add(My_DT_Rows);
foreach (var item in My_DT_Rows.ItemArray)
Value.Add(Convert.ToDouble(item));
}
String Temp = "Date";
var Result = My_DT.AsEnumerable();
foreach (var result in My_DT.Columns)
{
XDate.Add(Convert.ToDateTime(My_DT.Columns.IndexOf("Date")));
}
List<DataColumn> My_C_List = new List<DataColumn>();
foreach (DataColumn MY_DT_COL in My_DT.Columns)
{
My_C_List.Add(MY_DT_COL);
}
int len = My_DT.Columns.IndexOf("Date");
DateTime[] X_ValData = new DateTime[len];
PointPairList List1 = new PointPairList();
for (int i = 0; i < My_DT.Rows.Count; i++)
{
List1.Add(Convert.ToDouble(XDate[i]), Convert.ToDouble(Value));
X_ValData[i] = XDate[i];
for (int j = 0; j < My_DT.Columns.Count; j++)
{
ZGC.MasterPane.PaneList.Clear();
GraphPane My_pane = new GraphPane();
My_pane.CurveList.Clear();
My_pane.GraphObjList.Clear();
ZGC.GraphPane = My_pane;
My_pane.Title.Text = "Auswerte Software Version 1.0";
My_pane.Title.FontSpec.Size = 14;
My_pane.XAxis.Title.Text = "DATE/Hour/Minutes";
My_pane.YAxis.Title.Text = "Value";
My_pane.Fill = new Fill(Color.White, Color.FromArgb(220,220,255),45F);
LineItem My_Curve = new LineItem("" , List1 , Color.DarkBlue , SymbolType.Diamond);
My_Curve.Symbol.Size = 6;
My_Curve.Symbol.Fill.Color = Color.DarkBlue;
My_Curve.Symbol.Fill.IsVisible = true;
My_Curve.Line.IsVisible = false;
My_pane.CurveList.Add(My_Curve);
My_pane.AxisChange();
}
using (Graphics g = this.CreateGraphics())
{
ZGC.MasterPane.ReSize(g, ZGC.MasterPane.Rect);
}
ZGC.Invalidate();
in my Form this
ZedGraphControl My_ZGC = new ZedGraphControl();
private void Form1_Load(object sender, EventArgs e)
{
string Use_Path = OpenFD.FileName;
DataTable MY_D = new DataTable();
MY_D = BuildDataTable( Use_Path, ';');
Cs.ADD_Chart_Style( My_ZGC, MY_D);
}
public void Set_SiZe()
{
My_ZGC.Location = new Point(10,10);
My_ZGC.Size = new Size(this.ClientRectangle.Width - 20,this.ClientRectangle.Height - 20);
}
public void Graph_load()
{
Form new_F = new Form();
new_F.Controls.Add(My_ZGC);
new_F.ShowDialog();
}
|
|
|
|
|
did someboy have a answer of my question please????
|
|
|
|
|
Hi,
Kindly let me know that, How may I get the name of Windows Operation system using C#?
Actually I want to know that, what windows is being used.
Example:
Windows XP
or
Windows Server 2003
or
Windows Server 2008
or
Windows Vista
or
Windows 7
Thank you
(Riaz)
|
|
|
|
|
You need to use the OSVersion Property of the System.Environment Class. Here is an MSDN article on how to do it How to determine the Windows version by using Visual C#[^]. (Hint - it was the first hit in a Google search).
Hope this helps
...and I have extensive experience writing computer code, including OIC, BTW, BRB, IMHO, LMAO, ROFL, TTYL.....
|
|
|
|
|
|
Good Evening All
i have a Function in my DataLayer that is defined like this
public bool SynchProductsCategoryToCBD(IList<EcashProductCatModel> model)
{
con = new SqlConnection(strCon);
cmdinsert = new SqlCommand("sp_AddProductCategory");
cmdinsert.CommandType = CommandType.StoredProcedure;
cmdinsert.Connection = con;
bool Error = false;
try
{
con.Open();
foreach (EcashProductCatModel ecash in model)
{
cmdinsert.Parameters.Add("@CATEGORY_ID", SqlDbType.Int).Value = ecash.CATEGORY_ID;
cmdinsert.Parameters.Add("@CATEGORY_DESCRIPTION", SqlDbType.VarChar).Value = ecash.CATEGORY_DESCRIPTION;
cmdinsert.Parameters.Add("@SCHOOLID", SqlDbType.Int).Value = ecash.SCHOOLID;
cmdinsert.ExecuteNonQuery();
}
Error = true;
}
catch (Exception ex)
{
Logger.LoggerClient logger = new Logger.LoggerClient();
Logger.LoggerModel models = new Logger.LoggerModel();
models.iTYPEID = Convert.ToInt32(GenericEnum.Logging_Type.ECASH_SYCH);
models.sLOGGER_CLASS = "eCashDatalayer";
models.sLOGGER_DESCRIPTION = ex.Message;
models.sLOGGER_FUNCTION = "SynchProductsCategoryToCBD";
models.sLOGGER_LOGGEDINUSERID = "";
models.sLOGGER_PAGE = "NA";
models.sLOGGER_VALUE = "NA";
logger.LogIncident(models);
}
finally
{
con.Close();
}
return Error;
}
and i pass the List of objects, i have inspected the list and it contains valid values and i had 13 records , but in the database i get only 1 record
What is it that i am doing wrong ?
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Well, one thing you're doing wrong is that you fail to clear the SqlCommand.Parameters collection between stored proc calls. Just add this line at the top of your foreach loop:
cmdInsert.Parameters.Clear();
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
hi John
thanks reply, that did not work either.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Are you getting an exception?
Have you stepped through the code and seen how many times that foreach actually loops?
|
|
|
|
|
i have change it to look like this
foreach (EcashProductCatModel ecash in model)
{
using (var cmdinsert = new SqlCommand("sp_AddProductCategory", con))
{
cmdinsert.CommandType = CommandType.StoredProcedure;
cmdinsert.Parameters.Add("@CATEGORY_ID", SqlDbType.Int).Value = ecash.CATEGORY_ID;
cmdinsert.Parameters.Add("@CATEGORY_DESCRIPTION", SqlDbType.VarChar).Value =
ecash.CATEGORY_DESCRIPTION;
cmdinsert.Parameters.Add("@SCHOOLID", SqlDbType.Int).Value = ecash.SCHOOLID;
cmdinsert.ExecuteNonQuery();
}
}
and its working perfectly
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
The right way is to add the parameters once and set the values each time through the loop.
Create Command
Create and add parameters
Loop
{
Set parameter values
Execute Command
}
|
|
|
|
|
Hi,
I want to display the output of LM35 temperature sesnor on PC in C# but i cannot find the source code for that in C#. Can any one help me?? I am not using any kind of microcontroller.
|
|
|
|
|
Hmm,
From the datasheet you already know that the LM35's output is a voltage increasing by 10mv/degree and it will need connecting to an ADC, as a direct PC connection is not possible. The PC interface, both hardware and software, will be to the ADC.
Alan.
|
|
|
|
|
Yes i have connected it with ADC0804 and did interfacing via parallel port. But i dont know how to display the values on pc.
|
|
|
|
|
1. Read the data from the device
2. Format it into the form that you (or your users) want
3. Write it to the screen
Which of these methods are you having trouble with?
The best things in life are not things.
|
|
|
|
|
I am trying to read the data in C and is giving zero ouput. What does this mean?? Is the power suply not properly given??
|
|
|
|
|
aeman wrote: I am trying to read the data in C and is giving zero ouput. What does this mean?? Is the power suply not properly given??
How can I guess? I have no idea how you have connected this device, whether it is powered on, whether it is working correctly, what sort of commands you send to it, or what responses you receive back. You will have to do some debugging for yourself in order to give us some more information.
The best things in life are not things.
|
|
|
|
|
What's an "LM35 temperature sesnor"?
|
|
|
|
|
|
Quite. Perhaps you could try that for C# code to interface with the parallel port.
|
|
|
|