右键弹出窗口位置

来源:互联网 发布:对网络暴力的调查报告 编辑:程序博客网 时间:2024/06/05 11:46
//控件在其父控件中的位置
            Vector p = VisualTreeHelper.GetOffset(lblName);


            Point Point = new Point(p.X, p.Y);


            //相对于屏幕的位置
            Point pointScreen = (lblName.Parent as Visual).PointToScreen(Point);


            //屏幕位置
            aa.Location = new System.Drawing.Point(Convert.ToInt32(pointScreen.X - 200), Convert.ToInt32(pointScreen.Y + lblName.ActualHeight));
原创粉丝点击