コード例 #1
0
ファイル: FrmQRResault.cs プロジェクト: radtek/buffalobro
        /// <summary>
        /// ÏÔʾ½á¹û¿ò
        /// </summary>
        /// <param name="content"></param>
        public static void ShowBox(string content)
        {
            FrmQRResault frm = new FrmQRResault();

            frm.txtContent.Text = content;

            frm.Show();
            //Rectangle curRec=Screen.GetBounds(frm);
            int x = Cursor.Position.X - (frm.Width / 2);
            int y = Cursor.Position.Y;

            frm.Location = new Point(x, y);
            frm.TopMost  = true;
            frm.TopMost  = false;
        }
コード例 #2
0
        private static void ShowForm(FrmQRResault frm)
        {
            frm.Show();
            Point  p         = Cursor.Position;
            Screen curScreen = Screen.FromPoint(p);
            //Rectangle curRec=Screen.GetBounds(frm);

            int maxWidth = curScreen.Bounds.X + curScreen.Bounds.Width - frm.Width;
            int x        = p.X - (frm.Width / 2);

            if (x > maxWidth)
            {
                x = maxWidth;
            }
            else if (x < curScreen.Bounds.X)
            {
                x = curScreen.Bounds.X;
            }

            int y         = p.Y - 50;
            int maxHeight = curScreen.Bounds.Y + curScreen.Bounds.Height - frm.Height;

            if (y > maxHeight)
            {
                y = p.Y - frm.Height + 50;
                if (y > maxHeight)
                {
                    y = maxHeight;
                }
            }
            else if (y < curScreen.Bounds.Y)
            {
                y = curScreen.Bounds.Y;
            }

            frm.Location = new Point(x, y);
            frm.TopMost  = true;
            //frm.TopMost = false;
        }