04/10/2006
Ekran çözünürlüğü ve form boyutları
Bir örnekle uğraşıyordum paylaşmak istedi.Örnekte yapılan işlem seçili olan image ı MSN uyarı penceresindeki gibi sağ alt köşeye dayamak...
//Dosya Seç
openFileDialog1.ShowDialog();
//Dosya Seçildi ise
//Burada dosyanın image olup olmadıgı kontrolude yapılmalı!!!
if(openFileDialog1.ShowDialog==DialogResult.OK)
{
//Seçili resmi picture a ekle
pictureBox1.Image = System.Drawing.Image.FromFile(openFileDialog1.FileName);
//Bu PictureBox ın SizeMode u "AutoSize" olmalı
//Form un boyutu resim kadar olmalı
this.Width = pictureBox1.Width ;
this.Height = pictureBox1.Height ;
//Ekranın çözünürlüğü bulunur
Rectangle rect = Screen.GetWorkingArea(this);
//Dosya Seç
openFileDialog1.ShowDialog();
//Dosya Seçildi ise
//Burada dosyanın image olup olmadıgı kontrolude yapılmalı!!!
if(openFileDialog1.ShowDialog==DialogResult.OK)
{
//Seçili resmi picture a ekle
pictureBox1.Image = System.Drawing.Image.FromFile(openFileDialog1.FileName);
//Bu PictureBox ın SizeMode u "AutoSize" olmalı
//Form un boyutu resim kadar olmalı
this.Width = pictureBox1.Width ;
this.Height = pictureBox1.Height ;
//Ekranın çözünürlüğü bulunur
Rectangle rect = Screen.GetWorkingArea(this);
//İmage Sağ alt köşeye MSN uyarı penceresi gibi yapışır
this.Location = new Point(rect.Width - this.Width,rect.Height - this.Height);
}
13:02 Posted in .Net | Permalink | Comments (0) | Email this
