|
yes, but how.
if from FormB I do:
FormA formA = new FormA();
formA.Show();
All this does is create a NEW formA, not put Focus on the existing FormA.
And if I do formA.Focus() within formB, it will not compile. It'll get a formA does not exist error.
|
|
|
|
|
Dear friends:
How can I make a form unmovable? I tried to set FormBorderStyle to FixedSingle, to enable the form Maximized. But, the form can still be moved around. Thanks!
Sheng
|
|
|
|
|
can you respond to the forms Move event and cancel or undo the change there?
--
CleaKO The sad part about this instance is that none of the users ever said anything [about the problem].
Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
|
|
|
|
|
Dan:
Thanks for the answer! I used the event handler "OnMove". There is no "Cancel" option. It does not work. I set the Location to the original values. The form can still be moved.
-- modified at 17:01 Tuesday 24th April, 2007
Sheng
|
|
|
|
|
Not sure if it is good idea, but you can take a look at WndProc method in MSDN or Google . You can get all events there and if it is OnMove , you can cansel it,
Mazy
"This chancy chancy chancy world."
|
|
|
|
|
Hi, Mazdak:
It does not work.
The windows message for a form's "MOVE" event is "WM_MOVE = 0x0003" defined in WinUsers.h. I used WinProc to intercept the "MOVE" message. The only parameter "m" of type Message does not have any property or field for canceling the "MOVE". I tried to set the m.Msg to WM_NULL == 0x0000. But it does not work either. It seems that the moving of a form happens before the message interception of "WM_MOVE" by WinProc.
Sheng
|
|
|
|
|
gshen wrote: It seems that the moving of a form happens before the message interception of "WM_MOVE" by WinProc.
This is wrong, just try :
protected override void WndProc(ref Message m)
{
if(m. {
return new Message();
}
else
base.WndProc(ref m);
}
|
|
|
|
|
It still does not work. The form can still be moved around.
Sheng
|
|
|
|
|
The WM_MOVE message merely informs the window that it is being moved - it is not a request to move.
This code works for me. Put it in your form and it should work.
public const int WM_MOVE = 0x216;
private bool m_AllowMove = false;
[StructLayoutAttribute(LayoutKind.Sequential)]
public struct WM_MOVERECT
{
public int Left,Top,Right,Bottom;
}
protected override void WndProc(ref Message m)
{
if(!m_AllowMove)
{
if(m.Msg == WM_MOVE)
{
WM_MOVERECT lParam = (WM_MOVERECT)m.GetLParam(typeof(WM_MOVERECT));
lParam.Left = this.Left;
lParam.Top = this.Top;
lParam.Right = this.Right;
lParam.Bottom = this.Bottom;
Marshal.StructureToPtr(lParam, m.LParam, true);
}
}
base.WndProc(ref m);
}
Just change m_AllowMove to true or false to suit your needs.
Enjoy.
------------
Cheers,
Patrick
|
|
|
|
|
Patrick:
It works using WM_MOVING. Great! Thanks!
Sheng
|
|
|
|
|
Do you need the border ? if no you can set the FormBorderStyle to none.
|
|
|
|
|
Hi, LongHC:
I need the border bacause the form is the mother form.
Sheng
|
|
|
|
|
hello!!
i am desperate to know the way to authenticate a local windows account, by taking username & password, without using active directory!
did tried myself, invained, searched, never got a solution, all what i found were having active directory in it, i dont hav and i dont want to hav active directory installed!!!isnt there any way of doing it without active directory!!
can anyone please help???
Adeel
--
|
|
|
|
|
Hi there,
I've just started to use the RichTextBox control in Visual Studio. Just got few question, how can show the line number on the left hand side?
Also, how can i get these information about these from RichTextBox:
1. Line Number
2. Line Position Number
3. Line Column Number
So that i can use it to show these info on the status bar window.
Thanks in advance for your help~
|
|
|
|
|
|
Thanks allot Patrick Sears, the first one is my fav as its simple and does the job~
|
|
|
|
|
hi,
But it will get flickering wright.
when ever the line number changes after Enter.
|
|
|
|
|
hi all i m developing a network based game in C# 2005. i want to transfer objects of drawing class stored in arraylist,to another computer how to do it i only found one method "convert into byte from text and then send *".i have found no way to send objects. is sending arraylist is possible ? or i have to get each object from list and then convert into byte and then send.
my question is
1).how to convert arraylist into byte? if possible
2).How to convert objects in byte[] and then send.
3) is there any other method other than this to send objects of classes on network.
* byte[] buf= System.Text.Encoding.Unicode.GetBytes("Helllo World");
any other way of transfering object except method metioned above.
-- modified at 15:11 Tuesday 24th April, 2007
Regards.
Tasleem Arif
|
|
|
|
|
You're talking about a subject called "Remoting". Search for it on this website, there are dozens of articles from beginner to advanced describing how to do this.
------------
Cheers,
Patrick
|
|
|
|
|
Thanks for reply, actually i m makin that game in Compact Framework, i m using windows application just for the testing. i search on internet about the Remoting in .net CF it is not supported in .net CF so i have no option except to use the sockets.
Regards.
Tasleem Arif
|
|
|
|
|
Ah, I see. Yes, you're going to need to package the data yourself and push it out over a socket.
That said, it shouldn't be too difficult to do. The Compact Framework supports basic serialization, which should serve your purpose; if not, Marc Clifton wrote an awesome serializer here on Code Project:
http://www.codeproject.com/csharp/RawSerializer.asp[^]
It's easy enough to open a socket and call Write() on the data, and since it's a local TCP connection you probably don't need to worry about latency or data loss.
------------
Cheers,
Patrick
|
|
|
|
|
I am using C# 2005 Express Edition and want to create a report. Report tools does not come with it. How should I create report?
|
|
|
|
|
What did you want for free??
You'll have to buy something like Crystal Reports or one of the $$$ editions of Visual Studio .NET.
There's nothing that comes with the Express Editions.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Is there a way to share a resource file between two C# projects under one solution in VS2005. For instance,
Project1
-Class1.cs
-Class2.cs
-Resource.resx
Project2 - references Project1
-ClassA
Can sombody give me some example or a resouce
Thanks
|
|
|
|
|
guys u really doing agreat work..okie i just wanna to make color eraser ..like that one in Paint by c#..i didnt find it in deitel (it sucks).i can understand the code but i cant creat it .
fellas dont late for me..iam stuck..
Best Regards;);)
|
|
|
|