示例#1
0
        /// <summary>
        /// Highlight the accessible object with a red border.
        /// </summary>
        public void Highlight()
        {
            Rectangle    objectLocation = Location;
            SystemWindow window         = Window;
            Rectangle    windowLocation = window.Rectangle;

            using (WindowDeviceContext windowDC = window.GetDeviceContext(false))
            {
                using (Graphics g = windowDC.CreateGraphics())
                {
                    g.DrawRectangle(new Pen(Color.Red, 4), objectLocation.X - windowLocation.X, objectLocation.Y - windowLocation.Y, objectLocation.Width, objectLocation.Height);
                }
            }
        }