Click here to Skip to main content
15,900,378 members
Home / Discussions / C#
   

C#

 
AnswerRe: Capture Key Events Pin
Samar Aarkotti21-Oct-05 8:35
Samar Aarkotti21-Oct-05 8:35 
AnswerRe: Capture Key Events Pin
S. Senthil Kumar21-Oct-05 20:50
S. Senthil Kumar21-Oct-05 20:50 
Questionis it possible for an hacker make this: Pin
Anonymous21-Oct-05 6:30
Anonymous21-Oct-05 6:30 
AnswerRe: is it possible for an hacker make this: Pin
Kythen21-Oct-05 8:04
Kythen21-Oct-05 8:04 
GeneralRe: is it possible for an hacker make this: Pin
Sasuko21-Oct-05 12:55
Sasuko21-Oct-05 12:55 
QuestionLoading thumbnails in listview.....faster way? Pin
abcxyz8221-Oct-05 6:29
abcxyz8221-Oct-05 6:29 
AnswerRe: Loading thumbnails in listview.....faster way? Pin
Douglas Troy21-Oct-05 6:42
Douglas Troy21-Oct-05 6:42 
AnswerRe: Loading thumbnails in listview.....faster way? Pin
Libor Tinka21-Oct-05 6:44
Libor Tinka21-Oct-05 6:44 
You have to save your thumbnail images and just load them next time except shrinking the original images again and again.

Thumbnails can be stored in some pre-defined directory with hashed filenames. I have developed such very standard system of storing thumbnails based on MD5 hashing. It works this way:

1. Check if the image is small enough (no need to create thumbnail => return)
2. Create MD5 hash from image's FULL path (C:\My Documents\Pictures\ ...)
3. Look to your Thumbnails directory, if there is a thumbnail created
3.1 Yes, load thumbnail
3.2 No, create thumbnail and save it in Thumbnails directory

This is my method for generating MD5 from path string (it returns MD5 in hex format):

<br />
using System.Security.Cryptography;<br />
using System.Text;<br />
<br />
...<br />
<br />
    // generate MD5 path<br />
    protected string HashPath(string path) {<br />
<br />
      ASCIIEncoding enc = new ASCIIEncoding();<br />
      MD5 md5 = MD5CryptoServiceProvider.Create();<br />
<br />
      byte[] buffer = md5.ComputeHash(enc.GetBytes(path));<br />
      string hashPath = "";<br />
<br />
      for (int i = 0; i < buffer.Length; i++)<br />
        hashPath = hashPath + String.Format("{0:X2}", buffer[i]).ToLower();<br />
<br />
      return parentPanel.hashDirectory + hashPath + ".jpg";<br />
    }<br />


...and of course, optimize your code of thumbnail creation. Use fast GDI+ filters for resampling images and put it all on background separate thread.

Hope this helps Big Grin | :-D
QuestionCheck valid XML element name. Pin
Libor Tinka21-Oct-05 6:12
Libor Tinka21-Oct-05 6:12 
AnswerRe: Check valid XML element name. Pin
whizzs21-Oct-05 10:57
whizzs21-Oct-05 10:57 
AnswerRe: Check valid XML element name. Pin
leppie21-Oct-05 12:31
leppie21-Oct-05 12:31 
QuestionLittle Red 'X' on MDI Pin
Dwayner7921-Oct-05 5:12
Dwayner7921-Oct-05 5:12 
AnswerRe: Little Red 'X' on MDI Pin
Libor Tinka21-Oct-05 6:16
Libor Tinka21-Oct-05 6:16 
GeneralRe: Little Red 'X' on MDI Pin
Dwayner7921-Oct-05 7:37
Dwayner7921-Oct-05 7:37 
QuestionBeginner Help: Unassigned local variable Pin
ivelander21-Oct-05 4:19
ivelander21-Oct-05 4:19 
AnswerRe: Beginner Help: Unassigned local variable Pin
Member 114619621-Oct-05 4:34
Member 114619621-Oct-05 4:34 
GeneralRe: Beginner Help: Unassigned local variable Pin
ivelander21-Oct-05 4:41
ivelander21-Oct-05 4:41 
GeneralRe: Beginner Help: Unassigned local variable Pin
Matt Gerrans21-Oct-05 16:08
Matt Gerrans21-Oct-05 16:08 
AnswerRe: Beginner Help: Unassigned local variable Pin
Tom Larsen21-Oct-05 4:58
Tom Larsen21-Oct-05 4:58 
AnswerRe: Beginner Help: Unassigned local variable Pin
whizzs21-Oct-05 11:07
whizzs21-Oct-05 11:07 
QuestionWriting a Trailware for an Application Pin
Samar Aarkotti21-Oct-05 4:18
Samar Aarkotti21-Oct-05 4:18 
AnswerRe: Writing a Trailware for an Application Pin
Tom Larsen21-Oct-05 4:54
Tom Larsen21-Oct-05 4:54 
GeneralRe: Writing a Trailware for an Application Pin
Samar Aarkotti21-Oct-05 5:22
Samar Aarkotti21-Oct-05 5:22 
GeneralRe: Writing a Trailware for an Application Pin
Tom Larsen21-Oct-05 8:09
Tom Larsen21-Oct-05 8:09 
GeneralRe: Writing a Trailware for an Application Pin
Samar Aarkotti21-Oct-05 8:26
Samar Aarkotti21-Oct-05 8:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.