Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,028

HOME > .NET Framework > Forum > VB.NET เรื่องเปิดปิด Form แต่มันไม่ง่ายเลย ผู้รู้มาตอบผมทีครับ -/\-



 

VB.NET เรื่องเปิดปิด Form แต่มันไม่ง่ายเลย ผู้รู้มาตอบผมทีครับ -/\-

 



Topic : 090192

Guest




คือผมอยากจะเปิด Form2 ให้อยู่ติดกับ Form1 ทางด้านซ้ายครับ แค่นี้แหละครับ ผมนั่งลองเขียนโค้ดเกี่ยวกับ Location ให้มัน ทำผิดทำถูกไม่ได้สักที โค้ดที่ผมลองนั่งทำมั่วๆมีดังนี้ครับ

Code (VB.NET)
    Dim XP As Integer
    Dim YP As Integer
    Dim Newpoint As New System.Drawing.Point
    Dim Newpoint2 As New System.Drawing.Point

Private Sub register_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        XP = Form1.Location.X + Me.Location.X
        YP = Form1.Location.Y
        Newpoint = Form1.Location
        Newpoint.X = Newpoint.X + XP
        Newpoint.Y = Newpoint.Y
        Me.Location = Newpoint
    End Sub


ประมานนี้แหละครับ -/\-ขอบคุณที่เข้ามาอ่านครับ



Tag : .NET, VBScript, VB.NET, Windows







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-02-02 18:22:31 By : เจ้าของคำถาม View : 1292 Reply : 2
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ใช้พวก ShowDialog และ StartPosition หรือเปล่าครับ

Code (VB.NET)
Public Sub CreateMyForm()
    ' Create a new instance of the form. 
    Dim form1 As New Form()
    ' Create two buttons to use as the accept and cancel buttons. 
    Dim button1 As New Button()
    Dim button2 As New Button()

    ' Set the text of button1 to "OK".
    button1.Text = "OK" 
    ' Set the position of the button on the form.
    button1.Location = New Point(10, 10)
    ' Set the text of button2 to "Cancel".
    button2.Text = "Cancel" 
    ' Set the position of the button based on the location of button1.
    button2.Location = New Point(button1.Left, button1.Height + button1.Top + 10)
    ' Set the caption bar text of the form.   
    form1.Text = "My Dialog Box" 
    ' Display a help button on the form.
    form1.HelpButton = True 

    ' Define the border style of the form to a dialog box.
    form1.FormBorderStyle = FormBorderStyle.FixedDialog
    ' Set the accept button of the form to button1.
    form1.AcceptButton = button1
    ' Set the cancel button of the form to button2.
    form1.CancelButton = button2
    ' Set the start position of the form to the center of the screen.
    form1.StartPosition = FormStartPosition.CenterScreen

    ' Add button1 to the form.
    form1.Controls.Add(button1)
    ' Add button2 to the form.
    form1.Controls.Add(button2)

    ' Display the form as a modal dialog box.
    form1.ShowDialog()
End Sub 'CreateMyForm


Code
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.startposition.aspx







แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-03 21:59:59 By : mr.win
 


 

No. 2

Guest


ขอบคุณครับพี่วิน
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-03 22:57:10 By : เจ้าของคำถาม
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : VB.NET เรื่องเปิดปิด Form แต่มันไม่ง่ายเลย ผู้รู้มาตอบผมทีครับ -/\-
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 01
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่