コード例 #1
0
        //eventos
        private void btnClose_Click(object sender, EventArgs e)
        {
            UserPrefModel u = new UserPrefModel();

            u.SpeakerVolume = VolumeOut.Value;
            u.MicVolume     = VolumeIn.Value;
            new UserDataManager().SavePreferences(u);

            AudioIn.Stop();
            AudioOut.Stop();
            Application.Exit();
        }
コード例 #2
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == 0x0312)
            {
                //se o InputBox nao for inicializado, o InputField terá valor nulo, por isso é necessario fazer essa verificacao antes
                if (InputBox.InputField != null && InputBox.InputField.ContainsFocus)
                {
                    MessageBox.Show("Essa(s) tecla(s) de atalho já está(ão) em uso! Insira outra.");
                    InputBox.ClearAll();
                    return;
                }

                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    string currValue = dataGridView1.Rows[i].Cells[5].Value.ToString();
                    if ($"{((int)m.LParam & 0xFFFF)}+{(((int)m.LParam >> 16) & 0xFFFF)}" == currValue)
                    {
                        AudioIn.Play(dataGridView1.Rows[i].Cells[2].Value.ToString(), float.Parse(VolumeIn.Value.ToString()) / 100);
                        AudioOut.Play(dataGridView1.Rows[i].Cells[2].Value.ToString(), float.Parse(VolumeOut.Value.ToString()) / 100);
                    }
                }
                return;
            }

            const int RESIZE_HANDLE_SIZE = 10;

            switch (m.Msg)
            {//Todas as definicoes para cada caso em https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-nchittest
            case 0x0084:
                base.WndProc(ref m);

                if ((int)m.Result == 0x01)
                {
                    Point screenPoint = new Point(m.LParam.ToInt32());
                    Point clientPoint = this.PointToClient(screenPoint);
                    if (clientPoint.Y <= RESIZE_HANDLE_SIZE)
                    {
                        if (clientPoint.X <= RESIZE_HANDLE_SIZE)
                        {
                            m.Result = (IntPtr)13;
                        }
                        else if (clientPoint.X < (Size.Width - RESIZE_HANDLE_SIZE))
                        {
                            m.Result = (IntPtr)12;
                        }
                        else
                        {
                            m.Result = (IntPtr)14;
                        }
                    }
                    else if (clientPoint.Y <= (Size.Height - RESIZE_HANDLE_SIZE))
                    {
                        if (clientPoint.X <= RESIZE_HANDLE_SIZE)
                        {
                            m.Result = (IntPtr)10;
                        }
                        else if (clientPoint.X < (Size.Width - RESIZE_HANDLE_SIZE))
                        {
                            m.Result = (IntPtr)2;
                        }
                        else
                        {
                            m.Result = (IntPtr)11;
                        }
                    }
                    else
                    {
                        if (clientPoint.X <= RESIZE_HANDLE_SIZE)
                        {
                            m.Result = (IntPtr)16;
                        }
                        else if (clientPoint.X < (Size.Width - RESIZE_HANDLE_SIZE))
                        {
                            m.Result = (IntPtr)15;
                        }
                        else
                        {
                            m.Result = (IntPtr)17;
                        }
                    }
                }
                return;
            }
            base.WndProc(ref m);
        }
コード例 #3
0
 private void PlayOnForm(object sender, EventArgs e, DataGridView.HitTestInfo testResult)
 {
     AudioIn.Play(dataGridView1.Rows[testResult.RowIndex].Cells[2].Value.ToString(), float.Parse(VolumeIn.Value.ToString()) / 100);
     AudioOut.Play(dataGridView1.Rows[testResult.RowIndex].Cells[2].Value.ToString(), float.Parse(VolumeOut.Value.ToString()) / 100);
 }
コード例 #4
0
 private void StopOnForm(object eventSender, EventArgs eventArgs, DataGridView.HitTestInfo testResult)
 {
     AudioIn.Stop();
     AudioOut.Stop();
 }