|
Marcos Hernandez wrote: I dont need to show them just i need to read image headers to get info about size, bitdepth, etc...
Well, the problem with that is some of the information isn't in the headers, but generated from the image data itself. Also, some file formats put metadata in the header of the image data, some at the tail of the image, and still others at both ends.
I don't know of any library that will get you just the metadata without reading the entire image file.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have a class that reads a JPEG file into memory, scans the byte array sequentially,
recognizes the major blocks ("markers") in it and extracts the width, height and pixel depth
from a SOF0/.../SOF15 block. It is 300 lines long, and would need some adaptations
to suit your needs.
When I look at the images from my Olympus camera, the file size typically is 800 KB,
and the metadata you want is located around 16 KB from the start.
If interested send me an e-mail.
Luc Pattyn
|
|
|
|
|
Thanx mate,
Im gonna work today on it,
thanx for your help
|
|
|
|
|
waiting for e-mail, so I can reply with attachment...
Luc Pattyn
|
|
|
|
|
I have created a custom web control and I've added a property that will display a list of given values. I created a enum type and set my enumerators list values, but I can't have any white spaces in my list. How can I show list values that have white spaces using the enum type?
Any suggestions would be appreciated! Thanks in advance.
MVPenn
|
|
|
|
|
You can't. Enums are for your code to understand. Essentially like giving a code-usable name to a value, kind of like a variable. They're not meant for use as a UI element.
What are trying to do with this?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I wanted to show a more "user friendly" description in the listbox on my web control property.
For example:
public enum Diseases { Hepatitis A, Hepatitis B, ...}
public enum fonts {Arial Black, Arial Narrow, Arial, ...}
I'm not sure if I should be using the enum type to populate a list property on a custom web control. Is there a better solution to accomplish this? I'm relatively new to development and would appreciate any suggestions that you might have on this.
Thanks for your response.
MVPenn
|
|
|
|
|
MVPenn wrote: I'm not sure if I should be using the enum type to populate a list property on a custom web control.
Obviously you can't, at least not the way you want to.
MVPenn wrote: Is there a better solution to accomplish this?
The easiest thing that comes to my mind is declaring a simple string array:
public string[] Diseases = new string[] { "Hepatitis A", "Hepatitis B" };
"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
|
|
|
|
|
Try this:
public static string EnumHelper(Enum value)
{
description = value.ToString();
MemberInfo[] mi = value.GetType().GetMember(value.ToString());
if (mi != null && mi.Length > 0)
{
object[] att = mi[0].GetCustomAttributes(typeof(Description), false);
if (att != null && att.Length > 0)
description = ((Description)att[0]).Text;
}
return description;
}
Then, in your enumeration all you need to do is:
public enum Diseases
{
[Description("Hepatitis A")]
HepatitisA,
Eczema,
}
Then, in your code you will do the following:
string hepA = EnumHelper(Diseases.HepatitisA);
This returns Hepatitis A.
string ex = EnumHelper(Diseases.Eczema);
returns Eczema.
I hope this helps.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
MVPenn wrote: public enum Diseases { Hepatitis A, Hepatitis B, ...}
public enum fonts {Arial Black, Arial Narrow, Arial, ...}
In the past I've done something like this:
public enum Diseases { Hepatitis_A, Hepatitis_B, ...}
And when you need to display the "friendly" values just use the String.Replace function to get rid of the underscores.
|
|
|
|
|
I've never hard coded anything in a enum like this. I've always put my options like this is a database or XML file. It's easier to modify that file than it is to modify the code and deploy a new app if the options change.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi MVPenn,
Create your own attribute (you may wish to call it EnumDescription).
You can find some examples over the net. For example:
Example
Recall that if you want to display friendly names for property name - you can use the "DisplayName" attribute.
Unfortunately, this attribute can not be applied for enum members. Hence (as i said before) have to create your own enum description attribute.
elaj
|
|
|
|
|
Hello everybody,
I have a problem which needs to get all the links on a web page. I am able to get the html source code from a web page in astring. I want a regular expression Which gives all the links (href attributes' values from that code). If Any body could help me in that aspect,Please provide it soon,
Thanking You.
|
|
|
|
|
|
hi i have a small problem.
how can i have 2 forms that i can controll at the same time ?
so if i make Form.Show() <-- the other form is not available.
greeting gigo
|
|
|
|
|
Please explain the problem a bit better.
Creating an instance of Form2 in Form1 and calling form2.Show() should work just fine.
|
|
|
|
|
Could you explain a little more clearly what you mean. You want two forms to display at the same time?
Form1.Show();
From2.Show();
These are not modal calls and will cause both forms to display, though one may be covered by the other.
only two letters away from being an asset
|
|
|
|
|
ok thanks ..
but this doesnt fix my problem
the problem is the same (the form2 is working and block the hole application and also form1)
greeting gigo
|
|
|
|
|
How did you show the second form? Using .Show() or .ShowDialog() . THe problem your describing says your used ShowDialog() to display the second form.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
How to Maintains performance while rows are added to the DataGridView one at a time by preventing the control from drawing until the EndUpdate method is called?
|
|
|
|
|
|
If SuspendLayout() and ResumeLayout() don't give you the performance you want, for some strange reason, setting the Visible property to false while adding rows and then changing Visible to true after you're done seems to give an even bigger performance boost.
Don't ask me why, but I did a lot of testing to verify it just a few weeks ago.
|
|
|
|
|
This is not for anything specific, just been bugging me.
If i have a datareader and execute it to bring back some records (from a SQL 2000 Database), but then before i read them do an update on the table that they have been read from, the rows that i then read do not reflect the changes of the update, therefore the datareader must hold the read in data in memory on a executeReader()
Firstly is it correct that it holds it?
Secondly if it does read some of the data in then does it batch it (because of memory limitations), in my test i was changing the 4th row down in the table, if i was to change say the 20,000th row, would it then reflect the change as it has to go back and read in more data.
Hope this makes sense!! the code is below so you can see what i have done
static void Main(string[] args)
{
try
{
string strConnectionString = ".....";
SqlConnection con1 = new SqlConnection(strConnectionString);
con1.Open();
SqlConnection con2 = new SqlConnection(strConnectionString);
con2.Open();
SqlTransaction trans1 = con1.BeginTransaction();
SqlDataReader dr2;
//READ THE TABLE INTO A READER
SqlCommand mycmd2 = new SqlCommand("SELECT * FROM TABLE1", con2);
dr2 = mycmd2.ExecuteReader(CommandBehavior.CloseConnection);
//CHANGE A ROW IN THE TABLE
SqlCommand mycmd1 = new SqlCommand("UPDATE TABLE1 SET Bla = Bla where ID = Bla", con1);
Console.WriteLine(mycmd1.ExecuteNonQuery().ToString());
//LOOP THROUGH THE DATAREADER OUTPUTTING THE CONTENTS (DOES NOT REFLECT THE ABOVE UPDATE)
while (dr2.Read())
{
//write out the 'data' field
Console.WriteLine(dr2.GetInt32(1).ToString());
}
dr2.Close();
con1.Close();
con2.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
|
|
|
|
|
That would depend, at least in part, on the transaction's IsolationLevel.
|
|
|
|
|
Thanks, now i have looked into that i understand what is going on
|
|
|
|