|
Hi,
Thanks for your reply.Unfortunately, i did not write single piece of code to check which key was pressed.
In form i have added button text like (&Help...etc).
my menustrip still captures the alt key(First time), and still disables any further typing until I press alt again.
I'm using key combinations of Alt-A, Alt-D etc to focus onto various fields on the form. Any of these will force the menustrip to capture the Alt key.
Regards,
Sri
|
|
|
|
|
Your key-combinations (where Alt and A are both pressed at the same time) work, even if a single keypress on the Alt prevents further input.
A keypress on Alt should give you the option to browse the menu. Windows doesn't capture the key, but the focus. The second keystroke then determines what menu to open. That's two seperate keystrokes.
Your key-combination is Alt-A, and the A is typed while the Alt-key is down. That gives different behaviour on Windows - it first checks if there's a shortcut-key defined (e.g., the letter right after the "&"-char in the caption of a button)
These two behaviors shouldn't bite each other. If your end-user is like me, he'll be using the Alt-key often enough to navigate the menu
I are Troll
|
|
|
|
|
Hi, i want to create a winform that contains a chess board surface/graphic.
I have a programm that generates a specific fieldindex. This index should be given to the chess board form and initiate the highlighting of the choosen field.
How can i handel this two problems.
first the drawing and highlighting of the chess board
and second the datatransfer from the programm to the winform(maybe by using delegates?)
thanks
|
|
|
|
|
benstar111 wrote: first the drawing and highlighting of the chess board
For this you will need to handle the Paint event of the form and then draw the chess board using the FillRectangle method of the Graphics object.
benstar111 wrote: the datatransfer from the programm to the winform(maybe by using delegates?)
That depends on the what exactly is the second program you need to send data to. If that is a managed dll, just add a reference to it and use the methods it exposes.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Hi all,
I want to know how windows installs the update while system is shutdown.
Using that knowledge i want to write an application which will able to delete the driver file ;which does not gets deleted in native mode.
|
|
|
|
|
|
Sir, i have tried using the above info but it is not possible to delete the file.
I just want to know how windows installs updates ???
|
|
|
|
|
The Windows API Code Pack for Microsoft .NET Framework provides a source code library that can be used to access some new Windows 7 features (and some existing features of older versions of Windows operating system) from managed code. These Windows features are not available to developers today in the .NET Framework.
You can get code pack from http://code.msdn.microsoft.com/WindowsAPICodePack[^]
For more information, see Windows API Code Pack for .NET Released[^]
|
|
|
|
|
Hi, guys, I'm writing simple tool for interest, like managing softwares, file association or IE history.
But when I get into this field, I find there are many information stored in files or registry. Like "index.dat" or "HKLM\SOFTWARE\Clients".
So I want to know, where I can get more information about such thing( registry about shell )?
Thanks in advance.
|
|
|
|
|
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
The Windows 7 Training Kit for Developers includes presentations, hands-on labs, and demos designed to help you learn how to build applications that are compatible with and shine on Windows 7. You'll learn about how you can build in Touch, MultiTouch, implement Taskbar, Ribbon, Sensor, and more.
Windows 7 Training Kit For Developers^]
|
|
|
|
|
I have 2 forms in a windows application - LogonForm and ProcessForm. The Logon Form is setup as the "Startup Object" for the project. Upon successful logon, I have the below code to transfer the control from LogonForm to ProcessForm and close the LogonForm (only).
//Instantiate ProcessForm and Show ProcessForm
MyProcessForm = new ProcessForm(InputData);
MyProcessForm.Show();
//Close the Logon Form
this.Close();
This code actually closes the entire application without showing the ProcessForm.
Now, if I change this.Close() to this.Hide(), the ProcessForm opens, but when I close the ProcessForm, I can see the application still running as the "LogonForm" is still in the hidden state.
When I close the ProcessForm, I have to close the entire application. Can you please help me with how to do it? Thanks in advance for your help
|
|
|
|
|
Hi,
Yes the first form is the main form, closing it ends the app.
If you are working in C#, have a look at Main() in program.cs; you'll see your first form is treated differently, it is passed to Application.Run
You could adapt program.cs to have two Application.Run statements, one with the logon form, the next with your real main form.
OTOH Application.Exit() should terminate your app no matter what.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Luc Pattyn wrote: You could adapt program.cs to have two Application.Run statements, one with the logon form, the next with your real main form.
Hi Luc, thank you very much for your response. Will I be able to pass information on if the logon was successful or not (like a boolean flag or an object with all the logon credential entered in the logon screen) back to program.cs to determine if the main form should be displayed or not for the user?
Thanks again for your help!
|
|
|
|
|
crazylad wrote: Will I be able to pass information
I don't know. I would. But then I wouldn't need to, as I wouldn't want to show the real main form on an unsuccessful logon.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
When the main form closes, it will stop the message loop and your application will end. You need to change the main method and do something like,
int main()
{
if(loginValidated)
{
Application.Run(new ProcessForm());
}
}
|
|
|
|
|
N a v a n e e t h wrote: int main(){ // show the login form here. if(loginValidated) { // starts the application message loop Application.Run(new ProcessForm()); /* .... */ }}
Hi Navaneeth, thank you very much for your response. If I use Application.Run(new LogonForm()) and try returning a boolean parameter to indicate successful/unsuccessful logon, the project doesn't build successfully.
Would you know how I can return the logon status to main(). Thanks again for your help!
|
|
|
|
|
There are a dozen ways to pass data around, here is one using a user-supplied Form property.
LogonForm lf=new LogonForm();
Application.Run(lf);
bool success=lf.Success;
lf.Dispose();
if (success) ...
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Will that be good to start application message loop (Application.Run ) only after validating login?
|
|
|
|
|
N a v a n e e t h wrote: message loop (Application.Run) only after validating login?
You don't need a mesage loop to construct a form or anything else; you need one to get it alive on the screen. Me creating the form before Run() gives me a reference so I can get at its Success property afterwards.
Your code below is fine too, there you make the LogonForm modal, so it gets its own message loop from ShowDialog.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
crazylad wrote: If I use Application.Run(new LogonForm()) and try returning a boolean parameter to indicate successful/unsuccessful logon, the project doesn't build successfully.
IMO, you need to use Application.Run only when the login is successful. As I said, before calling Application.Run , validate the login and if successful call it. To get the validation result back, you can use DialogResult enum provided with .NET framework. You can do like this,
int main()
{
bool loginValidated = false;
using (LoginWindow window = new LoginWindow())
{
loginValidated = window.ShowDialog() == DialogResult.OK;
}
if(loginValidated)
{
Application.Run(new ProcessForm());
}
} Inside the login form, once you validate all the details, write like
this.DialogResult = DialogResult.OK;
|
|
|
|
|
N a v a n e e t h wrote: IMO, you need to use Application.Run only when the login is successful. As I said, before calling Application.Run, validate the login and if successful call it. To get the validation result back, you can use DialogResult enum provided with .NET framework. You can do like this,int main(){ bool loginValidated = false; using (LoginWindow window = new LoginWindow()) { loginValidated = window.ShowDialog() == DialogResult.OK; } if(loginValidated) { // starts the application message loop Application.Run(new ProcessForm()); /* .... */ }}Inside the login form, once you validate all the details, write like
this.DialogResult = DialogResult.OK;
Navaneeth & Luc, thank you very much for your response. It was of great help. I also happen to come across an article about passing data between forms. I'm providing the link in this post for the benefit of anybody that is looking for the same information.
Passing Data Between Forms[^]
Thanks again for your help!!
|
|
|
|
|
I know several ways to hide individual properties, and in something I'm working on I do it using a Designer , more specifically by overriding the PreFilterProperties method
protected override void PreFilterProperties(System.Collections.IDictionary properties)
{
properties.Remove("Dock");
properties.Remove("TabStop");
properties.Remove("TabIndex");
properties.Remove("Visible");
properties.Remove("Enabled");
properties.Remove("Locked"); <===========================================================
properties.Remove("Anchor");
properties.Remove("Name"); <===========================================================
properties.Remove("AutoSize");
properties.Remove("AutoSizeMode");
properties.Remove("Location");
properties.Remove("Size");
properties.Remove("MaximumSize");
properties.Remove("MinimumSize");
properties.Remove("BorderStyle");
properties.Remove("GenerateMember");
properties.Remove("Modifiers");
properties.Remove("Design");
base.PreFilterProperties(properties);
}
The two properties marked still show up however.
They are both in the 'Design' Category, so even if the code above worked, I would still be left with an empty Category. So
1) anybody got any ideas about why the two properties remain and/or how to get rid of them.
2) any ideas on how to remove the 'Design' Category. If you look at either of the Panels in a SplitContainer , they don't have a Design Category, so presumably it is possible.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello Sir Henry,
my undercover informant told me the secret of SplitContainer panels is in this line:
[EditorBrowsable(EditorBrowsableState.Never), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
Hope that helps.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi Luc,
Thanks for that. I had completely forgotten EditorBrowsable , so this was a useful reminder. Unfortunately these attributes are of no help in my case.
I have discovered, through experimentation and reading the documentation that Locked , certainly, and Name must be guilty by association, is not a Property of Panel , which my class descends from. It therefore must be provided by an Extender Provider in the host designer. I vaguely remember reading this about Name somewhere anyway. So it's another round of googling and reading, unless your good self or A.N. Other has a solution.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|