All In One Softs - Xây dựng và Sử dụng part 33 pdf

5 255 0
All In One Softs - Xây dựng và Sử dụng part 33 pdf

Đang tải... (xem toàn văn)

Thông tin tài liệu

Khi hoàn thành Menu thì bạn dùng lệnh end Sau đây là cấu trúc một menu mẫu: if e_ID==1 then Page.Jump("Page1"); elseif e_ID==2 then Page.Jump("Page2"); elseif e_ID==3 then Page.Jump("Page3"); elseif e_ID==4 then Page.Jump("Page4"); elseif e_ID==5 then Window.Minimize(Application.GetWndHandle()); elseif e_ID==6 then Application.Exit(); end Scrapbook Khi bạn kéo chuột đến một vị trí nào đó thì hiện lên một bức ảnh minh họa cho nó Thật tuyệt phải không Mấu chốt của vấn đề là dựa vào các blank Imagine ( ảnh trong suốt không màu .định dạng .png) liên kết với nhau Ghé thăm một blank Imagine ra lệnh bất kì ta thấy Chuỗi Code sau Image.Load("9", "AutoPlay\\Images\\photos\\1.jpg"); Ở đây là lệnh gọi image với đương dẫn AutoPlay\\Images\\photos\\1.jpg"); Còn vị trí hiển thị là đối tượng "9", ( đó chính là blank imagine Lớn mà thui) Ngoài ra bạn còn có thể thay thế những blank Image này thành những bức ảnh bất kì cũng chẳng sao (để blank image chẳng qua để đẹp hơn thui) Bạn ghé vô page Propeties /thẻ On show Có những chuỗi code sau: Image.Load("1", "AutoPlay\\Images\\photos\\thumbs\\1.jpg"); Image.Load("2", "AutoPlay\\Images\\photos\\thumbs\\2.jpg"); Image.Load("3", "AutoPlay\\Images\\photos\\thumbs\\3.jpg"); Image.Load("4", "AutoPlay\\Images\\photos\\thumbs\\4.jpg"); Image.Load("5", "AutoPlay\\Images\\photos\\thumbs\\5.jpg"); Image.Load("6", "AutoPlay\\Images\\photos\\thumbs\\6.jpg"); Image.Load("7", "AutoPlay\\Images\\photos\\thumbs\\7.jpg"); Image.Load("8", "AutoPlay\\Images\\photos\\thumbs\\8.jpg"); Image.Load("9", "AutoPlay\\Images\\photos\\" Math.Random(8, nil) ".jpg"); Đó là những Image đc load cùng lúc khởi động với chương trình (hiển thị mặc định trong chương trình) SlideShow Hãy thử tạo 1 Silde Show ảnh coi *Tại Nút Load Thẻ Onclick Cho ta thấy đoạn code sau: The script below makes use of the following global functions (Project > Globals): LoadImage(number) The script below makes use of the following global variables (Project > Globals): tImageFiles Prompt the user for a folder to load images from sImageFolder = Dialog.FolderBrowse("Load images from this directory:", _ DesktopFolder); Check if the user pressed cancel if sImageFolder ~= 'CANCEL' then Clear out old images tImageFiles = {}; Specify the allowed extensions tAllowedExtensions = {"bmp", "apm","emf","gif","jpg","jpeg","pcd","psd","pcx","png","tga","tif","tiff","wmf"}; Perform the following for each extension defined above for nIndex, sExtension in tAllowedExtensions do Find files matching current extension (do not scan sub-folders) tFoundFiles = File.Find(sImageFolder, "*." sExtension, false, false, LoadingImagesCallback, nil); Check if any files were found if tFoundFiles then Count the number of images in the global table so far nImagesSoFar = Table.Count(tImageFiles); Add every found image file to the end of the global table for nImage, sPath in tFoundFiles do tImageFiles[nImagesSoFar + nImage] = tFoundFiles[nImage]; end end end Check if at least one image exists in the global table if tImageFiles[1] then at least one image file exists, set range for the table (the range is used in the function LoadImage to ensure the function never loads an image that doesn't exist in the table tImageFiles) nMinImagePosition = 1; nMaxImagePosition = Table.Count(tImageFiles); Load the first image LoadImage(1); else No supported image files were found, alert the user Dialog.Message("Error", "No supported image files were found at:\r\n" sImageFolder); end end Nhìn vào những phần chữ hồng ta có thể thay đổi chúng đc -Load images from this directory:", : mặc định là load trong Folder của chương trình -{"bmp", “ apm","emf","gif","jpg","jpeg","pcd","psd","pcx","png","tga","tif","tiff","wmf"}; Những định dạng ảnh có thể Load Nếu không tìm thấy ảnh ở Folder bạn chỉ định nó sẽ báo ("Error", "No supported image files were found at:\r\n" *Tại Nút Next và Back Tại Nút Back có dòng lệnh sau: Đó là Load lùi dần với số lượng là 1 File ảnh Tại nút Next có dòng lệnh sau: Đó là Load tăng dần với số lượng là 1 File ảnh *Tại thẻ Globals Functions: Có dòng code sau nCurrentImagePosition keeps track of which image in the table is currently being displayed. This is used on the previous and next image buttons nCurrentImagePosition = 1; tImageFiles holds all of the paths to the image files loaded from the folder specified by the user tImageFiles = {}; LoadImage first checks if the requested index is within the allowed range, and then loads the specified image file into the image object. function LoadImage(nImagePosition) Check if requested index is within the allowed range (If it isn't, reset the position) if nImagePosition < nMinImagePosition then Reset the position to the maximum value nImagePosition = nMaxImagePosition; elseif nImagePosition > nMaxImagePosition then Reset the position to the minimum value nImagePosition = nMinImagePosition; end Load the specified image file from the global table Image.Load("Image1", tImageFiles[nImagePosition]); Keep track of which image index was loaded nCurrentImagePosition = nImagePosition; end Mặc đinh ở đây là Load "Image1" Video Player Cái này có đoạn Code sau tại Nút Load /thẻ onclick vidFile = Dialog.FileBrowse(true, "Open File", _DesktopFolder, "Video Files (.avi, .mpg, .mpeg, .wmv, .asf, )|*.avi;*.mpg;*.mpeg;*.wmv;*.asf", "", "", false, true); if (vidFile[1] ~= "CANCEL") then Video.Load("Video1", vidFile[1], true, false); End *** Dialog.FileBrowse(true, "Open File" : Tìm đường dẫn đến File cần mở với tên Open File (bạn có thể thay đổi tên này) .mặc định là chọn ở desktop Các định dạng File có thể mở : "Video Files (.avi, .mpg, .mpeg, .wmv, .asf, )|*.avi;*.mpg;*.mpeg;*.wmv;*.asf", "", "" Video.Load("Video1",: video mặc định để load khi khởi động chương trình có tên là Video1 Wallpaper ,Icon , Buton Wallpaper . the following for each extension defined above for nIndex, sExtension in tAllowedExtensions do Find files matching current extension (do not scan sub-folders) tFoundFiles = File.Find(sImageFolder,. requested index is within the allowed range, and then loads the specified image file into the image object. function LoadImage(nImagePosition) Check if requested index is within the allowed. e_ID==5 then Window.Minimize(Application.GetWndHandle()); elseif e_ID==6 then Application.Exit(); end Scrapbook Khi bạn kéo chuột đến một vị trí nào đó thì hiện lên một bức ảnh minh họa cho

Ngày đăng: 07/07/2014, 18:20

Tài liệu cùng người dùng

Tài liệu liên quan