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);
}
} 1 4802
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);
}
}
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 Solution Explorer,
Properties Window and something else tabbed in it and the lower window has
Dynamic Help and something else tabbed in it.
The...
|
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 Solution Explorer or Toolbox in Visual
Studio.NET. For my last project, I used the SyncFusion component for docking
windows, but my experience is that...
|
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,
Left Side: ToolBox
Middle: WorkPanel
Right: Package Explorer + PropertyWindow
WorkToolBox, Package Explore, PrepertyWindow : derived from Content
|
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 maximize the MDI
child window, when I do this the title bar (with max, min buttons,
etc..) for the child appears above my docked Panel.
The desired...
|
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 left, the task list window (now with 53 Build
Error tasks shown) in the lower left, a tabbed window with Solution
Explorer, Class View, Macro...
| |
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 2005/2.0 version
available, yet. Can anyone help with how to do this in 2005?
I am referring to something like the following:...
|
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 the user clicks and
drags the docking window, it'll un-dock, and open in a tool window, and
also allow the user to re-dock it elsewhere...
Any...
|
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 and I was wondering if
someone can help me figure out the calculations for right and bottom
docking:
note: lRelOffsetLeft and lRelOffsetTop are...
|
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 that show how to code this.
Thanks!
|
by: alarock |
last post by:
how can i do floating and docking a Form(window) in mdiparent+c#..
thanks advance,,,
Regards,
ALGATES.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |