Unfortunately the ClientRectangle does not include the form borders so that is not useful for capturing the complete window. However the actual location and size is kept in the form's properties and can be used to capture the window as below. And in this case, the title bar size is not needed.
Rectangle r = new Rectangle(this.Left, this.Top, this.Width, this.Height);
Bitmap _lastSnapshot = new Bitmap(r.Width, r.Height);
using (Image windowImage = new Bitmap(r.Width, r.Height))
using (Graphics windowGraphics = Graphics.FromImage(windowImage))
using (Graphics tipGraphics = Graphics.FromImage(_lastSnapshot))
windowGraphics.CopyFromScreen(new Point(r.Left, r.Top), new Point(0, 0), new Size(r.Width, r.Height));
tipGraphics.DrawImage(windowImage, 0, 0, r.Width, r.Height);
i want to detect mouse over on title bar or mouse out from title bar in my c# winform apps. i got a code sample which works but the problem is when i place the mouse on any area of win form then mouse leave occur and when i put mouse on title bar then right event call. actually i want that if i place my mouse on any area of form except title bar then nothing should happen.only when i will place mouse on title bar then a notification should come to me and when i will remove mouse from title to out of my form then label should display mouse out message but if remove mouse from title bar to form body then label should be blank.
here is code. just run this code and tell me what modification i should do to get my expected result. thanks
public partial class Form2 : Form
protected override void WndProc(ref Message m)
if (m.Msg == 0xA0) // WM_NCMOUSEMOVE
label1.Text = "mouse move on title bar";
else if (m.Msg == 0x2A2) // WM_NCMOUSELEAVE
label1.Text = "mouse leave from title bar";
I Have Created a Desktop Winforms Application On The Basis of Wix.com Means a user can create Html templates in the Application and then Publish Them.now when a user Clicks on the Menu On Right side( Which Contains Menu For Adding Buttons and Other General Controls),The Control is Drawn on The Webbrowser control ( Setting its Editmode true).
But Whenever we add a Control is Alighned to left By Default and There is No Mean To Reorder them .
Can we implement a Functionality Which Lets Users Place Controls on Document where ever they want instead of Having Each control Autoalighned to Left.
I am finding a new kind of memory link. Maybe not new but new to me. I have an application that generates 50 to 70 threads. I am using a vision library by a third part which generates many of them. My program is a C#/WPF. I think the library was done in C++.
I capture and analyze an image every 60 msec. After 3 to 4 hours I see the thread count for the application rise. This is well over 100,000 images. Every image creates a few threads and then closes them when finished. This spreads the load out over several core. I am watching it in Resource Monitor. Of course as thread count raises so does memory.
Has anyone seen a similar leak?
So many years of programming I have forgotten more languages than I know.