|
Did you check out this[^]?
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
can somebody please tell me what is wrong with the code below i am trying to conver some single page tif's images to group 4 compression the original format was LZW
string dir = args.Length>1 ? args[0]: System.IO.Directory.GetCurrentDirectory();
dir = @"C:\Documents and Settings\caiena\Desktop\mail out DEQ\form";
string outdir= args.Length>2 ? args[1] : dir+"\\processed";
if(!System.IO.Directory.Exists(outdir))
System.IO.Directory.CreateDirectory(outdir);
string[] files = System.IO.Directory.GetFiles(dir, "*.tif");
System.Console.WriteLine("input dir {0}", dir);
System.Console.WriteLine("Processed dir {0}", outdir);
System.Drawing.Imaging.Encoder enc = System.Drawing.Imaging.Encoder.Compression;
EncoderParameters ep = new EncoderParameters(1);
ImageCodecInfo info = GetEncoderInfo("image/tiff");
ep.Param[0] = new EncoderParameter(enc, (long) System.Drawing.Imaging.EncoderValue.CompressionCCITT4);
foreach (string file in files)
{
System.IO.FileInfo fi = new System.IO.FileInfo(file);
using (System.Drawing.Image img = System.Drawing.Image.FromFile(fi.FullName))
{
System.Console.WriteLine("converting file {0}", outdir + fi.Name);
img.Save(outdir+ fi.Name, info, ep);
}
}
-- modified at 16:53 Monday 8th October, 2007
Thanks,
Chad Aiena
|
|
|
|
|
There is some vital information missing in your post.
Why do you think that there is something wrong with the code? Do you get an error message? Doesn't it do what you expect, and if so, what do you expect, and how does that differ from what you get?
---
single minded; short sighted; long gone;
|
|
|
|
|
i get an error saying invalid parameter on the save line
Thanks,
Chad Aiena
|
|
|
|
|
Can anyone tell me how to compare two objects by testing if they are the same type?
I know this doesn't work but I wish it would work like this:
private bool ActivateForm(Form form)
{
bool formIsOpen = false;
//loop through child forms to see if the form is already open
foreach (Form childForm in this.MdiChildren)
{
//if the childForm is the parameter type, activate it and break the loop
if (childForm.Type == form.Type)
{
childForm.Activate();
formIsOpen = true;
break;
}
}
return formIsOpen;
}
Lester
http://www.lestersconyers.com
|
|
|
|
|
lsconyer wrote: I know this doesn't work but I wish it would work like this:
You know what I wish? I wish it would work like this:
Abbra Kadabra *waving hands*
But I guess since it doesn't I will continue to Read Documentation and study Best Practices and Software Design Patterns etc.
|
|
|
|
|
lsconyer wrote: if (childForm.Type == form.Type)
if (childForm is Form) will succeed when childForm is a Form, which it is due
to the foreach loop.
if (childForm is Form1) will only succeed for those childForms that are also Form1,
derived from Form.
And also have a look at the "as" keyword!
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
|
|
|
|
|
*cough* use GetType() * cough *. Could I suggest that you also look at converting this to a generic method:
private bool ActivateForm<T>(T form) where T : Form
{
bool isOpen = false;
int i = 0;
do
{
if (MdiChildren[i].GetType() == typeof(T))
{
MdiChildren[i].Activate();
isOpen = true;
}
} while (!isOpen && i++ < this.MdiChildren.Count);
return isOpen
} I you really want to learn some more advanced .NET, you could look at modifying this to use anonymous methods.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi
Try using the GetType() method
instead of the Type keyword in your code
|
|
|
|
|
Hi guys,
I am totally stuck on this one, please help!!! I just migrated my application from VS2003 to VS2005 and when I try to open a folder browser dialog box it gives me the following message:
Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process.
I have tried adding the stathreadattribute, did research, etc but no luck.
PLEASE HELP!!!!!
Sameer
|
|
|
|
|
Are you calling the FolderBrowseDialog from a different thread? Also, does your Main function look like below?
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
HI,
Is there a way to Wrap a Project i created with setup(or installer)
thnks
kobkob
|
|
|
|
|
If you've got Visual Studio installed, there's an installer project present there.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
Hi All,
Is there is any way , so that i can show a child row with goup of controls like a panel when the parent row is expanded in Infragistics UltraWinGrid. I know this forum is for Microsoft controls, anyway excuse me, if anyone come across this situvation please help me out..
Advance Thanks,
Umashanker.K
|
|
|
|
|
first tell me what is infrgistics UltraWinGrid control
|
|
|
|
|
Its a good tool to work on. It got various options in the grid more than the traditional Microsoft Gird control. Karthick now tell me how to achieve my task..
|
|
|
|
|
Hi,
I am wondering is there a way to check if a specific key exists in the registry, to perform certain task if it does, and does not.
Thanks, Andrew.
|
|
|
|
|
Try looking at the functions in the Microsoft.Win32.Registry class.
Virtual1ty
"Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
Use the Registry.GetValue method to get the value. From the return value you can determine if the key existed or not.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,
Sorry, I didn't explain myself very well, so here gooes:
RegistryKey rk = Registry.ClassesRoot.OpenSubKey("Directory\\Background\\shellex\\ContextMenuHandlers", false);<br />
string aticcc = rk.GetValue("(Default)", "Not Installed");<br />
if (aticcc == "Not Installed")<br />
ultraGroupBoxDisplayRightClickTwoChildOne.Enabled = false;
I get the following error when compiling:
Error 1 Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?) C:\Users\Andrew\Documents\Visual Studio 2005\Projects\AR Utilities\Tweak Master\frmMain.cs 137 29 Tweak Master
Thanks, Andrew.
|
|
|
|
|
There are a few things wrong with this code that would be answered if you look at the MSDN documentation[^].
First of all, to retrieve the unnamed value (which is displayed in the registry editor as the string "(Default)", you need to use either a null reference (Nothing in Visual Basic) or the empty string ("") for name (the first parameter).
Second, the GetValue method actually returns an object, so you should cast the result to a string.
Third, registry access makes use of unmanaged resources, so you should dispose/close the keys when you are done with them.
Fourth, you should probably be doing culture aware, case insensitive string comparisons.
You're code should look something like this:
using (RegistryKey rk = Registry.ClassesRoot.OpenSubKey("Directory\\Background\\shellex\\ContextMenuHandlers", false))
{
string aticcc = (string)rk.GetValue(String.Empty, "Not Installed");
if (String.Compare(aticcc, "Not Installed", StringComparison.CurrentCultureIgnoreCase) == 0)
ultraGroupBoxDisplayRightClickTwoChildOne.Enabled = false;
}
|
|
|
|
|
string aticcc = rk.GetValue("(Default)", "Not Installed");
Shwam a .ToString() at the end:
string aticcc = rk.GetValue("(Default)", "Not Installed").ToString();
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Hi,
Sorry, I seem to have confused things a tad here.
I'll try again. I am wanting to see if the key ACE exists under HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers.
If this ACE key does not exist, then I want to to something, otherwise, something else is done.
Would I have to get a array/list of Keys under HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers, the enumerate through them to see if any are ACE and if so, do something etc.
Any help is appreciated.
Thanks, Andrew.
|
|
|
|
|
andyr2005 wrote: I am wanting to see if the key ACE exists under HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers
Is ACE an actual key (meaning it shows up in the left tree of regedit) or is it a value under the HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers key (meaning it shows up in the list on the right side of regedit)?
|
|
|
|