Jump to content

Seçilen Resmi Orjinal Boyutta Görüntüleme


DivaneTR
 Share

Recommended Posts

[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]
Link to comment
Share on other sites

Ş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]

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...