コード例 #1
0
ファイル: TaskDialogForm.cs プロジェクト: nitz/luminous
        protected override void OnShown(System.EventArgs e)
        {
            //SuspendLayouts()

            Tag = null;
            int i = (int)DefaultButton;

            if (i > 0 && i <= VButtons.Length)
            {
                AcceptButton = (IButtonControl)Buttons[i - 1];
                Buttons[i - 1].Focus();
            }
            else
            {
                LabelContent.Focus();
            }
            //'If LabelTitle.Visible AndAlso LabelContent.Visible Then
            //'    LabelTitle.Margin = New Padding(LabelTitle.Margin.Left, LabelTitle.Margin.Top, LabelTitle.Margin.Right, 0)
            //'    LabelContent.Margin = New Padding(LabelContent.Margin.Left, If(_drawGradient, 16, LabelContent.Margin.Top), LabelContent.Margin.Right, 16)
            //'End If

            //'If Not String.IsNullOrEmpty(ExpandedInformation) AndAlso Expanded Then
            //'    Expanded = True
            //'End If

            //'MakeCenter()

            //'ResumeLayouts()

            if (Sound != null)
            {
                Sound.Play();
            }

            Activate();

            uint result = 0;

            if (Native.SystemParametersInfo(Native.SPI_GETSNAPTODEFBUTTON, 0, ref result, 0))
            {
                if (result != 0)
                {
                    var c = FindFocusedControl();
                    if (c != null)
                    {
                        var p = c.PointToScreen(new Point(c.Width / 2, c.Height / 2));
                        Cursor.Position = p;
                    }
                }
            }

            base.OnShown(e);
        }
コード例 #2
0
        protected override void OnShown(System.EventArgs e)
        {
            //SuspendLayouts()
            Tag = null;
            int i = (int)DefaultButton;

            if (i > 0 && i <= VButtons.Length)
            {
                AcceptButton = (IButtonControl)Buttons[i - 1];
                Buttons[i - 1].Focus();
            }
            else
            {
                LabelContent.Focus();
            }
            //'If LabelTitle.Visible AndAlso LabelContent.Visible Then
            //'    LabelTitle.Margin = New Padding(LabelTitle.Margin.Left, LabelTitle.Margin.Top, LabelTitle.Margin.Right, 0)
            //'    LabelContent.Margin = New Padding(LabelContent.Margin.Left, If(_drawGradient, 16, LabelContent.Margin.Top), LabelContent.Margin.Right, 16)
            //'End If

            //'If Not String.IsNullOrEmpty(ExpandedInformation) AndAlso Expanded Then
            //'    Expanded = True
            //'End If

            //'MakeCenter()

            //'ResumeLayouts()

            if (Sound != null)
            {
                Sound.Play();
            }

            Activate();

            base.OnShown(e);
        }