DivaneTR Posted August 30, 2011 Share Posted August 30, 2011 [center][b]Merhaba Arkadaşlar. Projemde Dialog.FileBrowse İle Seçtiğim Dosyayı Image.Load İle Image1 Objesinde Görüntülüyorum. Fakat Şöyle Bir İsteğim Var. Image1 Objesinin Boyutları 71x79. Eğer Resmin Boyutu Daha Büyükse 71x79 Yapsın, Sığdırsın. Daha Küçükse Örneğin 32x32 Aynen 32x32 Boyutunda Göstersin. Yani Image1 Objesi de 32x32 Olsun. Mümkün Müdür ? Yardımlarını Bekliyorum.[/b][/center] [b]Proje Dosyası :[/b] [code]http://www.fileden.com/files/2009/7/6/2500191//imagesize.apz[/code] Quote Link to comment Share on other sites More sharing options...
KintaRo Posted August 30, 2011 Share Posted August 30, 2011 Şimdi öncelikle bi kaç kodda hata ve eksiklik var önce onları düzeltelim; - Madem sadce resim dosyalarını göstereceksin, [quote]Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "All Files (*.*)|*.*|", "", "dat", false, false);[/quote] komutu ile tüm dosyalar yerine [quote]Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "JPEG dosyaları (*.jpg)|*.jpg|PNG Dosyaları (*.png)|*.png|", "", "dat", false, true);[/quote] şeklinde kullanarak ve bmp ve gif de ekleyerek sadece resim dosyalarını gösterebilirsin [quote]- if result ~= "CANCEL" or result ~= nil then[/quote] yazmışsın. result tablo olarak döndüğü için result ~= "CANCEL" olmaz. CANCEL, IDOK gibi argümanlar sadece stringlere depolanabilir o yüzden result[1] ~= "CANCEL" demelisin. ayrıca burda kullandığın result ~= nil demene gerek yok çünkü dialog.filebrowse() dan nil dönmez. sadece ~= "CANCEL" demen yeterli. Aşağıda istediğin kodları hazırladım. projendeki resim nesnesinin boyutlaırnı 71x79 yaparsan tam sonucu göreceksin. [codebox]result = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "JPEG dosyaları (*.jpg)|*.jpg|PNG Dosyaları (*.png)|*.png|", "", "dat", false, true); if result[1] ~= "CANCEL" then tInfo = Image.GetFileInfo(result[1]) if tInfo.Width < 71 and tInfo.Height < 79 then Image.SetProperties("Image1", {Width = 32, Height = 32}) Image.Load("Image1", result[1]); else Image.SetProperties("Image1", {Width = 71, Height = 79}) Image.Load("Image1", result[1]); end end [/codebox] Quote Link to comment Share on other sites More sharing options...
DivaneTR Posted August 30, 2011 Author Share Posted August 30, 2011 [b]Abi Ne Kadar Teşekkür Etsem Azdır. Çok Canımı Sıkıyordu Bu Mesele. Kodları Öylesine Kafadan Yazdım. Asıl Proje Sürpriz de [/b] Quote Link to comment Share on other sites More sharing options...
KintaRo Posted August 30, 2011 Share Posted August 30, 2011 Haydi bakalım bekliyoruz Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.