![Phân tích tư tưởng của nhân dân qua đoạn thơ: Những người vợ nhớ chồng… Những cuộc đời đã hóa sông núi ta trong Đất nước của Nguyễn Khoa Điềm](https://timtailieu.net/upload/document/136415/phan-tich-tu-tuong-cua-nhan-dan-qua-doan-tho-039-039-nhung-nguoi-vo-nho-chong-nhung-cuoc-doi-da-hoa-song-nui-ta-039-039-trong-dat-nuoc-cua-nguyen-khoa-136415.jpg)
Chương 3: Một số kỹ thuật trong lập trình trên .Net CF
Số trang: 16
Loại file: ppt
Dung lượng: 631.00 KB
Lượt xem: 4
Lượt tải: 0
Xem trước 2 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Tài liệu tham khảo của ThS. Trần Minh Triết, trường Đại học khoa học tự nhiên, đại học quốc gia TP.Hồ Chí Minh - Khoa Công nghệ thông tin
Nội dung trích xuất từ tài liệu:
Chương 3: Một số kỹ thuật trong lập trình trên .Net CFĐại học Khoa học Tự nhiên, ĐHQG-HCM Khoa Công Nghệ Thông Tin Chương 3: Một số kỹ thuậttrong lập trình trên .Net CF ThS. Trần Minh Triết 1 1Xác định đường dẫn của Ứng dụng Lấy danh sách các Assembly Xác định tự động đường dẫn của ứng dụng (runtime)m_startuppath= Trọn vẹn tên vàSystem.Reflection.Assembly.GetExecutingAssembly(). của đường dẫn moduleGetModules()[0].FullyQualifiedName;m_startuppath=m_startuppath.Replace( Xóa tên file,System.Reflection.Assembly.GetExecutingAssembly(). giữ lại chỉ đường dẫnGetModules()[0].Name,);m_BmBanCo=newBitmap Tên của module(m_startuppath+BanCoPocketPC.jpg);m_BmQuanCo=newBitmap(m_startuppath+QuanCoPocKetPC.bmp);m_BmChonCo=newBitmap(m_startuppath+ChonQuanPocketPC.bmp); 2 2 Xác định đường dẫn của Ứng dụng Sử dụng đường dẫn tuyệt đối (hard-code)!!! Phải biết trước đường dẫn (tuyệt đối) sẽ chứa chương trình thực thipublicclassConstant{ publicstaticintLEFT=24; publicstaticintTOP=24; publicstaticstringAppPath=@\ProgramFiles\MummyMaze\; publicstaticstringImagesPath=@\ProgramFiles\MummyMaze\;} 3 3 Load ảnh từ file Có thể load các ảnh từ file vào đối tượng kiểu Bitmap Các định dạng ảnh thông dụng mà WinCE hỗ trợ (BMP, JPG, PNG…)BitmapRedMummyBmp=newBitmap(Constant.ImagesPath+redmummy.bmp);BitmapHelloBmp=newBitmap(Constant.ImagesPath+hello.jpg); 4 4 Sử dụng Timer (1) Khai báo biến thuộc kiểu System.Windows.Forms.TimerprivateSystem.Windows.Forms.TimerMyTimer; Khởi tạo biến TimerprivatevoidInitializeComponent(){this.MyTimer=newSystem.Windows.Forms.Timer(); this.MyTimer.Interval=300;//300ms this.MyTimer.Tick+=newSystem.EventHandler(this.MyTimer_Func);} Tên hàm xử lý Timer 5 5Sử dụng Timer (2) Hàm xử lý mỗi khi xảy ra biến cố timerprivatevoidMyTimer_Func(objectsender,System.EventArgse){ flag=1flag; pictureBox1.Image=CompleteBmp[flag]; pictureBox1.Refresh();} 6 6 Sử dụng Timer (3) Kích hoạt timerMyTimer.Enabled=true; Tạm dừng timerMyTimer.Enabled=false; Hủy bỏ timerMyTimer.Dispose(); 7 7Sử dụng GraphicspublicvoidDraw(Graphicsg){ ImageAttributesimgatt=newImageAttributes(); imgatt.SetColorKey (Constant.BkColor,Constant.BkColor); g.DrawImage( HumanBmp, newRectangle(left,top,width,height), Bmp_x*Constant.WidthSquare_pixel, Bmp_y*Constant.WidthSquare_pixel, Constant.WidthSquare_pixel, Constant.WidthSquare_pixel, GraphicsUnit.Pixel,imgatt);} 8 8 Sử dụng Thread Khai báo biến kiểu ThreadprivateThreadSoundThread; Tên hàm xử lý chính Tạo thread và khởi động thread của ThreadprivatevoidPlaySound(){ SoundThread= newThread(newThreadStart(PlaySoundFunc)); SoundThread.Priority=ThreadPriority.Highest; SoundThread.Start();// Bắt đầu thread} Hàm xử lý chính của ThreadprivatevoidPlaySoundFunc(){ Sound.PlayMusic(Constant.AppPath+music.wav);} 9 9 Xử lý Âm thanh (1)publicclassSound{ [DllImport(WinMM.dll, EntryPoint=PlaySound,CharSet=CharSet.Auto)] privatestaticexternintPlaySoundWin32 (stringpszSound,inthmod,intfdwSound); [DllImport(CoreDll.dll, EntryPoint=PlaySound,CharSet=CharSet.Auto)] privatestaticexternintPlaySoundWinCE (stringpszSound,inthmod,intfdwSound);......... 10 10 Xử lý Âm thanh (2)privateenumSND{ SND_SYNC =0x0000, /*playsynchronously(default)*/ SND_ASYNC =0x0001, /*playasynchronously*/ SND_NODEFAULT =0x0002, /*silence(!default)ifsoundnotfound*/ SND_MEMORY =0x0004, /*pszSoundpointstoamemoryfile*/ SND_LOOP =0x0008, /*loopthesounduntilnextsndPlaySound*/ 11 ...
Nội dung trích xuất từ tài liệu:
Chương 3: Một số kỹ thuật trong lập trình trên .Net CFĐại học Khoa học Tự nhiên, ĐHQG-HCM Khoa Công Nghệ Thông Tin Chương 3: Một số kỹ thuậttrong lập trình trên .Net CF ThS. Trần Minh Triết 1 1Xác định đường dẫn của Ứng dụng Lấy danh sách các Assembly Xác định tự động đường dẫn của ứng dụng (runtime)m_startuppath= Trọn vẹn tên vàSystem.Reflection.Assembly.GetExecutingAssembly(). của đường dẫn moduleGetModules()[0].FullyQualifiedName;m_startuppath=m_startuppath.Replace( Xóa tên file,System.Reflection.Assembly.GetExecutingAssembly(). giữ lại chỉ đường dẫnGetModules()[0].Name,);m_BmBanCo=newBitmap Tên của module(m_startuppath+BanCoPocketPC.jpg);m_BmQuanCo=newBitmap(m_startuppath+QuanCoPocKetPC.bmp);m_BmChonCo=newBitmap(m_startuppath+ChonQuanPocketPC.bmp); 2 2 Xác định đường dẫn của Ứng dụng Sử dụng đường dẫn tuyệt đối (hard-code)!!! Phải biết trước đường dẫn (tuyệt đối) sẽ chứa chương trình thực thipublicclassConstant{ publicstaticintLEFT=24; publicstaticintTOP=24; publicstaticstringAppPath=@\ProgramFiles\MummyMaze\; publicstaticstringImagesPath=@\ProgramFiles\MummyMaze\;} 3 3 Load ảnh từ file Có thể load các ảnh từ file vào đối tượng kiểu Bitmap Các định dạng ảnh thông dụng mà WinCE hỗ trợ (BMP, JPG, PNG…)BitmapRedMummyBmp=newBitmap(Constant.ImagesPath+redmummy.bmp);BitmapHelloBmp=newBitmap(Constant.ImagesPath+hello.jpg); 4 4 Sử dụng Timer (1) Khai báo biến thuộc kiểu System.Windows.Forms.TimerprivateSystem.Windows.Forms.TimerMyTimer; Khởi tạo biến TimerprivatevoidInitializeComponent(){this.MyTimer=newSystem.Windows.Forms.Timer(); this.MyTimer.Interval=300;//300ms this.MyTimer.Tick+=newSystem.EventHandler(this.MyTimer_Func);} Tên hàm xử lý Timer 5 5Sử dụng Timer (2) Hàm xử lý mỗi khi xảy ra biến cố timerprivatevoidMyTimer_Func(objectsender,System.EventArgse){ flag=1flag; pictureBox1.Image=CompleteBmp[flag]; pictureBox1.Refresh();} 6 6 Sử dụng Timer (3) Kích hoạt timerMyTimer.Enabled=true; Tạm dừng timerMyTimer.Enabled=false; Hủy bỏ timerMyTimer.Dispose(); 7 7Sử dụng GraphicspublicvoidDraw(Graphicsg){ ImageAttributesimgatt=newImageAttributes(); imgatt.SetColorKey (Constant.BkColor,Constant.BkColor); g.DrawImage( HumanBmp, newRectangle(left,top,width,height), Bmp_x*Constant.WidthSquare_pixel, Bmp_y*Constant.WidthSquare_pixel, Constant.WidthSquare_pixel, Constant.WidthSquare_pixel, GraphicsUnit.Pixel,imgatt);} 8 8 Sử dụng Thread Khai báo biến kiểu ThreadprivateThreadSoundThread; Tên hàm xử lý chính Tạo thread và khởi động thread của ThreadprivatevoidPlaySound(){ SoundThread= newThread(newThreadStart(PlaySoundFunc)); SoundThread.Priority=ThreadPriority.Highest; SoundThread.Start();// Bắt đầu thread} Hàm xử lý chính của ThreadprivatevoidPlaySoundFunc(){ Sound.PlayMusic(Constant.AppPath+music.wav);} 9 9 Xử lý Âm thanh (1)publicclassSound{ [DllImport(WinMM.dll, EntryPoint=PlaySound,CharSet=CharSet.Auto)] privatestaticexternintPlaySoundWin32 (stringpszSound,inthmod,intfdwSound); [DllImport(CoreDll.dll, EntryPoint=PlaySound,CharSet=CharSet.Auto)] privatestaticexternintPlaySoundWinCE (stringpszSound,inthmod,intfdwSound);......... 10 10 Xử lý Âm thanh (2)privateenumSND{ SND_SYNC =0x0000, /*playsynchronously(default)*/ SND_ASYNC =0x0001, /*playasynchronously*/ SND_NODEFAULT =0x0002, /*silence(!default)ifsoundnotfound*/ SND_MEMORY =0x0004, /*pszSoundpointstoamemoryfile*/ SND_LOOP =0x0008, /*loopthesounduntilnextsndPlaySound*/ 11 ...
Tìm kiếm theo từ khóa liên quan:
công nghệ thông tin kỹ thuật lập trình tài liệu học vi tính tin học lập trình mạng .Net Compact Framework kỹ thuật trong lập trình trên .Net CFTài liệu liên quan:
-
52 trang 443 1 0
-
Top 10 mẹo 'đơn giản nhưng hữu ích' trong nhiếp ảnh
11 trang 333 0 0 -
74 trang 312 0 0
-
96 trang 309 0 0
-
Báo cáo thực tập thực tế: Nghiên cứu và xây dựng website bằng Wordpress
24 trang 300 0 0 -
Đồ án tốt nghiệp: Xây dựng ứng dụng di động android quản lý khách hàng cắt tóc
81 trang 295 0 0 -
Tài liệu dạy học môn Tin học trong chương trình đào tạo trình độ cao đẳng
348 trang 293 1 0 -
Kỹ thuật lập trình trên Visual Basic 2005
148 trang 282 0 0 -
EBay - Internet và câu chuyện thần kỳ: Phần 1
143 trang 281 0 0 -
Tài liệu hướng dẫn sử dụng thư điện tử tài nguyên và môi trường
72 trang 276 0 0