Click here to Skip to main content
14,972,737 members
Home / Discussions / Windows Forms
   

Windows Forms

 
GeneralRe: Slow Graphics in Windows 8 Pin
Dr.Walt Fair, PE19-Apr-13 7:24
professionalDr.Walt Fair, PE19-Apr-13 7:24 
AnswerRe: Slow Graphics in Windows 8 Pin
Maciej Los19-Apr-13 9:36
mveMaciej Los19-Apr-13 9:36 
GeneralRe: Slow Graphics in Windows 8 Pin
Dr.Walt Fair, PE20-Apr-13 22:08
professionalDr.Walt Fair, PE20-Apr-13 22:08 
QuestionHow to capture snap of any SDI windowForm including title bar Pin
Tridip Bhattacharjee11-Mar-13 8:20
professionalTridip Bhattacharjee11-Mar-13 8:20 
AnswerRe: How to capture snap of any SDI windowForm including title bar Pin
Richard MacCutchan12-Mar-13 2:08
mveRichard MacCutchan12-Mar-13 2:08 
GeneralRe: How to capture snap of any SDI windowForm including title bar Pin
Tridip Bhattacharjee13-Mar-13 8:29
professionalTridip Bhattacharjee13-Mar-13 8:29 
GeneralRe: How to capture snap of any SDI windowForm including title bar Pin
Richard MacCutchan13-Mar-13 22:31
mveRichard MacCutchan13-Mar-13 22:31 
QuestionHow to detect mouse over & out on win form title bar Pin
Tridip Bhattacharjee9-Mar-13 9:23
professionalTridip Bhattacharjee9-Mar-13 9:23 
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
using System.Runtime.InteropServices;

public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

protected override void WndProc(ref Message m)
{
if (m.Msg == 0xA0) // WM_NCMOUSEMOVE
{
TrackNcMouseLeave(this);
//ShowClientArea();
label1.Text = "mouse move on title bar";
}
else if (m.Msg == 0x2A2) // WM_NCMOUSELEAVE
{
//HideClientAreaIfPointerIsOut();
label1.Text = "mouse leave from title bar";
}

base.WndProc(ref m);
}

protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
//HideClientAreaIfPointerIsOut();
}

private int previouseHeight;

private void ShowClientArea()
{
if (this.ClientSize.Height == 0)
this.ClientSize = new Size(this.ClientSize.Width, previouseHeight);
}

private void HideClientAreaIfPointerIsOut()
{
if (this.Bounds.Contains(Cursor.Position))
return;
previouseHeight = this.ClientSize.Height;
this.ClientSize = new Size(this.ClientSize.Width, 0);
}

public static void TrackNcMouseLeave(Control control)
{
TRACKMOUSEEVENT tme = new TRACKMOUSEEVENT();
tme.cbSize = (uint)Marshal.SizeOf(tme);
tme.dwFlags = 2 | 0x10; // TME_LEAVE | TME_NONCLIENT
tme.hwndTrack = control.Handle;
TrackMouseEvent(tme);
}

[DllImport("user32")]
public static extern bool TrackMouseEvent([In, Out] TRACKMOUSEEVENT lpEventTrack);

[StructLayout(LayoutKind.Sequential)]
public class TRACKMOUSEEVENT
{
public uint cbSize;
public uint dwFlags;
public IntPtr hwndTrack;
public uint dwHoverTime;
}
}
tbhattacharjee

QuestionWinforms Html Editor Pin
tarjeetsalh7-Mar-13 1:41
Membertarjeetsalh7-Mar-13 1:41 
AnswerRe: Winforms Html Editor Pin
Dave Kreskowiak7-Mar-13 2:27
mveDave Kreskowiak7-Mar-13 2:27 
GeneralRe: Winforms Html Editor Pin
tarjeetsalh10-Mar-13 21:28
Membertarjeetsalh10-Mar-13 21:28 
GeneralRe: Winforms Html Editor Pin
Dave Kreskowiak11-Mar-13 5:41
mveDave Kreskowiak11-Mar-13 5:41 
QuestionThread Leak Pin
michaelbarb25-Feb-13 5:12
Membermichaelbarb25-Feb-13 5:12 
AnswerRe: Thread Leak Pin
Bernhard Hiller27-Feb-13 23:36
MemberBernhard Hiller27-Feb-13 23:36 
GeneralRe: Thread Leak Pin
michaelbarb28-Feb-13 3:34
Membermichaelbarb28-Feb-13 3:34 
AnswerRe: Thread Leak Pin
Pete O'Hanlon28-Feb-13 1:40
mvePete O'Hanlon28-Feb-13 1:40 
GeneralRe: Thread Leak Pin
michaelbarb28-Feb-13 3:38
Membermichaelbarb28-Feb-13 3:38 
GeneralRe: Thread Leak Pin
Pete O'Hanlon28-Feb-13 3:41
mvePete O'Hanlon28-Feb-13 3:41 
GeneralRe: Thread Leak Pin
michaelbarb28-Feb-13 4:11
Membermichaelbarb28-Feb-13 4:11 
GeneralRe: Thread Leak Pin
Dave Kreskowiak28-Feb-13 4:17
mveDave Kreskowiak28-Feb-13 4:17 
GeneralRe: Thread Leak Pin
Pete O'Hanlon28-Feb-13 4:30
mvePete O'Hanlon28-Feb-13 4:30 
AnswerRe: Thread Leak Pin
michaelbarb18-Jun-13 4:57
Membermichaelbarb18-Jun-13 4:57 
QuestionElements of a toolstrip witin an usercontrol get deleted when copying/pasting the usercontrol. Pin
priyamtheone18-Feb-13 4:41
Memberpriyamtheone18-Feb-13 4:41 
QuestionData Binding to an Object that may be Read Only Pin
Simon Bridge4-Feb-13 11:46
MemberSimon Bridge4-Feb-13 11:46 
AnswerRe: Data Binding to an Object that may be Read Only Pin
Eddy Vluggen9-Feb-13 9:30
professionalEddy Vluggen9-Feb-13 9:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.