473,385 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Docking Window problem

hello,

This is a function in the free magic library from Crownwood.

My problem is that I can not move windows to the second monitor. Here is the
function where I think with the problem ( 'IntPtr hDC = User32.GetDC
(IntPtr.Zero);'). The function uses the User32.dll. How con I coding for
multiple monitor?

public static void DrawDragRectangles(Rectangle[] newRects, int indent)

{

if (newRects.Length > 0)

{

// Create the first region

IntPtr newRegion = CreateRectangleRegion(newRects[0],
indent);

for(int index=1; index<newRects.Length; index++)

{

// Create the extra region

IntPtr extraRegion =
CreateRectangleRegion(newRects[index], indent);

// Remove the intersection of the existing and extra
regions

Gdi32.CombineRgn(newRegion, newRegion, extraRegion,
(int)Win32.CombineFlags.RGN_XOR);

// Remove unwanted intermediate objects

Gdi32.DeleteObject(extraRegion);

}

// Get hold of the DC for the desktop

IntPtr hDC = User32.GetDC(IntPtr.Zero);

// Define the area we are allowed to draw into

Gdi32.SelectClipRgn(hDC, newRegion);

Win32.RECT rectBox = new Win32.RECT();

// Get the smallest rectangle that encloses region

Gdi32.GetClipBox(hDC, ref rectBox);

IntPtr brushHandler = GetHalfToneBrush();

// Select brush into the device context

IntPtr oldHandle = Gdi32.SelectObject(hDC, brushHandler);

// Blit to screen using provided pattern brush and invert
with existing screen contents

Gdi32.PatBlt(hDC,

rectBox.left,

rectBox.top,

rectBox.right - rectBox.left,

rectBox.bottom - rectBox.top,

(uint)RasterOperations.PATINVERT);

// Put old handle back again

Gdi32.SelectObject(hDC, oldHandle);

// Reset the clipping region

Gdi32.SelectClipRgn(hDC, IntPtr.Zero);

// Remove unwanted region object

Gdi32.DeleteObject(newRegion);

// Must remember to release the HDC resource!

User32.ReleaseDC(IntPtr.Zero, hDC);

}

}
Nov 16 '05 #1
1 4785
Quote from MSDN, documentation of CreateDC:
"Windows 2000 and later: If there are multiple monitors on the system,
calling CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL) will create a DC covering
all the monitors. "

If I got you right, this could be what you need.

Niki

"Falk" <Fa**********@t-online.de> wrote in
news:u9**************@TK2MSFTNGP14.phx.gbl...
hello,

This is a function in the free magic library from Crownwood.

My problem is that I can not move windows to the second monitor. Here is
the function where I think with the problem ( 'IntPtr hDC = User32.GetDC
(IntPtr.Zero);'). The function uses the User32.dll. How con I coding for
multiple monitor?

public static void DrawDragRectangles(Rectangle[] newRects, int indent)

{

if (newRects.Length > 0)

{

// Create the first region

IntPtr newRegion = CreateRectangleRegion(newRects[0],
indent);

for(int index=1; index<newRects.Length; index++)

{

// Create the extra region

IntPtr extraRegion =
CreateRectangleRegion(newRects[index], indent);

// Remove the intersection of the existing and extra
regions

Gdi32.CombineRgn(newRegion, newRegion, extraRegion,
(int)Win32.CombineFlags.RGN_XOR);

// Remove unwanted intermediate objects

Gdi32.DeleteObject(extraRegion);

}

// Get hold of the DC for the desktop

IntPtr hDC = User32.GetDC(IntPtr.Zero);

// Define the area we are allowed to draw into

Gdi32.SelectClipRgn(hDC, newRegion);

Win32.RECT rectBox = new Win32.RECT();

// Get the smallest rectangle that encloses region

Gdi32.GetClipBox(hDC, ref rectBox);

IntPtr brushHandler = GetHalfToneBrush();

// Select brush into the device context

IntPtr oldHandle = Gdi32.SelectObject(hDC, brushHandler);

// Blit to screen using provided pattern brush and invert
with existing screen contents

Gdi32.PatBlt(hDC,

rectBox.left,

rectBox.top,

rectBox.right - rectBox.left,

rectBox.bottom - rectBox.top,

(uint)RasterOperations.PATINVERT);

// Put old handle back again

Gdi32.SelectObject(hDC, oldHandle);

// Reset the clipping region

Gdi32.SelectClipRgn(hDC, IntPtr.Zero);

// Remove unwanted region object

Gdi32.DeleteObject(newRegion);

// Must remember to release the HDC resource!

User32.ReleaseDC(IntPtr.Zero, hDC);

}

}

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pamela Thalacker | last post by:
The default configuration for the VS.Net IDE is two combination windows docked to the right of the screen and tiled vertically(by which I mean one on top of the other). The upper window has the...
6
by: Lecture Snoddddgrass | last post by:
Greetings, Can anyone recommend a good 3rd party docking windows component for WinForms? I'm looking for something that allows windows to not only be docked but to "popout", much like the...
0
by: ka | last post by:
I'm using Corwnwood.Magic library for docking in my application. My application to let the users to create their screen look to show some particular data. I treid to dock my things in the way,...
1
by: JDeats | last post by:
I have a WinForm that is set as an MDIContainer, I have an Panel on this form that has it's docking property set to "Top". When a spawn an MDI childform inside my parent all is well untill I...
3
by: Rob Richardson | last post by:
Greetings! I have never understood how to make docking windows do what I want them to. I now have two instances of VB.Net running. In the main one, I have the main code window in the upper...
0
by: JS | last post by:
I am trying to find out if VS.NET 2005 has a built in VS style docking window component, or if we still have to use 3rd party libraries? With 2003 I am currently using NetXP, but they don't have a...
1
by: Joe | last post by:
I'm creating a C# application, and want to use docking windows. However, I want the docking windows to look like the docking windows withing VS2005, with a title bar, close button, etc... When...
2
by: Matt Brown - identify | last post by:
Hello, I've spent the better part of the day going over code and thinking and have come up with the following docking method that works perfectly. At this point, my brain is about to explode...
3
by: adebiasio | last post by:
Does anybody have any code samples that show me how to dock tabs around a form. I have found numerous controls out there that does the job, but I want to learn how to code it myself. Any sites...
0
by: alarock | last post by:
how can i do floating and docking a Form(window) in mdiparent+c#.. thanks advance,,, Regards, ALGATES.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.