Note that there are some explanatory texts on larger screens.

plurals
  1. POC# - Multiple Desktop Wallpaper App - Logic Problems
    text
    copied!<p>I'm currently tearing my hair out with this problem.</p> <p>Where I'm up to:</p> <p>I can </p> <ul> <li>Generate an image for each screen</li> <li>Create a mega-image for two screens next to each other.</li> <li>Setting this as a tiled wallpaper.</li> </ul> <p>What I want to do:</p> <ul> <li>Support any number of monitors</li> <li>Support all offsets of monitors, such as monitors above, or below, or diagonal.</li> </ul> <p>I have read this MSDN article and found it very helpful:</p> <p><a href="http://blogs.msdn.com/b/oldnewthing/archive/2007/09/24/5083738.aspx" rel="nofollow">http://blogs.msdn.com/b/oldnewthing/archive/2007/09/24/5083738.aspx</a></p> <p>But I am still stuck on the logic I need to use to:</p> <ul> <li>Calculate what size image I need for any variation of monitors</li> <li>Create the wallpaper applying the offset of monitors</li> </ul> <p>My program is laid out as follows:</p> <p>ScreenInfo Class:</p> <pre><code>public Bitmap ChosenWallPaper { get; private set; } public Rectangle ScreenArea { get; private set; } int ScreenNumber { get; set; } public string ScreenDescription { get { return "Screen: " + ScreenNumber + " " + ScreenArea.ToString(); } } public ScreenInfo(int screenNumber) { this.ScreenNumber = screenNumber; ScreenArea = new Rectangle(Screen.AllScreens[screenNumber].Bounds.X, Screen.AllScreens[screenNumber].Bounds.Y, Screen.AllScreens[screenNumber].Bounds.Width, Screen.AllScreens[screenNumber].Bounds.Height); } </code></pre> <p>ScreenCollection Class</p> <pre><code>public List&lt;ScreenInfo&gt; ScreenList { get; private set; } public ScreenCollection() { ScreenList = new List&lt;ScreenInfo&gt;(); for (int i = 0; i &lt; Screen.AllScreens.Count(); i++) { ScreenList.Add(new ScreenInfo(i)); } } public Rectangle CalculateMainBitmapSize() { } </code></pre> <p>The rest of my source code hasn't been implemented yet.</p> <p>Thanks!</p> <p>EDIT:</p> <p>I've figured out how to represent two monitors with each other with some REALLY hacky, horrible code, but I'm starting to understand how the monitors are laid out a bit more...</p> <pre><code>private void SizeScreens() { pictureBox1.Height = Desktops.ScreenList[0].ScreenArea.Height / 10; pictureBox1.Width = Desktops.ScreenList[0].ScreenArea.Width / 10; pictureBox2.Height = Desktops.ScreenList[1].ScreenArea.Height / 10; pictureBox2.Width = Desktops.ScreenList[1].ScreenArea.Width / 10; } private void PositionScreens() { Point Screen1Location = new Point(Desktops.ScreenList[0].ScreenArea.X,Desktops.ScreenList[0].ScreenArea.Y); Point Screen2Location = new Point(Origin.X + (Desktops.ScreenList[1].ScreenArea.X / 10),Origin.Y + (Desktops.ScreenList[1].ScreenArea.Y / 10)); pictureBox1.Location = Origin; pictureBox2.Location = Screen2Location; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload