简体   繁体   English

仅在主要/辅助显示器上设置墙纸

[英]Set wallpaper on primary/secondary monitor only

Good day everyone. 今天是个好日子。

I know how to set a wallpaper declaring 我知道如何设置墙纸声明

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);

and then using 然后使用

SystemParametersInfo(0x0014, 0, file, 0x01 | 0x02);

but this sets the wallpaper, the same wallpaper on all the screens. 但这会设置墙纸,所有屏幕上的墙纸都相同。

Is there any way to select which screen I want to update? 有什么方法可以选择要更新的屏幕?

I sueggest you to read that article , to understand how the background works with double monitor. 我建议您阅读该文章 ,以了解背景如何在双显示器下工作。 You not need to put 2 image in 2 diffente monitors but you need to create one that contains both images and put as backgroud. 您无需将2张图像放入2台不同的显示器中,但需要创建一个包含两个图像并作为背景放置的图像。

An extract of the article linked: 链接的文章摘录:

The trick is to set your wallpaper to “tile” rather than “center” or “stretch”. 诀窍是将墙纸设置为“平铺”而不是“中心”或“拉伸”。 When the window manager draws a tiled bitmap, it places the tiles so that the upper left corner of the primary monitor exactly coincides with the top left corner of a tile. 窗口管理器绘制平铺的位图时,会放置平铺,以便主监视器的左上角与平铺的左上角完全重合。 The remaining tiles are then arranged around that anchor tile. 然后,其余的瓦片围绕该锚定瓦片布置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM