|
Hi everyone.
I'm working on an application that displays files with name and path ++ in a DataGrid.
One day I came over a ListView project on the inet that could show images / icons + text in one column,
so I started working on my own DataGridColumnStyle to try and achieve the same result.
Only problem is that its really cpu-consuming when it retrieves the images and displays them.
In my custom columnstyle paint method I retrieve the filname,
then I extract the extension from the filename, look up extension in
Registry to find default application, and at last I get the path to the default Icon file.
Finally, I can extract the icon using
hImgSmall = Win32.SHGetFileInfo(filePath, 0, ref shinfo,
(uint)Marshal.SizeOf(shinfo),
Win32.SHGFI_ICON |
Win32.SHGFI_SMALLICON);
I was wondering if anyone has been working with anything similiar and that might have some hints/tips
as how to make this less cpu consuming. Maybe a more efficient way of locating the icons.
I recon all the "lookups" in registry is what makes this so slow.
Might help with double-buffering too? The images and text are drawn to the screen. :S
-Larantz-
|
|
|
|
|
I haven't tried anything like what you are doing, but one thought struck me. Are you looking up a lot of files with the same extension? If so could you maintain your own list of icons using the extension as a key (maybe the dictonary class would be good for this?) so that you only need to look in the registry the first time you encounter an extension? That would cut down on keep having to recreate the same icon.
The procedure would be something like this:
1) Get extension from filename
2) Look in my list to see if I already have a bitmap
3) If I already have it, use it and we're done
4) If we don't have it look it up in the registry and add it to our list
|
|
|
|
|
Thx for the tip.
I've been thinking about something like that too. I'll try and implement it
at work tomorrow.
Still on the lookout for more efficient ways of retrieving icons if anyone
has a tip.
-Larantz-
|
|
|
|
|
I implemented iconbuffering now but it still flicks and takes up resources.
I'll try with double-buffering. That should atleast take care of the flickering.
When it comes to resources, maybe I can't improve that considering the fact that it's many paint operations.
-Larantz-
|
|
|
|
|
Hi all.
Can any one help me about implementing an "access control system" on windows applications.
rezaey
|
|
|
|
|
Hey, I know this is for XML\XSL forum but they don't answer there....
I'm just wondering what is the difference between those two.
And what command is to read the DATA in DataSet:
ds.ReadXml() or ds.ReadXmlSchema()
and the same for writing...
|
|
|
|
|
the xml is the file where the data is stored. the xsl is the style sheet...to make the xml file's data display nicely. the xml file determines what the display type is going to be like HTML or in my Case PDF
He who laughs last...
|
|
|
|
|
Hi NaNg15241.
If u want to know difference between XML XSL I can tell that XSL defines structrue of a XML file without data.On the other word XSL is similare to table difinition in database and XML is similare to a table with it's data.
|
|
|
|
|
Wow, talk about a topic that takes up complete books...;)
XML - eXtensible Markup Language is primarily a way to "markup" or present a TEXT file as data. It is important that you realize that at its core it is nothing but a text file, and therefore easily passes through firewalls. It is a VERY easy way to get DATA from one place to another, and is especially nice since it doesn't care anything about the platform it ends up on.
XSL - eXtensible Stylesheet Language for Transformation (you may also see it as XSLT) is a way to manipulate the XML files. For instance you might want to present the data in a different sequence, or Transform some of the XML nodes
<name>John Smith</name> can become
<name>
<firstname>John</firstname>
<lastname>Smith</lastname>
</name>
Also, XSL files, are themselves XML files.
That is a VERY high level explanation.
As for your code lines, ds.ReadXml()reads an XML file, the ds.ReadXmlSchema() is for reading a Schema file or an XSD file that defines the structure of the XML data you will be reading.
HTH
WhiteWizard (aka Gandalf)
-- modified at 10:10 Tuesday 30th May, 2006
|
|
|
|
|
XML stands for Extensible Markup Lauguage. This language is used to create your own markup langauge like HTML. In other words xml is used to structure a document. A structured document can be easily written to or read from some persistent storage or to exchange to or from some remote location.
< br />
Schema is used to define rules for a document validity. If you want your xml document user how use its elements you create a DTD or SCHEMA for this purpose.
< br />
XSL stands for extensible stylesheet language. An xsl file provides information to a web browser or some other application how to interpret the xml document. This is just like CSS that instructs web browser how to interpret your document.
< br />
ReadXml() reads data from an xml file.
< br />
ReadXmlSchema() reads schema information from an xml file.
< br />Both xml and schema files have .xml extension.
Abdul Rahman [Peshawar]
|
|
|
|
|
So from all this, What stores Data ( this is all very confusing [ english is not my main language ] ) and what commands\Things do I need to do\use?
XSL\XML, ReadXml or ReadXmlSchema, WriteXml or WriteXmlSchema, what do I need to do for Data?
and if can any-one help me also about the topic I wrote down a few msgs (Unique ID) will help me so much more...
-- modified at 10:29 Tuesday 30th May, 2006
|
|
|
|
|
|
I am trying to implement standard multi-select of rows in a datagrid. That is, allow the user to use the CTRL & SHIFT keys to select multiple rows in a datagrid. Then I'll loop through them and process the selected rows.
The problem is that the KEY events don't seem to be firing on the datagrid. When I just click on a column of the datagrid, and then press a key, the events fire. However, when I use the above keys and select some rows, the KeyUp event does NOT fire. I've tried the KeyPress event as well, and it does not fire either. The mouse events fire, but not the Key events. Does anyone know if this is a bug, or feature?
By the way I've tried this in both VS2003 and VS2005.
|
|
|
|
|
Hi,
I am developing an AddIn which is handling Cut,Copy,Paste commands of IDE(VS.Net 2003).
Although AddIn works fine but if I keep on pressing Ctrl +v it silently dissociates itself from IDE and IDE starts handling all trapped commands.
As per my understanding when cursor crosses a particular limit while pasting data and after that if there is a new Ctrl + V, AddIn stops without calling OnDiscoonection().
Kindly help me .
Ruhina
|
|
|
|
|
what is wrong with the query below ?
OleDbDataAdapter adp10 = new OleDbDataAdapter("Select case,dailycase From caseinfo where case>='" + txtcasestart.Text + "', case<='" + txtcasefinish.Text + "' and startdate >='" + txtstartdate.Text + "' and enddate <='" + txtenddate.Text + "'", conn);
it gives comma error ?
and one more question ? do i have to convert to txtstartdate and txtenddate to datetime to compare date values ?
thanks in advance,
bye.
|
|
|
|
|
hmmm... First of all I should say "next time try the SQL\ADO\ADO.NET forum", they know SQL queries better...
Butttt... I can help here (I think).
Second of all, If it's a DateTimePicker it's not Text, it's Value (Properties).
Third of all, in SQL queries ' does NOT stand for DATE!!! # <- this stand for Date! try switching them in the right places. this should work now.
And 4th of all, the # will convert them, don't forget to put in the start AND in the end... i.e: and startdate >='" + txtstartdate.Text + "' -> and startdate >= #" + txtstartdate.Text + "#
Good Luck...
NaNg
|
|
|
|
|
NaNg15241 wrote: Third of all, in SQL queries ' does NOT stand for DATE!!!
Yes, it does. Exclamation mark. The SQL standard uses apostrophes around dates. Exclamation mark. Exclamation mark. Exclamation mark. Exclamation mark. Exclamation mark. Exclamation mark.
The exception is the Access database, that uses the # character instead.
NaNg15241 wrote: And 4th of all, the # will convert them, don't forget to put in the start AND in the end... i.e: and startdate >='" + txtstartdate.Text + "' -> and startdate >= #" + txtstartdate.Text + "#
Do you really expect anyone who doesn't already know what the problem is to understand that?
---
b { font-weight: normal; }
|
|
|
|
|
Not sure, but I think the problem is at the beginning of your where clause:
where case>='" + txtcasestart.Text + "' AND case<='" + txtcasefinish.Text
Anyway, I think you should also take a look at this article: SQL Injection Attacks and Some Tips on How to Prevent Them[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
OleDbDataAdapter adp10 = new OleDbDataAdapter("Select case,dailycase From caseinfo where case>='" + txtcasestart.Text + "', and case<='" + txtcasefinish.Text + "' and startdate >='" + txtstartdate.Text + "' and enddate <='" + txtenddate.Text + "'", conn);
|
|
|
|
|
Hi all,
Sorry Code project. I'm posting yet another question. I just cant get past this problem...
I'm trying to get this command executed in cmd through C#.
The command needs to be in Quotation marks like this when it gets sent to cmd...
"c:\Program files\progressive projects\progress\reporttemplates\fop.bat" -xml "c:\program files\progressive projects\progress\reporttemplates\ClientRecordCard.xml" -xsl "c:\Program files\progressive projects\progress\reporttemplates\ClientRecordCardHairFo-pdf.xsl" -pdf "c:\Reports\ClientRecordCard.pdf"
my code looks like this
The TempPath And TempName
TempPath = c:\program files\progressive projects\progress\reporttemplates
TempName = ClientRecordCardHairFo-Pdf
startInfo.Arguments = "/C " + "\"" + @Convert.ToString(TempPath) + "\\fop.bat" + "\"" + " -xml" + "\"" + @Convert.ToString(TempPath) + "\\ClientRecordCard.xml" + "\"" + " -xsl" + "\"" + @Convert.ToString(TempPath) + "\\" + @Convert.ToString(TempName) + ".xsl" + "\"" + " -pdf" + "\"" + @Convert.ToString(Salon.Library.GlobalVariables.Reports_Path) + "\\ClientRecordCard.pdf" + "\"";
my logic tells me that it should work but i get an error saying "'c:\Program' not recognized as an internal or external command, operable program or batch file.
He who laughs last...
|
|
|
|
|
it is as if the Quotes aren't in the right place in my code...
not opening and closing on the right places if you understand what i mean.
He who laughs last...
|
|
|
|
|
You are corecct!!! (Ding Ding Ding Ding Ding!!!) I fixed your qouts in my post here.
|
|
|
|
|
well as I see you don't leave spaces and don't put everything in it's place... (and there are alot of things that could be shorten...)
try this:
startInfo.Arguments = "\"" + @Convert.ToString(TempPath) + "\\fop.bat\" -xml \"" + @Convert.ToString(TempPath) + "\\ClientRecordCard.xml\" -xsl \"" + @Convert.ToString(TempPath) + "\\" + @Convert.ToString(TempName) + ".xsl\" -pdf \"" + @Convert.ToString(Salon.Library.GlobalVariables.Reports_Path) + "\\ClientRecordCard.pdf\"";
this SHOULD work, but I don't promis you cuz I don't realy know what you after here.
NaNg.
|
|
|
|
|
thank you, ill give it a go.
He who laughs last...
|
|
|
|
|