WPFDevelopersOrg / WPFDevelopers

🎉 Welcome to follow the "WPFDevelopers" public account! This is a sample project we share daily, covering WPF's basic controls and custom control libraries. The project will be continuously updated, welcome to give us ⭐️
MIT License
1.5k stars 242 forks source link

Enhancement: Supported multi-monitor screenshot. #19

Closed SwaggyMacro closed 1 year ago

SwaggyMacro commented 1 year ago

It doesn't support multi-screen when I screenshot, So I make this. I don't know if this has some conflicts with the project. The new calling method of ScreenShot is below this:

screenCapturer = new ScreenCapture();
screenCapturer.SnapCompleted += ScreenCapturer_SnapCompleted;
screenCapturer.SnapCanceled += ScreenCapturer_SnapCanceled;
screenCapturer.Capture();
SwaggyMacro commented 1 year ago

我截图的时候发现ScreenCut类不支持多屏幕截图,所以我修改后增加了多屏幕截图支持。 可能会跟项目有冲突,具体需要Review之后才知道了。 具体是使用了Windows.Forms的Screen类检测屏幕数量,然后载入屏幕数量的截图窗口,并且只允许一个窗口截图。


可能与以下行为存在冲突: 在 .NET45X 项目文件中增加了UseWindowsForms标签,并且通过Nuget添加了System.Drawing.Common以及Microsoft.Win32.SystemEvents库。

image

yanjinhuagood commented 1 year ago

首先非常感谢 @SwaggyMacro 大佬的贡献,项目中暂时不考虑使用 Windows.Forms (因为冲突了),而且大佬好像没有拉去最新代码进行更改。

SwaggyMacro commented 1 year ago

首先非常感谢 @SwaggyMacro 大佬的贡献,项目中暂时不考虑使用 Windows.Forms (因为冲突了),而且大佬好像没有拉去最新代码进行更改。

image

😃不客气。 测试编译是都通过了,但是既然有冲突就没有办法了。 因为最新的commit好像就是那几行代码,所以就直接用跟上一次拉取的代码了。