I have a found a very useful icon class i like to use in a program, unfortunately it doesn't seem to support 256x256 icon's Basically what i think is wrong that icon width and height are calculated as byte values, and a byte value can be no more than 255 http://www.codeproject.com/Articles/6171/Access-multiple-icons-in-a-single-icon-file Anyone know how to fix this class to support 256x256 png icons?
i played with it and even adjusted the array so when the ico is read into memory, it will read 1 less byte to be less than the array limit but it still gave me a out of range exception idk man im stumped. i dont get an error until it's writinng the bitmap to the image box and even writing to a new bitmap before the image box gives an error(.tobitmap) so i think the memory stream is to large for the .tobitmap function
That is a nice little class, and changing large to jumbo (4) not work with it, have you tried IconLib: http://www.codeproject.com/Articles/16178/IconLib-Icons-Unfolded-MultiIcon-and-Windows-Vista not sure if it can get a 256 from a smaller one.. ? Icons are not my thing..
Mmm that lib seems quite complicated, and not very well documented I basically need something simple that checks if various icon format exist in a loaded icon, eg:
Have you checked out IconExtractor, it finds all icons in a loaded file. http://www.codeproject.com/Articles/26824/Extract-icons-from-EXE-or-DLL-files
Thats seems about right...thx. Now i need something that compares a pre-defined array/list (required icon sizes, bitdepths) with the array/list containing these icons sizes, bitdepths. The order of bitmaps in the icon can differ from the order of pre-defined array/list with values, is that possible? [edit] Ok, seems i have solved this... now the next step
Well, it's getting near to be finished btw, how can i make sure textBox1.Text (Manufacturer) and a icon are selected/typed in before enabling the 'Create Device Metadate Package' button (disabling the button until these 2 are selected/typed in) textBox2.Text (Model) may be empty, dropDown1 (Enclosure Type) defaults to 'Computer' so no check is needed here either.
vb.net Code: Public Sub disablecheck() 'if the textbox has nothing in it and the picturebox has nothing in it then disable button If TextBox1.Text = String.Empty And PictureBox1.Image Is Nothing Then Button1.Enabled = False 'else if textbox length is longer than 0 characters and picturebox1.image is something then enable 'when the textbox is filled and then all characters backspaced this check fails, i don't know why because this checks for all possible characters? ElseIf Not String.IsNullOrWhiteSpace(TextBox1.Text.Trim) And Not PictureBox1.Image Is Nothing Then Button1.Enabled = True End If End Sub Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick 'make sure your timer is enabled Call disablecheck() End Sub noticed this is c# here's c# code (converted with developerfusion.com) Code: public void disablecheck() { //if the textbox has nothing in it and the picturebox has nothing in it then disable button if (TextBox1.Text == string.Empty & PictureBox1.Image == null) { Button1.Enabled = false; //else if textbox length is longer than 0 characters and picturebox1.image is something then enable //when the textbox is filled and then all characters backspaced this check fails, i don't know why because this checks for all possible characters? } else if (!string.IsNullOrWhiteSpace(TextBox1.Text.Trim) & (PictureBox1.Image != null)) { Button1.Enabled = true; } } private void Timer1_Tick(System.Object sender, System.EventArgs e) { //make sure your timer is enabled disablecheck(); }
I am using NET 2.x , so String.IsNullOrWhiteSpace() is not available, i replaced it with String.IsNullOrEmpty(), same backspace problems occurs, quick an dirty fix for that issue, just add this at the top of disablecheck() Code: if (textBox1.Text.Trim().Length == 0) { button5.Enabled = false; }
How about: Code: if (pictureBox1.BackgroundImage != null && !String.IsNullOrEmpty(textBox1.Text) && textBox1.Text.Trim().Length != 0) { button1.Enabled = true; } else { button1.Enabled = false; } May need to change BackgroundImage to Image if using Image instead of BackgroundImage. By the way your project looks nice..
if (pictureBox1.BackgroundImage != null && !String.IsNullOrEmpty(textBox1.Text.Trim())) catches the white spaces too, textBox1.Text.Trim().Length != 0 can be left out
yep just make sure u add the pic box check 2 with that, i tried the length 2 but it didnt work for me?
You dont need the length, as freestyler noticed, you only need this: Code: if (pictureBox1.BackgroundImage != null && !String.IsNullOrEmpty(textBox1.Text.Trim())) There was no need to add the extra check.
oops posted without noticing the second page, so i didn't see his post, glad it works and nice project why did my original code not work though i used the string.isnullorwhitespace which should catch all the whitespaces 2 right?
i know that i ment that when i used that in .net 4 it didnt detect that the textbox was emtpy when you would type letters in then backspace them all-i used isnullorwhitespace in my code because i didnt know he was using .net 2
Maybe create own Code: public static bool IsNullOrWhiteSpace(string text) { if (text != null) { for (int i = 0; i < text.Length; i++) { if (!char.IsWhiteSpace(text)) { return false; } } } return true; } Then IsNullOrWhiteSpace works, pretty logical when you think about it
what you just said confuses me but when i use isnullorwhitespace it didn't detect that the textbox was empty after backspacing everything out, it very simply didnt work