我有一个 WebBrowser 控件,顶部有一个透明面板,我想做的是在透明面板上围绕鼠标悬停的页面中的元素绘制一个矩形。
到目前为止,除了在绘制下一个矩形之前没有清除面板之外,我已经完成了所有工作,所以我最终到处都是矩形。
这是我使用的代码。
paneGraphics = drawingPane.CreateGraphics();
Rectangle inspectorRectangle;
inspectorRectangle = controller.inspectElement();
paneGraphics.DrawRectangle(new Pen(Color.Blue, 1), inspectorRectangle);
drawingPane.Invalidate();
我试过使用 drawingPane.clear() 但这只会把屏幕变白。