Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can i show an image preview ? To change a pictureBox size and move it to the center of the form
    primarykey
    data
    text
    <p>This is the code in Form1:</p> <pre><code>private void timer1_Tick(object sender, EventArgs e) { try { pictureBox1.Load(file_array_satellite[file_indxs_satellite]); //label12.Visible = true; //label12.Text = "Satellite files date and time: " + File.GetCreationTime(file_array_satellite[file_indxs_satellite]); file_indxs_satellite = file_indxs_satellite - 1; //pictureBox1.Load(file_array[file_indexs]); //label10.Visible = true; //label10.Text = "Radar files date and time: " + File.GetCreationTime(file_array[file_indexs]); file_indxs_satellite = file_indxs_satellite - 1; if (file_indxs_satellite &lt; 0) { file_indxs_satellite = file_array_satellite.Length - 1; } if (file_indxs_satellite &lt; 0) { file_indxs_satellite = file_array_satellite.Length - 1; } } catch { timer1.Enabled = false; } } private void satellitesToolStripMenuItem_Click(object sender, EventArgs e) { file_array_satellite = Directory.GetFiles(UrlsPath, "RainImage*.*"); for (int i = 0; i &lt; file_array_satellite.Length; i++) { Image s = new Bitmap(file_array_satellite[i]); s = resizeImage(s, new Size(100, 100)); s.Save(UrlsPath + "Changed" + i.ToString("D6") + ".jpg"); } file_array_satellite = Directory.GetFiles(UrlsPath, "Changed*.*"); if (file_array_satellite.Length &gt; 0) { DateTime[] creationTimes8 = new DateTime[file_array_satellite.Length]; for (int i = 0; i &lt; file_array_satellite.Length; i++) creationTimes8[i] = new FileInfo(file_array_satellite[i]).CreationTime; Array.Sort(creationTimes8, file_array_satellite); file_indxs_satellite = 0; file_indxs_satellite = file_array_satellite.Length - 1; timer1.Enabled = true; } } public static Image resizeImage(Image imgToResize, Size size) { return (Image)(new Bitmap(imgToResize, size)); } private void pictureBox1_MouseEnter(object sender, EventArgs e) { } </code></pre> <p>In top of form1:</p> <pre><code>string[] file_array_satellite; int file_indxs_satellite; </code></pre> <p>In constructor:</p> <pre><code>localFilename = @"d:\localpath\"; UrlsPath = @"d:\localpath\Urls\"; </code></pre> <p>What i want to do is when i move the mouse over the pictureBox1 area the pictureBox will be resized to for example 400x400 and will show the image in the pictureBox1 in the resized size in this case 400x400.</p> <p>Like a preview . When i move over with the mouse the animation will keep moving/playing but the pictureBox will be in the middle of the form and a bigger size like 400x400 .</p> <p>How can i do it ? What should i do in the pictureBox1_MouseEnter event ?</p> <p>Edit**</p> <p>Tried this:</p> <pre><code>private void pictureBox1_MouseEnter(object sender, EventArgs e) { pictureBox1.Location = new Point(this.Bounds.Width / 2, this.Bounds.Height / 2); this.pictureBox1.Size = new Size(500, 500); this.pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage; pictureBox1.BringToFront(); } </code></pre> <p>But the pictureBox is not in the center and the size is not changed. Why ? In the original the pictureBox size is 100,100 also the files on hard disk i change them to 100,100 and it's working good !</p> <p>Once i move the mouse over the pictureBox it's not moving to the center and not resize to 500,500.</p> <p>The form1 size is 800,600</p> <p>I want the pictureBox to show in the center of the Form and to be bigger size 500,500 or 700,500</p> <p>What's wrong ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload