|
if you know the file type, the easiest way is use Directory.GetFiles(path, "*.ext"); it will return a string array, you can get the file count using Properties of Length
|
|
|
|
|
Thank you so much.
As I said before, I am on this like you can't believe.
|
|
|
|
|
Then you can use System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders(); to get all supported image format, or you could create your own image format array to loop the extension as I mention(and what you did).
|
|
|
|
|
You people are great!
I have solved much of the program's display requirements... thanks to all of your assistance and pointers.
|
|
|
|
|
You can use DirectoryInfo to get all files in a specific folder, you can also get it to only return files with specific file extensions, so look up how to use directoryinfo, and start making a list of all the file extensions that your image files have.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Thank you so much.
I'm gonna be all over this like a fat kid on candy.
|
|
|
|
|
I store path of images in Sql Server Database.Now I want to display those images to DataList.How can I do that ?
nothing
|
|
|
|
|
Make the DataList use a second DataTable as the source for its info, instead of the one you read in from the DB. Note that I did not use a compiler to write this, so you will need to modify it as needed, but I think the logic should work.
// Assume the other dataTable is called "original"
// Perform this op as soon as you read the data from the DB
DataTable dt = new DataTable();
foreach (DataColumn dc in original.Columns) {
if (dc.Name == "WhateverYouCallTheImageColumn") {
dt.Columns.Add(new DataColumn(dc.Name, typeof(Bitmap)));
} else {
dt.Columns.Add(new DataColumn(dc.Name, dc.Type));
}
}
foreach (DataRow dr in original.Rows) {
DataRow newRow = new DataRow();
foreach (DataColumn dc in original.Columns) {
// populate newRow, opening the images when you arrive at that column
}
dt.AddRow(newRow);
}
DataView dv = new DataView(dt);
Jeff
|
|
|
|
|
I'm looking for any insight on how to modify the summary information of a file (title, subject, author etc.). I've looked through System.IO and can't seem to find anything that will do this. I want to do this for any type of file (primarily office docs and pdfs), so dsofile doesn't quite do the trick.
Thanks
|
|
|
|
|
This information (for office documents) is actually stored in OLE Structured Storage (as part of the file). The only way to modify this would be to either access the file direct or to use COM Interop with the Office applications.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I can modify all of the properties for office docs using the dsofile.dll which isn't a problem. Is there a generic way to modify the file summary for any type of document, not just office docs?
|
|
|
|
|
I'm sure I just pointed out that the summary was stored in the file itself - i.e. wasn't easily accessible metadata. So, no. Different files types have their own ways of storing this information.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
File.SetCreationTime(); That kind of stuff?
Nevermind. I see you were talking about author, description, etc
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
|
Hi!
Is it possible to change the font in a console application?
Like iif I have a game where I pick up a megaphone, and want to have a webbding character that happens to look just like a megaphone. Is this possible?
thanks Daniel
Dan Steeve
|
|
|
|
|
Hi Dan,
I once did color changes on a Console app, that took some P/Invoke using the following
prototypes and definitions:
[DllImport("kernel32.dll")]
public static extern bool SetConsoleCtrlHandler(ConsoleControlHandler e, bool add);
[DllImport("kernel32.dll")]
public static extern IntPtr GetStdHandle(int nStdHandle);
[DllImport("kernel32.dll")]
public static extern bool SetConsoleTextAttribute(IntPtr windowHandle, int attrib);
[DllImport("KERNEL32.DLL")]
internal static extern int GetConsoleScreenBufferInfo (IntPtr hConsoleOutput,
ref CONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
public delegate bool ConsoleControlHandler(ConsoleControlEvent consoleEvent);
public enum ConsoleControlEvent {
CtrlC=0,
CtrlBreak=1,
CtrlClose=2,
CtrlLogoff=5,
CtrlShutdown=6}
public enum TextColor {
Black=0,
DarkBlue=1,
DarkGreen=2,
Brown=4,
DarkMagenta=5,
DarkYellow=6,
Gray=7,
Blue=9,
Green=10,
Cyan=11,
Red=12,
Magenta=13,
Yellow=14,
White=15,
Unknown=16
}
This should get you going.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Pssst, in the 2.0 Framework they added Console.BackgroundColor and Console.ForegroundColor. And there's an enum for ConsoleColor.
|
|
|
|
|
Well that is nice to know, thanks. If only they had provided that in time...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
As far as I know, the only fonts allowed for Consoles is controlled by the following registry entry.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont
Once the font has been added there, a reboot is required. But then, I have no clue how you actually change the font being used, but there's gotta be a Win32 API call somewhere you can p/invoke. I think Luc's examples might help you locate that.
Also, in the registry entry, it's not logical because the entry you're likely to see is:
0 REG_SZ Lucinda Console
You'd think oh, I just need to add:
1 REG_SZ Consolas
Nope, WRONG! You would add
00 REG_SZ Consolas
and a third one would be:
000 REG_SZ Courier
Yep, real intuitive.
|
|
|
|
|
Dear Sir,
I am facing one problem in DataGrid. i want to add many columns in DataGrid at runtime .because this is requirement of our applcation. i want to add around 25000 columns at runtime. but when i add columns at run time, application hang up or it will taking much much time to add columns in DataGrid. so any one suggest me the best solution of display 25000 columns in DataGrid
|
|
|
|
|
Do you mean 25,000 ROWS? I can't think of any reason a table would need 25,000 columns.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
No sir, i mean 25000 columns . it is req. of our software
|
|
|
|
|
aloktambi wrote: No sir, i mean 25000 columns . it is req. of our software
Wow. That sounds very messy. If you don't mind explaining, why is this a requirement? What circumstances force this, and what is the usage of the table?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Sir,
In our software, we want to show peak information to user,
No of Columns for General Info = 7 (Constant)
No of Columns for Injection Info = 22 (Constant)
No of Fixed Column(s) for Peak Info = 1(Constant) //It is for Peak Area Sum.
Total No of Columns for N Peaks: N x (13 + 2 x N)
Hence total Number of Columns in Datagrid in case of N Peaks
= 1(Separator) + 7 + 1(Separator) + 22 + 1(Separator) + 1 + N(13+2N)
= 2xNxN + 13xN + 33
Hence Number of Columns in the Datagrid increase as a 2nd Degree Equation.
This means
For 10 peaks Column Count will be 363
For 25 peaks Column Count will be 1608
For 50 peaks Column Count will be 5683
For 100 peaks Column Count will be 21333
For 150 peaks Column Count will be 46983
For 200 peaks Column Count will be 82633
|
|
|
|
|
Well that is interesting. I can't think of any way to create 25,000 columns in a fast way(like can be done with SQLBulkCopy for rows). Good luck though!
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|