tag:blogger.com,1999:blog-72126616688775485212024-03-05T23:10:33.410+07:00Nông dân fix bugTừ nông dân tới coder đến coolieUnknownnoreply@blogger.comBlogger7125tag:blogger.com,1999:blog-7212661668877548521.post-2830523440026129162019-03-31T18:52:00.000+07:002019-03-31T18:52:26.281+07:00Cá tháng tư 2019 và stackoverflow<div dir="ltr" style="text-align: left;" trbidi="on">
Thường thì vào cái ngày cá tháng tư hàng năm, đa số thanh niên sẽ quen thuộc với những mẩu truyện "giả vờ" tỏ tình để coi xem có bị thất bại thì cũng chẳng ê mặt, vì nó như trò đùa thôi mà!!<br />
<br />
<br />
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1ynK905WiEXX93VjOC8wIvQ6cDf-Ou1OpV8J2Tf7IGqDP3f9WlnotF7t3ePvQoEtaxlGSFMzoHoQnYA6wnvvRgId79Uu6ro77VeuzkHyrj2GIzNfKEKaJv_uKmE0zMyunl_rhTLO8bCU/s1600/8c2d6303877008a6932869199058a91eff628288.jpg" imageanchor="1"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1ynK905WiEXX93VjOC8wIvQ6cDf-Ou1OpV8J2Tf7IGqDP3f9WlnotF7t3ePvQoEtaxlGSFMzoHoQnYA6wnvvRgId79Uu6ro77VeuzkHyrj2GIzNfKEKaJv_uKmE0zMyunl_rhTLO8bCU/s320/8c2d6303877008a6932869199058a91eff628288.jpg" width="320" /></a></div>
<br />
Vậy với một cộng đồng người nhỏ hơn - lập trình viên, điều thú vị gì sẽ diễn ra?<br />Và như tiêu đề, đối tượng mình đề cập đến trong bài viết này diễn đàn hỏi đáp dành riêng cho lập trình viên - Stackoverflow. Và tất nhiên bao gồm cả trang stackexchange cũng đã cập nhật cá tháng tư như người người anh của mình.<br /><br /><br />
<h3 style="text-align: left;">
TADA!!!</h3>
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKde__JL2DXvNEtHhw1Ba7QKQXQD94UPYGWR3ocYZtrfOvJMc-BARL_d8QqItbIIEckBrD5TROxvoEaUut680Zul6acDo1qbK7DJkjmAhJ7T63OgeTlBHBT_c0J7bWXJxcWN9npa695w4/s1600/full+screen.PNG" imageanchor="1"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKde__JL2DXvNEtHhw1Ba7QKQXQD94UPYGWR3ocYZtrfOvJMc-BARL_d8QqItbIIEckBrD5TROxvoEaUut680Zul6acDo1qbK7DJkjmAhJ7T63OgeTlBHBT_c0J7bWXJxcWN9npa695w4/s640/full+screen.PNG" width="640" /></a></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
Điều bất ngờ xuất hiện khi truy cập vào 1 bài viết bất kỳ chứ không phải trang chủ, một giao diện vừa quen thuộc vừa lạ lẫm, một phong cách thiết kế từ thập niên 90 với sự màu mè mà đến mình còn tưởng vào lộn chỗ!! =)))<br /><br /><h3 style="text-align: left;">
Cùng điểm qua vài điều hay ho của stackoverflow's april fool nào:</h3>
</div>
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZMuntUyqEN-d-DAp8hORqyZoAtaeBPCtKLmm1DmFBmR05poMumpQaSRvnqnQlpLa6gFu6Het6twH3hfXBCK1Cn0vjVwgyTEERMMl26WBrSbSCDBZrQZhhQr4iIFZvddSHYjZE5h89Z7c/s1600/go+to+future.PNG" imageanchor="1"><img border="0" height="313" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZMuntUyqEN-d-DAp8hORqyZoAtaeBPCtKLmm1DmFBmR05poMumpQaSRvnqnQlpLa6gFu6Het6twH3hfXBCK1Cn0vjVwgyTEERMMl26WBrSbSCDBZrQZhhQr4iIFZvddSHYjZE5h89Z7c/s320/go+to+future.PNG" width="320" /></a></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
Hãy cùng chú ý phần bên trái, thường được gọi là left sidebar đó, ngoài phần đầu con ngựa được dùng để "đối" với đuôi nó ở bên phải, ta sẽ cùng chú ý tới khu vực "caution" nhé:</div>
<div style="text-align: left;">
- Nút du hành thời gian "Go to the future": hiệu ứng khi click vào là bạn sẽ được "trở về hiện tại" thôi, nghĩa là stackoverflow trở về nguyên trạng như chưa có gì sảy ra</div>
<div style="text-align: left;">
- Và một điểm có lẽ ít người để ý, đó là dòng chữ "Big changes for Y2K!". Y2K là một cụm từ nói về vấn đề xử lý thời gian của máy tính, trước năm 2000, người ta đã lường trước việc rất nhiều hệ thống máy tính bị sụp đổ do thời gian thay đổi từ mốc 1999 tới 2000. Để biết thêm chi tiết, mời bạn đọc google từ khoá Y2K nhé!!<br /><br /><div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgP8QrkH2RsVdMDhFWnjiUUkrwuQYU-wsk8C3u4jbGpmsEy0nbeIk6guDUeTAg4O-HyVsy46Gh_Rt4F3g5U0Qrh-E-tjRnRIA00C4N9_li_ARLK_VZ183mpx8nve_QH92ZXqZAPOzQ_gbY/s1600/time+travel.PNG" imageanchor="1"><img border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgP8QrkH2RsVdMDhFWnjiUUkrwuQYU-wsk8C3u4jbGpmsEy0nbeIk6guDUeTAg4O-HyVsy46Gh_Rt4F3g5U0Qrh-E-tjRnRIA00C4N9_li_ARLK_VZ183mpx8nve_QH92ZXqZAPOzQ_gbY/s400/time+travel.PNG" width="400" /></a></div>
</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Và nút "time travel" cũng xuất hiện ở top nav - thứ duy nhất "bỗng nhiên" xuất hiện ở thập niên 90.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi83E-J3EYx918fXyUtIu9yTfdgPfHh3BIV77r7cg_aYwu81SE7-vKpZWyke8rdYcinGnyVkUlY0dvLU2gmtxe4r3sDsr3JjxoL01nJdzaMXDWk9wzUf6xhBLgnCP9erBKmG4CXZ_2xyBU/s1600/running+bann%25E1%25BA%25BB.PNG" imageanchor="1"><img border="0" height="82" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi83E-J3EYx918fXyUtIu9yTfdgPfHh3BIV77r7cg_aYwu81SE7-vKpZWyke8rdYcinGnyVkUlY0dvLU2gmtxe4r3sDsr3JjxoL01nJdzaMXDWk9wzUf6xhBLgnCP9erBKmG4CXZ_2xyBU/s640/running+bann%25E1%25BA%25BB.PNG" width="640" /></a></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Và thứ "mà lâu rồi rồi chúng ta chưa gặp mặt" cũng được xuất hiện, vẫn này chạy cuộn lung tung và dùng font chữ của những bậc thầy thiết kế thời bấy giờ!!<br /><br /><div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjri07dVkKZ70uzSwNza3GF2gE7bg3Y0c-JH53sOqL54sAVbUCQVCU4gLYpS0V5GyI5vTRRwP-jBf8Pt3RI_aUq4s9BVj-FOcqxW-b_hZrCUfy4pHCsMJW4XMwhguHoL2LRc5bCX2WYkk0/s1600/guestbook.PNG" imageanchor="1"><img border="0" height="230" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjri07dVkKZ70uzSwNza3GF2gE7bg3Y0c-JH53sOqL54sAVbUCQVCU4gLYpS0V5GyI5vTRRwP-jBf8Pt3RI_aUq4s9BVj-FOcqxW-b_hZrCUfy4pHCsMJW4XMwhguHoL2LRc5bCX2WYkk0/s640/guestbook.PNG" width="640" /></a></div>
</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Và phần cuối cùng, 1 guestbook to tướng ngay phía trước footer.</div>
<h2 style="text-align: left;">
Tuy nhiên</h2>
<div style="text-align: left;">
Liệu rằng với một lập trình viên thì từng đó đã đủ thoả mãn chưa? Với mình thì chưa, vậy lên chúng ta ngó nghiêng tiếp nhé!!</div>
<div style="text-align: left;">
<br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyb5NULq-YrFv_Og3AhRM2X1k2KUr_iksD4Gj8pnx4rpMjEURgQ8WkNIP77ObdFJhmfqCBDC8afvdWwQcr6uI-o-ExKiVSsDmBZ5UZvBeRG0t3-IqF-a_XMLSIGrHRo321-SHU4GSjoT4/s1600/html+comment.PNG" imageanchor="1"><img border="0" height="322" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyb5NULq-YrFv_Og3AhRM2X1k2KUr_iksD4Gj8pnx4rpMjEURgQ8WkNIP77ObdFJhmfqCBDC8afvdWwQcr6uI-o-ExKiVSsDmBZ5UZvBeRG0t3-IqF-a_XMLSIGrHRo321-SHU4GSjoT4/s640/html+comment.PNG" width="640" /></a></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Khi coi code của trang, nhìn ngó một chút thì anh bạn kỳ lân của chúng ta lại xuất hiện ở đây dưới dạng 1 ascii art.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyyVjLiz0TfkZoMUsfWtR2PFQUTc1FeXs1XSrWinDyfuZNXOq0mzGEupTpoYJlIk4S92RiXJMFhxb1Y479jJ_Mfjl6zMAieLFN1zp-Ji5HpseuNhkjGx9bZb7bSSd48sNGQVhzHy6GrMQ/s1600/fake+comment.PNG" imageanchor="1"><img border="0" height="464" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyyVjLiz0TfkZoMUsfWtR2PFQUTc1FeXs1XSrWinDyfuZNXOq0mzGEupTpoYJlIk4S92RiXJMFhxb1Y479jJ_Mfjl6zMAieLFN1zp-Ji5HpseuNhkjGx9bZb7bSSd48sNGQVhzHy6GrMQ/s640/fake+comment.PNG" width="640" /></a></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Và một đoạn mã chứa những comment xuất hiện trong phần guestbook, hãy cố gắng đọc hết chúng nhé!! Rất thú vị đấy!!<br /><br /><h3 style="text-align: left;">
Kết.</h3>
Vậy là dù tại thời điểm mình viết bài này, tại Việt Nam vẫn chưa chuyển sang ngày 1-4-2019, nhưng stackoverflow đã đi trước một bước so với các công cụ công nghệ khác, đem lại nhiều thứ hay ho nhất là "ký ức" về những gì website trước đây từng là.<br /><br /><br /><i>*Link bài mình lấy mẫu chụp ảnh: <a href="https://stackoverflow.com/questions/55440055/cant-remove-data-because-of-child-reference-error">https://stackoverflow.com/questions/55440055/cant-remove-data-because-of-child-reference-error</a></i></div>
</div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-7212661668877548521.post-21304078861868093152016-11-09T23:51:00.000+07:002016-11-09T23:52:49.205+07:00Lại vấn đề giải thuật... Căn bậc 2 của một số??? How to SQRT(x)??<div dir="ltr" style="text-align: left;" trbidi="on">
Không biết có được coi là vấn đề nhức nhối không nhỉ??.. :v<br />
<br />
Cái vấn đề căn bậc 2 của một số nguyên dương hẳn là ai ai cũng biết rồi... từ việc lần mò tính toán rồi nhớ nhớ quên quên mấy cái công thức hay dãy ăn sẵn gì gì ấy trong toán đại số ( đậu,.. mình ghét Đại.. :'( ) cho tới làm sao để máy tính hiểu rồi tính hộ mình được thì ai cũng thấy quen thuộc rồi...<br />
Và cái √ còn xuất hiện ở rất nhiều nơi, có mặt ở hết công thức toán học này, lại đến công thức vật lý nọ,... Cơ bản thì nghĩ cũng đau đầu phết,... nhất là khi vấn đề rơi vào đầu cái thằng ghét đặc toán như mình,.. ( làm mình lại nhớ đến cảnh Đờ Sa Cu Ra,.. à nhầm Dracula ăn phải bát bún tưới giấm tỏi ớt.. :v )<br />
<br />
Thôi,.. xàm xàm suốt lại bị các thánh chửi,.. em vào đề vậy,... Chả là hôm bữa,.. "đi chơi ở Hà Nội" bị "cả hội" đố tính cạnh của hình vuông, cho trước diện tích... ô uê...<br />
<br />
<script src="https://gist.github.com/DK189/0fcbeafd8cfdc4943552de8b49f0b779.js?file=easy_way.cpp"></script>
cơ mà điều kiện là méo được động đến thư viện nào cả,.. chơi với rẽ nhánh, với lặp, với +-*/ thôi...<br />
ờ,.. cũng ô tô kê,.. lại hì hục code code kiếc kiếc cái hàm,...<br />
<br />
<script src="https://gist.github.com/DK189/0fcbeafd8cfdc4943552de8b49f0b779.js?file=without_cmath_library.cpp"></script>
Có mỗi thế thôi mà,... cần chi phải viết blog nhỉ.. ??..!!<br />
<br />
Đùa thế chứ chưa hết đâu,.. hôm nay ngồi trên giảng đường ấy,.. tiết thảo luận thì cô cho "chơi" mà... hehe,.. vậy là bỏ nháp ra chơi game,.. ngồi một lúc tự dưng ngâm ra được cái ý nghĩ giảm độ phức tạp của chương trình tính căn bậc 2 xuống,.. test tiếc các kiểu, check vài trường hợp nhỏ,.. bắt đầu viết giả mã và chạy tay,... âu dia... quay sang hỏi thằng bạn,.. giờ tính căn của một số thì mày làm thế nào?? ừa,... để tao đoán nhé,.. for à,... nó ngẫm nghĩ một lúc,... nghe cách nó cũng thấy khá hay,.. giảm được cơ số độ phức tạp luôn!! :v<br />
<br />
Cách nó thì thế này ( mình chỉ nói lại ý hiểu của mình theo cách nó mô ta chứ chưa code thử ) :<br />
- B1: Tạo số a bằng số bị căn<br />
- B2: Lấy a chia cho 2 rồi gắn kết quả vào a<br />
- B3: Kiểm tra a * a có lớn hơn số bị căn, nếu có thì quay lại bước 2, không thì qua bước 4<br />
- B4: Tới đây thì lại chạy cái vòng lặp for hay while gì đó để tính căn,.. khác là mình cho chạy soChia từ a thôi.. :3<br />
<br />
Cơ mà với mình thì chưa thoả mãn.. :3<br />
Vậy là từ cái đống trong 2 tờ nháp,.. mình bắt đầu code trên máy,.. và sau một hổi test, debug các các kiểu cuối cùng cũng ra lò.. :3
<br />
<script src="https://gist.github.com/DK189/0fcbeafd8cfdc4943552de8b49f0b779.js?file=my_sqrt.cpp"></script>
<br />
Trên là code của mình đã commend các kiểu cho dễ hiểu,.. mình đã test với một vài trường hợp và với ví dụ input của chương trình là:<br />
900000000000000 thì kết quả nhận được là 30000000 với số lần lặp của trường hợp này là 17!!<br />
<br />
à, code của mình mới chỉ tính căn của các số nguyên dương thôi,.. các bạn có cao kiến gì thì chỉ mình với nhé!!<br />
<br />
Trên là phần xàm xàm của mình, các bạn có gì góp ý thì commend cho mình biết với nhé!!<br />
<br />
Thanks for watch!</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7212661668877548521.post-83896009069577970822016-11-03T00:15:00.000+07:002016-11-03T00:15:32.739+07:00Bài toán Lát Gạch và Fibonanci và BigInteger<div dir="ltr" style="text-align: left;" trbidi="on">
Bài toán gốc nằm ở đây: http://vn.spoj.com/problems/LATGACH/<br />
<br />
Nguyên văn đầu bài như sau:<br />
<br />
<span style="background-color: white; color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px; text-align: justify;">Cho một hình chữ nhật kích thước 2xN (1<=N<=100). Hãy đếm số cách lát các viên gạch nhỏ kích thước 1x2 và 2x1 vào hình trên sao cho không có phần nào của các viên gạch nhỏ thừa ra ngoài, cũng không có vùng diện tích nào của hình chữ nhật không được lát.</span><br />
<span style="background-color: white; color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px; text-align: justify;"><br /></span>
<br />
<div style="text-align: justify;">
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;">Sau khi ngồi ngâm cứu cùng anh em,... mình phát hiện ra bài toán này có bộ input và output là vị trí và kết quả tương ứng của dãy fibonanci... </span></span><br />
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;"><br /></span></span>
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;">kết quả test ban đầu như sau:</span></span><br />
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;"><br /></span></span>
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;">N: 1 2 3 4 6 7</span></span><br />
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;">KQ: 1 2 3 5 8 13</span></span><br />
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;">mấy anh em mình chỉ test đến 7 thôi chứ vẽ ra giấy nó hoa hết cả mắt,.. ( mà mình học xác suất ngu lắm,.. chứ không thì đã đi chơi xổ số kiểu mĩ rồi.. :v )</span></span><br />
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;"><br /></span></span>
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;">nhìn theo cái dãy kết quả thì nó khá tương đông với dãy fibonanci</span></span><br />
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;">1 1 2 3 5 8 13 21 ...</span></span><br />
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;"><br /></span></span></div>
<div style="text-align: justify;">
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;">Ok,.. vậy ra nó là chơi với Fibo à.. :3 ( đoán thế,.. chưa accept thì chưa biết thế nào )<br />Thế là anh em ngồi code vài dòng đệ quy của fibo:</span></span></div>
<div style="text-align: justify;">
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;"><br /></span></span></div>
<div style="text-align: justify;">
<script src="https://gist.github.com/DK189/d9b3682c5300c4a6093191c1c87c9b9f.js?file=fibo_emrua.cpp"></script>
</div>
<div style="text-align: justify;">
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;"><br /></span></span></div>
<div style="text-align: justify;">
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;">Ơ,.. nhưng để ý tiếp yêu cầu của bài,.... giới hạn về thời gian vậy nên chỉ fibo thôi chưa đủ,.. chứ tính trường hợp xấu nhất xem,.. số test case là 100 và test case là 100... vậy là một anh đề xuất,.. hay là ta khởi tạo một mảng fibo 100 phần tử ban đầu xem!! Ừm nhất chí,.. có xấu xa thế nào thì cũng chỉ phải đệ quy 100 lân đầu.. :v</span></span><br />
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;">Riêng mình thì sẽ gắn cờ và chơi lưu vết... là đi đến đâu mới cắm cờ đến đấy ý... như vậy sẽ không nhất thiết phải chạy hết 100 lần fibo..<br />
<script src="https://gist.github.com/DK189/d9b3682c5300c4a6093191c1c87c9b9f.js?file=fibo_long.cpp"></script>
</span></span><br />
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;"><br /></span></span>
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;"><br /></span></span><span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;">Yeah..!! Sau khi cơ bản đã ổn thoả,.. Submit thôi,... oh no... báo Wrong các bạn ạ,... vậy là mình thử test trường hợp xấu nhất,... FIBO[100],.. theo trương trình c++ của mình là một số có 20 chứ số,.. tra google thì ra cái list fibo và ôi trời ơi,.. FIBO[101] có độ dài là 22 chữ số,.. vậy nên mình nghĩ ngay tới BigInt,..<br />Vì đề hiếu hơn về BigInt, mình có google và ra một số bài trên stackoverflow hay cộng đồng C Việt,.. cơ mà mình đọc méo hiểu gì,... nội dung của mấy cái đó đều xoay quanh việc làm sau để phân mảnh dữ liệu thành nhiều phần nhỏ để lưu trữ một biến lớn,... ( chắc tại mình ngu ý mà :3 ),.. cuối cùng mình nghĩ đến xử lí chuỗi,... theo quan điểm của mình thì làm kiểu phân mảnh như mấy bài kia chắc là đẹp nhất, tối ưu nhất và hiệu quả hơn các dùng chuỗi mà mình làm... nhưng đọc mấy cái đấy khó hiểu nên tự làm cái dễ dễ thôi....<br /><br />
<script src="https://gist.github.com/DK189/d9b3682c5300c4a6093191c1c87c9b9f.js?file=BigInt.cpp"></script>
</span></span><br />
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;">Và như trên chính là cách mình áp dụng để làm phép được tính + của kiểu BigInt, sau đó thay long long FIBO thành BigInt FIBO thôi... hehe!!<br /><br />Và Cuối dùng, sau khi mọi thứ đã hoàn thiện, đây là code mình đã Submit lên và Accept!!</span></span><br />
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;"><br /></span></span>
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;">
<script src="https://gist.github.com/DK189/d9b3682c5300c4a6093191c1c87c9b9f.js?file=LATGACH.cpp"></script>
</span></span>
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;"><br /></span></span>
<span style="color: #555555; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="background-color: white; font-size: 14px;">Toàn bộ code: </span><span style="font-size: 14px;">https://gist.github.com/DK189/d9b3682c5300c4a6093191c1c87c9b9f</span></span></div>
</div>
Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-7212661668877548521.post-9345791738781404502016-03-11T09:03:00.000+07:002016-05-12T14:03:02.985+07:00[JavaScript Tricks] Thêm phương thức "ngày trong tuần" cho lớp Date<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhu5uyUcECvr_hy_RbGNKxedS8ULPX0tR-9Pn_HgbCzItsh8hBl2l3mxgLbJ4JfABBN4qSEoN76Iref75UFxDbPv7Q-icxYfNv1HprLFn6b0rsKoCYchcAaxHZlaAFGu6PMOsMVohQ2Bg/s1600/Logo.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="152" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhu5uyUcECvr_hy_RbGNKxedS8ULPX0tR-9Pn_HgbCzItsh8hBl2l3mxgLbJ4JfABBN4qSEoN76Iref75UFxDbPv7Q-icxYfNv1HprLFn6b0rsKoCYchcAaxHZlaAFGu6PMOsMVohQ2Bg/s320/Logo.PNG" width="320" /></a></div>
<br />
Khi làm việc với javascript, hẳn không ai là không biết đến lớp Date cũng như việc sử dụng các đối tượng từ lớp Date. Trong bài viết này, mình sẽ hướng dẫn mọi người thêm phương thức getWDay vào lớp Date nhằm thêm chức năng lấy ngày trong tuần dưới dạng chữ với cú pháp đơn giản.<br />
<br />
Để bắt đầu, phiên mọi người mở cửa sổ console của trình duyệt lên ( Phím tắt F12 trên đa số trình duyệt ).<br />
<br />
Khởi tạo một đối tượng từ Date: <span style="color: red;">var</span><span style="color: blue;"> </span>a = <span style="color: red;">new </span><span style="color: blue;">Date</span>();<br />
Lúc này ta có thể dùng đối tượng a và các phương thức của nó!!<br />
<br />
Lúc này bạn hãy thử dòng lệnh sau: <span style="background-color: white; color: #222222; font-family: "consolas" , "lucida console" , monospace; font-size: 12px; white-space: pre-wrap;">console.log(a.getDay());</span><br />
Dữ liệu trả về là một số và nếu dùng <span style="background-color: white; color: #222222; font-family: "consolas" , "lucida console" , monospace; font-size: 12px; white-space: pre-wrap;">console.log(typeof a.getDay()); </span>thì ta thu được kiểu dữ liệu mà getDay trả về là kiểu số.<br />
<br />
Lúc này, ta sẽ lợi dụng phương thức getDay của class Date để tạo phương thức getWDay nhằm trả về ngày trong tuần ở dạng chữ như Monday, Tuesday,... Thứ hai, Chủ nhật,.... blabla...<br />
<br />
<span style="background-color: white; color: #222222; font-family: "consolas" , "lucida console" , monospace; font-size: 12px; white-space: pre-wrap;">Date.prototype.getWDay = function () {
var arr = [
"Chủ nhật",
"Thứ hai",
"Thứ ba",
"Thứ tư",
"Thứ năm",
"Thứ sáu",
"Thứ bảy"
];
return arr[this.getDay()];
};
</span><br />
<div>
<span style="background-color: white; color: #222222; font-family: "consolas" , "lucida console" , monospace; font-size: 12px; white-space: pre-wrap;"><br /></span></div>
<div style="text-align: left;">
Sau khi chạy đoạn mã trên, lúc này khi tạo đối tượng thuộc lớp Date, các đối tượng sẽ được kế thừa thêm phương thức getWDay. Để tuỳ biến dạng thứ trả về, bạn có thể thay đổi trực tiếp trong đoạn mã trên.<br />
<br />
Giờ chỉ cần chạy a.getWDay() để xem nó có trả về đúng thứ như trên hệ thống không!!<br />
<br />
<span style="color: magenta;">+Bonus+ </span>Đoạn mã rút gọn chèn trực tiếp vào website:</div>
Date.prototype.getWDay = function () {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"][this.getDay()];<br />
};<br />
<div>
<br /></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7212661668877548521.post-25551859433923182872015-11-28T00:56:00.002+07:002015-11-28T00:56:57.048+07:00Cà Phê - tôi uống và lảm nhảm.<div dir="ltr" style="text-align: left;" trbidi="on">
Hôm nay được dịp nhâm nhi Cà Phê với vài người bạn, tôi bỗng nhiên lại nổi ứng viết lách một chút. Chủ đề thì như tiêu đề thôi, xoay quanh ly Cà Phê ( Đen ).<br /><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjp-PLS3MXPvNnjOmoYKQBuIqYiSYgTEaGdB1enqoqtRX6-TwxFZxuEdN19XXAOPaACZuG26Y9ChWiplGIJliANsc_mgUZ2Hs-z2FmrhcuQ1bDDgKTMZLByzl7nqDYE4aKxGO5wky_MO9I/s1600/12190905_164251130590766_2368455391599023733_n.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="356" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjp-PLS3MXPvNnjOmoYKQBuIqYiSYgTEaGdB1enqoqtRX6-TwxFZxuEdN19XXAOPaACZuG26Y9ChWiplGIJliANsc_mgUZ2Hs-z2FmrhcuQ1bDDgKTMZLByzl7nqDYE4aKxGO5wky_MO9I/s640/12190905_164251130590766_2368455391599023733_n.jpg" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 12.8px;"><a href="https://www.facebook.com/caphe.lengkeng" target="_blank">Cà Phê Leng Keng</a> - Một góc nhỏ mà đủ to để tôi cảm và nhận tư vị của Cà Phê.</td></tr>
</tbody></table>
<br />Thế nào nhỉ? Ừm thì có chút Cà Phê vào nên não hay hoạt động lung tung, thôi thì để tôi bắt đầu cách tôi và Cà Phê đến với nhau vậy, sau dẫn đến đâu thì hay đến đấy.<br />
<br />Trước đây, chắc cũng lâu lắm rồi, 5 hay 6 năm gì đấy, theo đánh giá về tuổi thì tôi cũng tầm tuổi thanh thiếu niên, mà để tôi tự đánh giá thì cứ nhận mình là trẻ con vậy. Hồi bé tôi nghịch ngợm lắm, vậy nên cũng dễ hiểu khi tôi dám thử nhiều ( cũng may là chưa liều cái món chất cấm - ha ha, đùa thôi :) ). Thủa đấy thì Cà Phê cũng tương đối xa lạ ở vùng quê tôi, nông thôn mà, ăn mì tôm còn lười đun nước chứ đừng nói là mấy anh em ngồi với nhau đợi già nước ngắm giọt Cà Phê rơi, có chăng chỉ là một vài người rời quê hương đi xa xứ, vì cuộc sống làm ăn mà bầu bạn với thuốc lá, Cà Phê. Cũng hay là bố tôi thuộc số ít người đó!<br />
<br />
Bố tôi làm ăn xa nhà từ rất sớm, phải bươn trải nhiều nơi đất khách. Cũng vì việc không đợi người nên hồi ấy, 1 năm cũng chỉ cố về được 2 lần là dịp tết với dịp giữa năm mà thôi. Bố tôi thì hay uống Cà Phê, nên Tết nhất đến là kiểu gì trong nhà cũng thơm hương Cà Phê lắm.<br />
Thơm thì thơm nhưng với thằng nhóc mới lớn như tôi thì nó quyến rũ không phải do thơm mà do "đắng". Đừng nhầm với việc tôi thích đắng nhé, cái tuổi mới lớn như tôi thì chỉ có đường và chế phẩm từ đường mới ngon thôi, "đắng" quyến rũ là bởi nó là sự thách thức với tôi, sự thách thức để đến lớp thì kênh với mấy thằng bạn rằng "Bạn chúng mày 'thích' uống Cà Phê đấy, mày dám thử không?". Thế mà tôi cũng nốc hết cốc Cà Phê thật, cơ bản là mẹ tôi pha thêm nửa cốc ông thọ chứ không chắc tôi cũng chả uống nổi nó rồi!! =))<br /><br />Thế mà cả cái tết tôi lại thích uống Cà Phê - Cà Phê Sữa, vì mẹ tôi pha cho tôi thơm như kẹo, cũng là vì trời lạnh cầm cốc Cà Phê nóng thì ấm,.. mà cái lý do to hơn nữa thì, nhìn "người lớn" hơn bao nhiêu!!! :)<br />Thế là thích Cà Phê rồi!! =))<br /><br />Dần dà thì cái sở thích này nó ngấm vào máu luôn, bị quyến rũ bởi chính Cà Phê chứ không còn là sự thách thức tuổi mới lớn nữa. Tôi bắt đầu thử nhiều loại, Cà Phê tan, Cà Phê phin, Cà Phê sữa, Cà Phê đen, Cà Phê mix,..blabla... nhiều loại quá mà mỗi loại cho tôi những cảm nhận và hứng thú riêng, có lẽ do vậy mà - theo quan điểm cá nhân tôi - "TÔI THƯỞNG THỨC CÀ PHÊ HƠI LẬP DỊ"...<br />Với tôi mà nói, chẳng có thứ Cà Phê gì ngon hay không ngon, chẳng có loại gì là nhất phẩm, nhị phẩm cả.. mỗi tách Cà Phê lại đem theo chất riêng chứ không chẳng hề bắt chước người anh em nào khác. Từ vị đắng của hạt Cà Phê, chất đặc chưng của môi trường nuôi dưỡng, độ rang, độ ủ, cho tới hạt Cà Phê sau khi nghiền hay phin pha Cà Phê lại có chút gì đó riêng làm tách Cà Phê đem lại cho tôi những tư vị riêng.<br /><br />Nhưng theo bạn thì trong tách cà phê có thứ gì riêng không? Tôi nói là có đấy. Từ ngụm đầu tiên cho tới khi ly Cà Phê đã cạn, tôi thấy có thứ gì đó riêng - RẤT riêng của mỗi lần nhấp Cà Phê, có lẽ Cà Phê dễ đổi vị, chỉ cần một tác nhân nhỏ cũng khiến "miếng" Cà Phê có thêm vị mới. Do nguội, do lưỡi bị đánh lừa, Và thứ mà theo tôi thì nó quan trọng hơn cả - Cảm xúc và dòng suy nghĩ. Cá nhân tôi khi đã có chút Cà Phê trong người thì não hay hoạt động bất thường, về vấn đề code, về chuyện chính trị, về tin quốc tế, có khi lại chuyện cuộc sống nhân sinh, à còn cả thơ nữa:<br />
<div style="text-align: center;">
"Thơ thẩn, thẩn thơ, đời thơ thẩn</div>
<div style="text-align: center;">
Đắng miệng, ngọt lòng, ly Cà Phê"<br /><div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Nhưng Cà Phê đâu chỉ là thức uống, nó còn là món gia vị để tôi cảm nhận rõ hơn về cuộc sống xung quanh, từ những việc tôi đã làm, từ những thứ tôi tiếp xúc và cả những mối quan hệ giữa tôi với mọi người. Và tôi nhận ra, cái "triết lý" mà tôi đặt cho cách tôi uống Cà Phê, nó đã chỉ ra khá chính xác về chính bản thân tôi, về cách mà tôi sống.<br /><br /><br /><br /><div style="text-align: center;">
<i>"Mỗi thứ trong cuộc sống đều ứng với một tách Cà Phê, chúng không có khái niệm hay hoặc dở,</i></div>
<div style="text-align: center;">
<i>có chăng là do cách con người ta cảm nhận những vị khác nhau của chúng mà đưa ra những</i></div>
<div style="text-align: center;">
<i>quan điểm mang tính cá nhân về vấn đề mà chính bản thân còn chưa hoản toàn rõ ràng thôi."</i></div>
</div>
</div>
<br />
<br />
<br />
<br /></div>
Unknownnoreply@blogger.com0Quyết Thắng, tp. Thái Nguyên, Thai Nguyen, Vietnam21.585176907261111 105.8065366744995121.58333140726111 105.80401517449951 21.587022407261113 105.80905817449951tag:blogger.com,1999:blog-7212661668877548521.post-6481137303904472692015-10-14T22:27:00.001+07:002015-10-15T23:31:33.352+07:00Hướng dẫn lấy link tải video, nhạc trên các website không cho tải trực tiếp.<div dir="ltr" style="text-align: left;" trbidi="on">
<i>Bài viết này mình sẽ hướng dẫn các bạn cách tải video hoặc nhạc trên website bất kì nào đó mà không cần phải cài đặt ứng dụng, plugin hay extension nào.</i><br />
<br />
<h3>
</h3>
<h4>
</h4>
<h3>
</h3>
<h3>
<br />
<ul style="text-align: left;">
<li><span style="font-size: large;">Cách 1: Lợi dụng khả năng "bắt các gói tin" trong bộ công cụ dành cho nhà phát triển của trình duyệt. </span></li>
</ul>
<br />
</h3>
<ul style="text-align: left;">
<li><span style="font-size: small;">( dùng được trên hầu hết các trang web, gồm cả trình phát HTML5 hoặc Flash )</span></li>
</ul>
<br />
<ol style="text-align: left;">
<li>B1. Bạn truy cập vào trang web chứa video hay nhạc bạn cần tải</li>
<li>B2. Tiếp đó mở công cụ dành cho lập trình viên lên:<br /><br />Phím tắt:<br /> Chrome: <span style="color: lime;">CTRL + SHIFT + J</span><br /> FireFox: <span style="color: lime;">CTRL + SHIFT + U</span><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCGJ3wbiCG0Mk_cvIVipzmGGGdgnT5IwLXFKKw1nCt4VP8zgkdInYO-hk8GCo7j86D12hphdglXRFOZupRzItD_8xSo4r9IOs5Vma29Ptjp9yZ1ouPiIeMfL6ZTjTF07TvqBSVMLcbv7g/s1600/0.png" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: center;"><img border="0" height="210" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCGJ3wbiCG0Mk_cvIVipzmGGGdgnT5IwLXFKKw1nCt4VP8zgkdInYO-hk8GCo7j86D12hphdglXRFOZupRzItD_8xSo4r9IOs5Vma29Ptjp9yZ1ouPiIeMfL6ZTjTF07TvqBSVMLcbv7g/s400/0.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: small; text-align: left;">Hoặc chọn setting -> công cụ khác -> </span><span style="color: lime; font-size: small; text-align: left;">Công cụ dành cho nhà phát triển</span></td></tr>
</tbody></table>
<br /><br /><span style="color: lime;"><br /></span></li>
<li>B3. Cửa sổ Developer Tolls hiện lên, bạn chọn tab Network, mở tính năng Fillter và chọn lọc Media ( tệp đa phương tiện: video, audio )<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4zLWvuGIRpcU_nxrMK10KYg9MelJtBkPqoyvt72MZpVE-1G4MDrKioZkR_by0Mm3_KLvkv4yNCvtA9c38LNaytxPB3QaZiQLJ4LPnVBCARybCz6P1fLpJ6XPzjPRrf939s7kpM4D7XaI/s1600/console+network.PNG" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto; text-align: center;"><img border="0" height="129" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4zLWvuGIRpcU_nxrMK10KYg9MelJtBkPqoyvt72MZpVE-1G4MDrKioZkR_by0Mm3_KLvkv4yNCvtA9c38LNaytxPB3QaZiQLJ4LPnVBCARybCz6P1fLpJ6XPzjPRrf939s7kpM4D7XaI/s400/console+network.PNG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><br /></td></tr>
</tbody></table>
</li>
<li>B4. Lúc này, bạn sẽ thấy 1 (hay nhiều) request xuất hiện trong list, 1 trong số dó chính là tệp tin mà bạn cần tải. Bạn có thể sao chép đường dẫn của các mục này và dùng trình downloader của bạn để tải nó.</li>
<li>(-) NOTE:<br />Trong trường hợp không có dòng nào xuất hiện trong network, bạn vui lòng tải lại trang và bật trình phát của website đó, lúc này bạn sẽ thấy Developer Tools đã bắt được gói tin bạn cần.<br />Nếu trong danh sách có quá nhiều gói tin, bạn có thể dựa vào 1 số đặc điểm của nó, như video thì Size của nó sẽ rất lớn chẳng hạn!! :)</li>
</ol>
<br />
<ol style="text-align: left;">
</ol>
<h3>
<br />
<ul style="text-align: left;">
<li><span style="font-size: large;">Cách 2: Lợi dụng các thuộc tính của thẻ video khi dùng trình phát HTML 5 ( chỉ dùng trên các wbsite sử dụng trình phát HTML5 )</span></li>
</ul>
<br />
</h3>
<div style="text-align: left;">
<ol style="text-align: left;">
<li>B1. Mở công cụ dành cho lập trình viên. ( Cách 1. Bước 2 )</li>
<li>B2. Chọn tab Elements rồi làm như hình!!<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAQQqAxkMc0Rwd6aq_tMDdg3qUFWLH7sllvoO4Ow1AGkwRmfNfow2Z0VlAhf04kq4QXxNTVgl33vJ6Qf2raGqfcuOxeplTtsRheHmMCBpQ7mpvYj7xXwFRmLnFyuZbWPSWmgwP_LIjvvM/s1600/vimeo.png" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: center;"><img alt="Lấy video từ Vimeo.com" border="0" height="222" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAQQqAxkMc0Rwd6aq_tMDdg3qUFWLH7sllvoO4Ow1AGkwRmfNfow2Z0VlAhf04kq4QXxNTVgl33vJ6Qf2raGqfcuOxeplTtsRheHmMCBpQ7mpvYj7xXwFRmLnFyuZbWPSWmgwP_LIjvvM/s400/vimeo.png" title="Vimeo.com" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Vimeo.com</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIRD-lvFB71M2Lbash-YL5tMCLsSiJXifBrqkFK_lnfmVkVbI5y3Y6HYDWdU5d7pcMz0mXX6gutT5iKkrfVRFUZh4vdqaQHkzXqPmnTKJQax0e0SJ8Bh6iWkqXyLJLtMjequkxAGqv9rs/s1600/facebook.png" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: center;"><img alt="Lấy video trên Facebook.com" border="0" height="223" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIRD-lvFB71M2Lbash-YL5tMCLsSiJXifBrqkFK_lnfmVkVbI5y3Y6HYDWdU5d7pcMz0mXX6gutT5iKkrfVRFUZh4vdqaQHkzXqPmnTKJQax0e0SJ8Bh6iWkqXyLJLtMjequkxAGqv9rs/s400/facebook.png" title="Facebook.com" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Facebook.com</td></tr>
</tbody></table>
</li>
</ol>
<b></b><br />
<a name='more'></a><b><br /></b>
<b>Trên đây là 2 cách mình hay dùng tải phim hay nhạc về máy mà không phải mất công cài các ứng dụng, tiện ích không rõ nguồn gốc, các bạn có thể tham khảo để sử dụng, nếu ai có cách nào hay hơn thì comment cho mình tham khảo với nhé!! :')</b></div>
</div>
Unknownnoreply@blogger.com8tag:blogger.com,1999:blog-7212661668877548521.post-1659680308849626322015-07-14T18:38:00.000+07:002015-10-27T06:35:46.386+07:00Tuỳ biến giao diện cho ứng dụng viết bằng C#: Windows Form Application<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); box-sizing: inherit; color: #333333; font-family: Arial; font-size: 19px; line-height: 31.9998px; margin: 0px; outline: 0px; padding: 5px 10px; vertical-align: baseline;">
Như tiêu đề của bài viết, trong lần gõ phím này mình sẽ hướng dẫn các bạn tuỳ biến lại giao diện của ứng dụng khi viết bằng Visual C#: Windows Forms Application</div>
<div style="background-color: white; border: 0px; box-sizing: inherit; color: #333333; font-family: Arial; font-size: 19px; line-height: 31.9998px; margin-bottom: 1.6842em; outline: 0px; padding: 0px; text-align: left; vertical-align: baseline;">
Vì mình cũng chỉ mới bắt đầu học thôi nên có thể cách tuỳ biến của mình chưa được tốt cho lắm, vậy nên nếu bạn nào thấy có cách khác hay hơn, đơn giản hơn thì chia sẻ với mình và mọi người nhé!!</div>
<div style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); box-sizing: inherit; color: #333333; font-family: Arial; font-size: 19px; line-height: 31.9998px; margin: 0px; outline: 0px; padding: 5px 10px; vertical-align: baseline;">
<span style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: 700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">NOTE: </span>Bài viết này mình chỉ hướng dẫn tuỳ chỉnh giao diện với ứng dụng non-resize, nghĩa là ứng dụng của bạn sẽ chỉ có 1 kích cỡ duy nhất, dù vậy nhưng sau bài này, bạn hoàn toàn có thể tự thêm được chức năng resize vào ứng dụng của mình!!</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="background-color: white; font-family: Arial; font-size: 3.2rem; font-style: italic; line-height: 1.25;"><span style="color: red;">Giờ thì vào chủ đề chính – tuỳ biến giao diện của ứng dụng:</span></span>
</div>
<ul style="background-color: white; border: 0px; box-sizing: inherit; font-family: Arial; font-size: 19px; line-height: 31.9998px; margin: 0px 0px 1.6842em; outline: 0px; padding: 0px; text-align: left; vertical-align: baseline;">
<li style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; box-sizing: inherit; color: #333333; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; text-align: center; vertical-align: baseline;">Để bắt đầu thì mình sẽ tạo 1 project mới của <span style="background-color: #eeeeee; border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Windows Forms Application</span> nếu bạn muốn thì có thể làm trực tiếp vào trong 1 project đã tạo sẵn của bạn!!<iframe frameborder="0" height="320" scrolling="no" src="https://drive.google.com/file/d/0BzD4IRIPMYwsNnk2a1VNM1NDeDg/preview" style="border-style: initial; border-width: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px 0px 1.6842em; max-width: 100%; outline: 0px; padding: 0px; vertical-align: middle;" width="640"></iframe></li>
<li style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; box-sizing: inherit; color: #333333; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Sau khi đã tạo xong, tại cửa sổ Properties, ta sửa thuộc tính FromBorderStyle thành None<br /><br /><div style="text-align: left;">
<div style="text-align: center;">
<iframe frameborder="0" height="160" scrolling="no" src="https://drive.google.com/file/d/0BzD4IRIPMYwsWlAwQU1QbDB3akE/preview" style="border-style: initial; border-width: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; vertical-align: middle;" width="300"></iframe><span style="font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 31.9998px; text-align: center;">►</span><iframe frameborder="0" height="160" scrolling="no" src="https://drive.google.com/file/d/0BzD4IRIPMYwsQTE2S2tLci1iMzA/preview" style="border-style: initial; border-width: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; max-width: 100%; outline: 0px; padding: 0px; vertical-align: middle;" width="300"></iframe></div>
</div>
</li>
<li style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; box-sizing: inherit; color: #333333; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><span style="line-height: 31.9998px;">Sau bước trên, bạn sẽ thu được cái 1 ô vuông đơn điệu, nhìn max tù luôn,… vậy bây giờ bắt tay vào tuỳ biến thui..!!</span></li>
<li style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; box-sizing: inherit; color: #333333; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Giờ chúng ta sẽ kéo và thả những đối tượng cần thiết cho cái form của mình<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Danh sách gồm:<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">4 cái panel</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">1 cái label</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">2 cái button</li>
</ul>
</li>
</ul>
</li>
<li style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; box-sizing: inherit; color: #333333; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Giờ thì đặt tên và đặt các thuộc tính cho chúng. À còn 1 điều nữa, ta sẽ phải đặt cho cái form 1 kích cỡ nhất định,… mình sẽ đặt 640px * 480px, bạn hoàn toàn có thể đặt các kích cỡ khác cho ứng dụng tuỳ vào mục đích của bạn!!<br /><br /><div style="text-align: center;">
<iframe frameborder="0" height="270" scrolling="no" src="https://drive.google.com/file/d/0BzD4IRIPMYwsbGc1Ujg4WmlYZUU/preview" style="border-style: initial; border-width: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px 0px 1.6842em; max-width: 100%; outline: 0px; padding: 0px; vertical-align: middle;" width="480"></iframe></div>
</li>
<li style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; box-sizing: inherit; color: #333333; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Giờ thì đến phần tuỳ chỉnh cho cái form, hãy vận dụng khả năng sáng tạo nên cao nhất nhé,… mình thì thuộc loại người "mù thẩm mỹ" nên toàn để BackColor = Black và ForeColor = White<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Chọn panel1<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Mình đặt lại tên cho nó thành border_top : (Name) = border_top</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt size cho nó là 640, 30 và Location là 0,0</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt Dock thành Top và gán Locked = True</li>
</ul>
</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Chọn panel2<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt tên là border_left : (Name) = border_left</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đạt size là 5, 450 và Location là 0, 30</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt Dock là Left và gắn Locked = True</li>
</ul>
</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Chọn panel3<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt tên là border_right : (Name) = border_right</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đạt size là 5, 450 và Location là 635, 30</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt Dock là Right và gắn Locked = True</li>
</ul>
</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Chọn panel4<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt tên là border_bottom : (Name) = border_bottom</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đạt size là 630, 5 và Location là 5, 475</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt Dock là Bottom và gắn Locked = True</li>
</ul>
</li>
</ul>
</li>
<li style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; box-sizing: inherit; color: #333333; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Như vậy là đã tạo xong cái viền bao, Ctrl + F5 để nghía qua cái Form nào.. !!!<br /><div style="text-align: justify;">
<br />
<div style="text-align: center;">
<iframe frameborder="0" height="225" scrolling="no" src="https://drive.google.com/file/d/0BzD4IRIPMYwsV19aX211S3lIdnM/preview" style="border-style: initial; border-width: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px 0px 1.6842em; max-width: 100%; outline: 0px; padding: 0px; vertical-align: middle;" width="400"></iframe></div>
</div>
</li>
<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
</ul>
<li style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; box-sizing: inherit; color: #333333; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Giờ là đến cái tiêu đề và các phím điều khiển:<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Chọn label1<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Mình đổi tên nó thành title đề dễ nhớ: (Name) = title</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt Location 0,0</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt Font.Size = 26 với Font.Unit = Pixel</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Sau đó khoá nó lại: Locked = True</li>
</ul>
</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Chọn button1<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đổi tên thành b_close : (Name) = b_close</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt size là 30,30 và Location: 610,0</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt FlatStyle = Flat</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt FlatAppearance.BorderSize = 0</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Thêm chữ X vào Text cho dễ nhìn :3</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt Font.Unit = Pixel và Font.Size = 18</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Locked = True</li>
</ul>
</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Chọn button2<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đổi tên thành b_minisize: (Name) = b_minisize</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt size là 30,30 và Location:580,0</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt FlatStyle = Flat</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt FlatAppearance.BorderSize = 0</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Thêm dấu _ vào Text</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Đặt Font.Unit = Pixel và Font.Size = 18</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Locked = True</li>
</ul>
</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Ctrl + F5 và đây là thành quả ban đầu…<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJBRDSaS2ctw-s4IgTKdEF-D8repJt1hn_T1ZfZSmGvyjSaSnBsFAS2rTmA9nTjR0Kwow1vzKsIFjj6BUq7Sx7ilcMf5YpwbO8AgtC2GAA1PgdM9Hertgj-jgyxVKTrLM_mvN1qO_qJAY/s1600/finish.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="246" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJBRDSaS2ctw-s4IgTKdEF-D8repJt1hn_T1ZfZSmGvyjSaSnBsFAS2rTmA9nTjR0Kwow1vzKsIFjj6BUq7Sx7ilcMf5YpwbO8AgtC2GAA1PgdM9Hertgj-jgyxVKTrLM_mvN1qO_qJAY/s320/finish.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Form custom</td></tr>
</tbody></table>
</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Tiếc là không move cửa sổ được, không tắt hay thu nhỏ khi nhấn nút được,…</li>
</ul>
</li>
<li style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; box-sizing: inherit; color: #333333; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Vậy nên giờ ta cần bắt các sự kiện và xử lí để cái form mới này có được các chức năng đúng chuẩn của 1 cửa sổ!!<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Mở tab Event tại cửa số Properties</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Chọn b_close<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Tại Action.Click, ta tạo phương thức và bắt sự kiện cho việc click chuột</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Bên trong phương thức mới được khởi tạo, thêm hàm<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><div style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 1.6842em; outline: 0px; padding: 0px; vertical-align: baseline;">
<pre><code class="csharp">
private void b_close_Click(object sender, EventArgs e)
{
this.Close();
}
</code></pre>
</div>
<div style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 1.6842em; outline: 0px; padding: 0px; vertical-align: baseline;">
</div>
</li>
</ul>
</li>
</ul>
</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Chọn b_minisize<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Tại Action.Click, ta tạo phương thức và bắt sự kiện cho việc click chuột</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Bên trong phương thức mới được khởi tạo, thêm hàm<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><div style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 1.6842em; outline: 0px; padding: 0px; vertical-align: baseline;">
<pre><code class="csharp">
private void b_minisize_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
</code></pre>
</div>
<div style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 1.6842em; outline: 0px; padding: 0px; vertical-align: baseline;">
</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; box-sizing: inherit; color: #333333; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Tiếp. Theo mình thì phần này là phần quan trọng nhất trong bài, thiết lập khả năng kéo thả cho của sổ.<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Chọn border_top ta lần lượt thêm các sự kiện MouseDown, MouseMove và MouseUp</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Tiếp theo ta nhấn F7 hoặc mở tab Form1.cs lên:<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Ta thêm vào class Form1 các thuộc tính<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><div style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 1.6842em; outline: 0px; padding: 0px; vertical-align: baseline;">
<pre><code class="csharp">
private bool keoTha = false;
private Point mouseStart = new Point(0, 0);
</code></pre>
</div>
<div style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 1.6842em; outline: 0px; padding: 0px; vertical-align: baseline;">
</div>
</li>
</ul>
</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Giờ đến xử lí các phương thức:<ul style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: disc; margin: 0px 0px 0px 1.3333em; outline: 0px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">border_top_MouseDown<div style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 1.6842em; outline: 0px; padding: 0px; vertical-align: baseline;">
<pre><code class="csharp">
private void border_top_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left) // Kiểm tra xem người dùng nhấn nút nào.
{
this.keoTha = true;
this.mouseStart = e.Location;
}
}
</code></pre>
</div>
<div style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 1.6842em; outline: 0px; padding: 0px; vertical-align: baseline;">
</div>
</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">border_top_MouseMove<div style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 1.6842em; outline: 0px; padding: 0px; vertical-align: baseline;">
<pre><code class="csharp">
private void border_top_MouseMove(object sender, MouseEventArgs e)
{
if (this.keoTha)
{
Point p = new Point(e.X + this.Location.X, e.Y + this.Location.Y);
Point location = new Point(p.X - this.mouseStart.X, p.Y - this.mouseStart.Y);
this.Location = location;
}
}
</code></pre>
</div>
<div style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 1.6842em; outline: 0px; padding: 0px; vertical-align: baseline;">
</div>
</li>
<li style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">border_top_MouseUp<div style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 1.6842em; outline: 0px; padding: 0px; vertical-align: baseline;">
<pre><code class="csharp">
private void border_top_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left) // Kiểm tra xem người dùng nhấn nút nào.
{
this.keoTha = false;
}
}
</code></pre>
</div>
<div style="border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 1.6842em; outline: 0px; padding: 0px; vertical-align: baseline;">
</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; box-sizing: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><h2 style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; box-sizing: inherit; clear: both; font-family: inherit; font-size: 3.2rem; font-style: italic; line-height: 1.25; margin: 2em 0px 1em; outline: 0px; padding: 0px; vertical-align: baseline;">
<span style="color: lime;">
Bingo!!! Vậy là xong rồi đó, giờ thì nhấn Ctrl + F5 để thưởng thức thành quả thôi.</span></h2>
</li>
</ul>
<h3 style="background-color: white; border: 0px; box-sizing: inherit; clear: both; color: #333333; font-family: Arial; line-height: 1.1852; margin: 2.3704em 0px 1.1852em; outline: 0px; padding: 0px; text-align: left; vertical-align: baseline;">
<span style="font-size: large;">Đọc xong bài viết này, giờ các bạn đã hoàn toàn có thể tự custom lại giao diện thay vì sử dụng 6 loại giao diện sẵn có và không được thẩm mỹ của bác Visual Studio. Nếu các bạn có gì thắc mắc vui lòng comment ở dưới hoặc pm trực tiếp với mình qua facebook của mình!!</span></h3>
</div>
Unknownnoreply@blogger.com0