Archive
How to embed a form in a control – จับ from มาใส่ form
it’s another time there is some asking about how to show form into another form. i have been trying to find around the web to get the example . but i found the answer myself as following example. . . [try to understand my bad English] . ha ha
in this posting i will show how to put existing two form into one main form , by the way i’m doing this in main form i put the tab with two tab pages , first tabpage for first form and anther tab put second form. as following picture.
figure 1. show two tab in main form
By doing this i create the project with main form name form1.cs and another two is anotherform.cs and moreform.cs
First – put two tab into mainform (form1.cs) and place panel1 into tabpage1 and groupbox1 into tabpage2 [please note this the control must be a container control]
then – Create another two form , anotherform.cs and moreform.cs
anotherform.cs
in this form show information of two textbox when you click ‘show information’ button
moreform.cs
in this form the textbox will show the selected text of above combobox…
I will not go in detail of how these two form work i will explain how it work in the main form.
in main form (form1.cs) , see the following code, better then explain…
public void ShowFormInControl(Control myctl, Form myfrm) { myfrm.TopLevel = false; myfrm.FormBorderStyle = FormBorderStyle.None; myfrm.Dock = DockStyle.Fill; myfrm.Visible = true; myctl.Controls.Add(myfrm); } private void button1_Click(object sender, EventArgs e) { anotherForm myform = new anotherForm(); ShowFormInControl(panel1, myform); moreForm myform2 = new moreForm(); ShowFormInControl(groupBox1, myform2); }
in the source code you can see the technique of how to put the form into control in the “ShowformInControl(Control myctl, Form myfrm) ” the function perform putting the form ( myfrm ) into Control( myctl ) as i mention earlier – the control must be container control. without any explanation it’s obviously show in the code…
then the forms are load by the click event of button1. – create form and put into control by calling ShowformInControl where ever you want to put , panel or groupbox or any contrainer control.
hope this will help … s_teerapong2000@yahoo.com
you can download code example here frmAdvance.zip
Real-Time Framework [ Single- to Multi-Server Online Game ]
ได้มีโอกาสร่วมอยู่ในงานวิจัย และพัฒนาเกมที่เป็นกึ่ง ๆ online game แบบ single-server ซึ่ง เดินมาถึงจุดที่ single – server ไม่สามารถให้บริการได้เนื่องจาก มี ผู้ใช้มากขึ้น และจำนวน object หรือ entity ก็มากขึ้นเป็นเงาตามตัวเช่นเดียวกัน การพัฒนาก็เริ่มมอง หา solution ทำจะช่วยแก้ปัญหาโดยต้องใช้ เวลา และ แรงงาน ไม่มากนัก และ RTF ก็เป็น solution หนึ่งที่ น่าสนใจเป็นอย่างยิ่ง ครับ
Real-Time Framework หรือ RTF คือ middleware ที่จะช่วยให้เราสามารถเปลี่ยน Single-Server ให้เป็น Multi-Server online game ครับ อ้างจาก cast study ที่อ้างอิงในบทความนี้ นะครับว่า game ประเภท Fast-paced action เช่น First Persons Shooters หรือ FPS นั้น หากต้องการความสามารถ ในการ ขยายระบบรองรับผู้เล่นจำนวนมาก แล้วละก็ ต้องมี สถาปัตยกรรม แบบ multi-server ถึง จะทำได้ แต่การทำ mult-server นั้นเป็นงานที่ท้าทายต่อผู้พัฒนา เนื่องจาก การประมวลผลจะต้องเป็นการประมวลผลแบบ ขนาน และการ distribute game state ก็ต้องทำอย่าง มีประสิทธิภาพ ครับ สองงานหลัก ๆ ที่ game แบบ multi-server นั้นต้อง จัดการให้ได้ ก็คือ เรื่องของการ ทำให้เป็นการประมวลผลแบบขนาน และ การประสานงาน การแจกจ่ายสถานะของ game ให้ได้ประสิทธิภาพ
เนื่องจากว่า มุมมองที่เราจะนำ RTF มาใช้งานก็คือผู้พัฒนา ที่มี game ที่เป็น single-server เป็นของตัวเองอยู่แล้ว และต้องการ ปรับปรุง ให้เป็น multi-server โดยที่ไม่ต้องไปลือระบบของตัวเอง จนแทบจะเรียกได้ว่า ต้องทำกันไหม อะไร แบบนั้นอะครับ เนื่องจากว่า RTF นั้น จะช่วย ในเรื่องของ การทำ parallelization และ การจัดการกับ game state โดยเฉพาะในเรื่องของการแจกจ่าย game state ให้อัตโนมัติ ผุ้พัฒนาที่ใช้ RTF ไม่ต้องเข้าไปดำเนินการเรื่องนี้ เพียงแค่เรียกใช้ผ่าน hight level support ของ RTF เท่านั้นเอง
เพื่อให้ภาพนะครับ ดูจากภาพ แรก
จากภาพเป็นโครงสร้างและการทำงานของ game แบบ single-server นะครับ จะเห็นว่า server เพียงตัวเดียวควบคุมการทำงานทั้งหมด การคำนวน game states การโต้ตอบกับ ผู้ใช้ และการกระจาย game states กลับไปให้ client ทั้งหมด ครับ รูปต่อไป
จากภาพแสดงให้เป็น สถาปัตยกรรมแบบ Multi-server game จะเห็นว่า งานการประมวลผล game state การโต้ตอบกับผู้ใช้และการ กระจาย game state นั้นถูกแบ่งออกไป ให้ server อื่น ๆ ช่วยทำงาน ซึ่งจะเห็นได้ว่า แน่นอนครับการขยายระบบ การเพิ่มจำนวนผู้เล่น ย่อมเกิดขึ้นได้ โดยสถาปัตยกรรมแบบ mult-server
ปัญหาคือว่า ผู้พัฒนาที่มี game ที่เป็น single-server อยู่ในมือจะทำให้เป็น mult-server ได้ด้วย RTF อย่างไร (ตามที่ได้กล่าวไปแล้วว่า RTF จะช่วยให้ เราเปลี่ยจาก single-server เป็นเป็น Multi-server ได้) จะขอไว้ต่อใน คราวหน้านะครับ
s_teerapong2000@yahoo.com – Soft Speed Solution
Reference
[From a Single- to Multi-Server Online Game: A Quake 3 Case Study Using RTF , Alexander Ploss, Stefan Wichmann, Frank Glinka , and Sergei Gorlatch University of Munster, Germany]