|
In my project i have two themes(white and blue). I have one master form. I want to implement the theme in master form so that all child form comes in same theme. Is this possible?
|
|
|
|
|
Hello
Harikrk wrote: Is this possible?
Yes! Why not?
One way to do it, is to store your theme images -if any- and other data in a file -could be zip, SqlDb, Resx, whatever...-, then make your forms read it from there according to the current settings.
Regards
|
|
|
|
|
Hi guys!
Does anyone know, how to disable the Capture action of the form?
Whenever I move the mouse on the form, it reports the Capture property as , but when I press the mouse button, it changes to true !
I have added a MessageFilter to my Application object, and I want to do this:
public bool PreFilterMessage(ref Message m)
{
if (m.Msg == WM_NCLBUTTONDOWN)
{
return false;
}
else if (m.Msg == WM_NCLBUTTONUP)
{
return false;
}
return false;
}
The Press Message is sent to the Application object correctly, but as the MSDN documents tell:
The WM_NCLBUTTONUP message is posted when the user releases the
left mouse button while the cursor is within the nonclient area of a window.
This message is posted to the window that contains the cursor.
<big><code>If a window has captured the mouse, this message is not posted.</code></big>
the Release Message is not sent to the Application object , but if I change it to this:
public bool PreFilterMessage(ref Message m)
{
if (m.Msg == WM_NCLBUTTONDOWN)
{
<code>return true;</code>
}
else if (m.Msg == WM_NCLBUTTONUP)
{
return false;
}
return false;
}
because of that, the press messsage has been ignored and so the Capture action is not started, the message will be sent correctly, but I don't want to ignore the first message and I also want the second message, and so I have to find a way to disable the Capture action of the form!
Help please!
Sojaner!
|
|
|
|
|
Hello
I'm not fully following your code and design but as a quick answer that may help, you can always release the mouse capture by setting
this.Capture = false; in your form at any time. Was that what you were looking for?
Regards
|
|
|
|
|
|
Allright! Let me get this right.
Your problem is that you want to detect MouseUp event when the user clicks the mouse button down in the client area, then releases it in the non-client area -eg. title bar-? Is that it?
Well, try to use Spy++ to monitor the messages sent to your process, and do the scenario you want to do. If you notice a unique message, then you can filter it the way you do.
I hope I was helpful this time!!
Regards
|
|
|
|
|
No!
My problem is that, I want to filter this messages:
1)Mouse is pressed on the title bar of the window(nonClientArea) and it's what I can do,
2)Mouse is released on the title bar of the window(nonClientArea), and because the window Captures the mouse, and as it is written in MSDN Documents, when the mouse is captured by the window, the release message would not be sent to the application, and so I can not get this message!
(Whenever I ignore the first message filter(press message) by returning the true value to filter the message or clicking on the clientArea(and setting the capture to false in the mouse down event handler), the release message would be sent to the application!)
Sojaner!
|
|
|
|
|
I... um... err...
I don't get it. You want to filter/ignore the message, or capture the message?!! Is the relase message sent or is it not sent?!! You want to do something when the user releases the mouse button in non-client area?!!
Did you use Spy++ as I told you?
Regards
|
|
|
|
|
Sorry! I know it was so confusing!
I want to capture the messages, and detect these:
1)nonClientArea mouse down,
2)nonClientArea mouse up!
But the second is not being sent, because of that the window captures the mouse, and when some window captures the mouse, the mouse up message would not be sent to the window!
And I used the Spy++, but it didn't get me the answer!
Sojaner!
|
|
|
|
|
I did my spy++ lookup and I found out that few messages are sent when the mouse are Up in non-client area, eg:
WM_LPBUTTONUP: You can use these X, Y position to check if they are in the title bar or not
WM_NCMOUSELEAVE: This could be an equivalent to wat you are looking for.
Among other messages that would indicate the events that are happening like WM_NCHITTEST with coordiates also.
Close enough this time?
Regards
|
|
|
|
|
|
|
Yep!
You it 95%.
When there is a press message, there would be a release message after that, and in this case, I want to handle the minimize event myself, and capture the WM_NCLBUTTONDOWN and filter it if needed but still can capture the WM_NCLBUTTONUP that is the release message after the WM_NCLBUTTONDOWN.
Sojaner!
|
|
|
|
|
In this case:
1- Handle WM_NCLBUTTONDOWN and return true to filter it:
2- HANDLE WM_LBUTTONUP and check the coordinates. If they are in the minimize button Handle it and return true.
Try it!
Regards
|
|
|
|
|
|
Why doesn't it work? What exactly happens? Doesn't the WM_LBUTTONUP doesn't fire? Did you check that with Spy++.
I did a small test with Spy++ and it fires well. Just like I told you before, use Spy++ to identify the message that is fired when you release the button on the non client area. There ought to be one!!
Regards
|
|
|
|
|
Nop! Not WM_LBUTTONUP nor WM_NCLBUTTONUP fire!
I tested it in Spy++, it showes that the WM_LBUTTONUP fires but the application does not receive it, and even if it receives, there is no way to check if the mouse is on exactly on the minimize button!
And there is something else, although the Spy++ reports that the WM_LBUTTONUP fires, the MSDN tells that, the WM_LBUTTONUP message would be sent to the window, just when the mouse is on the ClientArea of the window.
Anyway, I changed my code to this:
private const int WM_NCLBUTTONDOWN = 0xA1;
private const int WM_NCLBUTTONUP = 0xA2;
bool filterOff = true;
Message message = new Message();
bool internalMessage = false;
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_NCLBUTTONDOWN && m.WParam == (IntPtr)0x8)
{
if (internalMessage)
{
internalMessage = false;
}
else
{
message = m;
if (filterOff)
{
Message mes = new Message();
mes.HWnd = this.Handle;
mes.Msg = 162;
mes.WParam = m.WParam;
mes.LParam = IntPtr.Zero;
this.WndProc(ref mes);
}
return;
}
}
else if (m.Msg == WM_NCLBUTTONUP && m.WParam == (IntPtr)0x8)
{
internalMessage = true;
this.WndProc(ref message);
return;
}
base.WndProc(ref m);
}
private void Form_KeyUp(object sender, KeyEventArgs e)
{
if(e.KeyCode.ToString() == "Escape")
{
if (!filterOff) { filterOff = true; }
else
{
filterOff = false;
}
}
}
and when I recieve the WM_NCLBUTTONUP, I send a WM_NCLBUTTONDOWN message to the window, myself, but I don't like it!
There have to be someway to make the WM_NCLBUTTONDOWN be sent to the window!
It is driving me crazy! I have to solve this!
Sojaner!
|
|
|
|
|
I know windows form progrmming , C# , VB , SQL , But never did WEB based applications , I know HTML , anyone can recommend how to convert into Web Application programming under .NET , maybe ASP.NET . any site or documentation for fast learning this stuf .
thanx
UnitecSoft
We Will Either Find A Way , OR Make One .
|
|
|
|
|
There's heaps of articles on CP, beyond that, I recommend buying a good book, Dino Esperito (sp?) has a couple of good ones on ASP.NET 2.0.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello
When starting learning a new language or anything else, I prefer video lessons/tutorials if available. If you google for "ASP video tutorials" you'd find plenty to choose from, whether free or with minimal costs.
Regards
|
|
|
|
|
And ofcourse in case of any trouble anytime you can come Here[^] .
Best Regards,
Apurva Kaushal
|
|
|
|
|
Apurva are u an ASP.NET prof ? , send me ur contact details .
unitecsoft
|
|
|
|
|
Ya I am working in ASP.NET. Why you want to have my contact details?
Best Regards,
Apurva Kaushal
|
|
|
|
|
Just for professional curtsy , if you don't mind .
My E.Mail is unitecsoft@hotmail.com
Thanx
unitecsoft
|
|
|
|
|
ofcourse not man.. Actually I work in hyderabad and having approximately 4 yrs of profesional experience majorly on asp.net c#. I will send you a test mail with my personal ID. Hope this much information would be enough.
Best Regards,
Apurva Kaushal
|
|
|
|