.NET Logo
Welcome Guest Search | Active Topics | Members | Log In | Register

อยากทราบเกี่ยวกับ Event ของ Mouse ครับ (VC#) Options · View
jaynarol
Posted: Tuesday, October 21, 2008 10:44:17 AM
Rank: มือฝึกหัด
Groups: Member

Joined: 8/30/2008
Posts: 9
Location: -


คือตอนแรกผมโชว์Dialogขึ้นมา1อัน (Form หลักเรียกขึ้นมาอีกที)

คำถามคือมี Event ไหนบ้างไหมครับที่เวลาเรากดคลิ๊กนอก Dialog ตัวนี้แล้วมันทำงาน
ผมจะนำมาประยุคใช้ให้มันปิด Dialog อะครับ (ทำ Dialog นี้เป็นเหมือนหน้าต่าง Popup ครับ)

mrxc
Posted: Tuesday, October 21, 2008 8:38:48 PM
Rank: มือเทพ
Groups: Member

Joined: 3/6/2008
Posts: 196
Location: TH

loss focus ครับหาประมาณนี้ครับไม่ไช่ Mouse ครับ

jaynarol
Posted: Wednesday, October 22, 2008 5:18:47 AM
Rank: มือฝึกหัด
Groups: Member

Joined: 8/30/2008
Posts: 9
Location: -

มันไม่ได้อะครับ ผมเปิดแบบ ShowDialog นะครับ ไม่ใช่ Show ธรรมดา

เราไม่สามารถบังคับฟอร์มหลักได้เลยระหว่างDialogนี้เปิดอยู่อะครับ

mrxc
Posted: Wednesday, October 22, 2008 8:04:34 AM
Rank: มือเทพ
Groups: Member

Joined: 3/6/2008
Posts: 196
Location: TH

@Main

namespace Simple_Test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 F2 = new Form2();
            F2.ShowDialog();
        }
    }
}

 

@Dialog

namespace Simple_Test
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();

            this.LostFocus += new EventHandler(Form2_LostFocus);
        }

        void Form2_LostFocus(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}

 

mrxc
Posted: Wednesday, October 22, 2008 10:31:39 AM
Rank: มือเทพ
Groups: Member

Joined: 3/6/2008
Posts: 196
Location: TH
หรือไม่ก็ที่ main

namespace Simple_Test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 F2 = new Form2();
            F2.Show();
            F2.LostFocus += new EventHandler(F2_LostFocus);
        }

        private void F2_LostFocus(object sender, EventArgs e)
        {
            ((Form2)sender).Close();
        }
    }
}
ionic
Posted: Wednesday, October 22, 2008 11:44:05 AM

Rank: มือสมัครเล่น
Groups: Member

Joined: 9/5/2008
Posts: 28
Location: BKK

ลองใช้ Deactivate ดูครับ

jaynarol
Posted: Wednesday, October 22, 2008 12:44:58 PM
Rank: มือฝึกหัด
Groups: Member

Joined: 8/30/2008
Posts: 9
Location: -

ขอบคุณครับมากๆครับ

เดี๋ยวจะรีบกลับบ้านไปลองดู

พอดีตอนนี้ทำงานอยุ่อะครับ

อิอิ

Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.


Sponsored by