Click here to Skip to main content
15,892,059 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Multimedia controls [not an answer] Pin
Colin Angus Mackay11-Apr-09 8:31
Colin Angus Mackay11-Apr-09 8:31 
RantRe: C# Multimedia controls [not an answer] Pin
jano_rajmond11-Apr-09 8:38
jano_rajmond11-Apr-09 8:38 
RantRe: C# Multimedia controls Pin
Luc 64801111-Apr-09 8:36
Luc 64801111-Apr-09 8:36 
JokeRe: C# Multimedia controls Pin
jano_rajmond11-Apr-09 8:42
jano_rajmond11-Apr-09 8:42 
AnswerRe: C# Multimedia controls [edited] Pin
Mycroft Holmes11-Apr-09 15:41
professionalMycroft Holmes11-Apr-09 15:41 
QuestionCDATA Object Pin
ytubis11-Apr-09 6:49
ytubis11-Apr-09 6:49 
AnswerRe: CDATA Object Pin
Colin Angus Mackay11-Apr-09 7:46
Colin Angus Mackay11-Apr-09 7:46 
QuestionWhy i need to wait so long..... Pin
VisualLive11-Apr-09 6:02
VisualLive11-Apr-09 6:02 
HI all,
i'm trying to populate a panel with an array of picture but when i debug the program is so slow to download the picture in the panel.
i have this code snippet :
public partial class ArtLabel : Form
   {
       private System.Windows.Forms.PictureBox[] imgArray; //Declaring array of PictureBox
       public static string ImageToShow;
       private int NumOfFiles;
       private string[] imgExtension;


       public ArtLabel()
       {
           InitializeComponent();
           panel1.VerticalScroll.Visible = true;
           panel1.VerticalScroll.Enabled = true;
         //  panel1.VerticalScroll.Maximum = 1000;
           panel1.VerticalScroll.Value = panel1.VerticalScroll.Maximum;

       }

       private void ArtLabel_Load(object sender, EventArgs e)
       {
          GetPicture4(@"D:\\Music\\");
       }

       private bool ThumbnailCallback()
       {
           return false;
       }

       private void ARR(int cNumber, string exc)
       {
        int Xpos = 8;
           int Ypos = 8;
           Image img;
           Image.GetThumbnailImageAbort myCallback =
           new Image.GetThumbnailImageAbort(ThumbnailCallback);
           imgArray = new System.Windows.Forms.PictureBox[cNumber]; // assign number array
           for (int i = 0; i < cNumber; i++)
           {
               imgArray[i] = new System.Windows.Forms.PictureBox(); // Initialize one variable
              if (Xpos > 432) // six images in a line
               {
                   Xpos = 8; // leave eight pixels at Left
                   Ypos = Ypos + 72;  // height of image + 8
               }

                       imgArray[i].Left = Xpos;
                       imgArray[i].Top = Ypos;
                       imgArray[i].Width = 64;
                       imgArray[i].Height = 64;
                       imgArray[i].Visible = true;
                       imgArray[i].SizeMode = PictureBoxSizeMode.StretchImage;
                       img = Image.FromFile(exc);
                       imgArray[i].Tag = exc;
                       imgArray[i].Click += new System.EventHandler(ClickImage);
                       imgArray[i].Image = img.GetThumbnailImage(64, 64, myCallback, IntPtr.Zero);
                       panel1.Controls.Add(imgArray[i]);
                       Application.DoEvents();
                       Xpos = Xpos + 72;

           }

       }

       private List<string> GetPicture4(string Folder)
       {
           DirectoryInfo dir = new DirectoryInfo(Folder);
           List<string> str = new List<string>();
           FileInfo[] files = dir.GetFiles("*.jpg", SearchOption.AllDirectories);
           int NumOfFiles = files.Length;
           imgExtension = new string[NumOfFiles];

           for (int i = 0; i < NumOfFiles; i++)
           {
               ARR(i, files[i].FullName);
               str.Add(files[i].FullName);
           }

           return str;


       }

       // The Event to click the image
       private void ClickImage(Object sender, System.EventArgs e)
       {
           ImageToShow = ((System.Windows.Forms.PictureBox)sender).Tag.ToString();
           Direcoty_Prova.ViewPicture f = new Direcoty_Prova.ViewPicture();
           f.ShowDialog();
       }


   }


My purpose of this code is to show the small label of Music Cd and after when i click on the small picture appear a new PictureBox with the picture in Real Size ,i can do it but the trouble if i wish store more than 30 picture in the Array of picture i must wait so long before that the form appear ,i don't know why.

Do you have any advice where i wrong in my code?

Thanks.

Nice Regards
AnswerRe: Why i need to wait so long..... Pin
Luc 64801111-Apr-09 6:28
Luc 64801111-Apr-09 6:28 
AnswerRe: Why i need to wait so long..... Pin
0x3c011-Apr-09 6:31
0x3c011-Apr-09 6:31 
GeneralRe: Why i need to wait so long..... Pin
VisualLive11-Apr-09 7:24
VisualLive11-Apr-09 7:24 
GeneralRe: Why i need to wait so long..... Pin
Luc 64801111-Apr-09 7:44
Luc 64801111-Apr-09 7:44 
GeneralRe: Why i need to wait so long..... [modified] Pin
VisualLive11-Apr-09 8:03
VisualLive11-Apr-09 8:03 
GeneralRe: Why i need to wait so long..... Pin
0x3c011-Apr-09 9:33
0x3c011-Apr-09 9:33 
AnswerRe: Why i need to wait so long..... Pin
Luc 64801111-Apr-09 8:21
Luc 64801111-Apr-09 8:21 
GeneralRe: Why i need to wait so long..... Pin
VisualLive11-Apr-09 8:57
VisualLive11-Apr-09 8:57 
GeneralRe: Why i need to wait so long..... Pin
Luc 64801111-Apr-09 10:01
Luc 64801111-Apr-09 10:01 
GeneralRe: Why i need to wait so long..... Pin
VisualLive12-Apr-09 18:26
VisualLive12-Apr-09 18:26 
QuestionResize Objects Pin
ytubis11-Apr-09 4:53
ytubis11-Apr-09 4:53 
AnswerRe: Resize Objects Pin
0x3c011-Apr-09 4:59
0x3c011-Apr-09 4:59 
QuestionDLL Pin
Rajdeep.NET is BACK11-Apr-09 4:39
Rajdeep.NET is BACK11-Apr-09 4:39 
AnswerRe: DLL Pin
0x3c011-Apr-09 4:42
0x3c011-Apr-09 4:42 
QuestionHow I start with Crystal Report Programaticlly? Pin
magdyeltahaan11-Apr-09 3:40
magdyeltahaan11-Apr-09 3:40 
AnswerRe: How I start with Crystal Report Programaticlly? Pin
0x3c011-Apr-09 3:43
0x3c011-Apr-09 3:43 
QuestionLoad a big file to a textbox Pin
CheatCat11-Apr-09 3:23
CheatCat11-Apr-09 3:23 

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.