473,385 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Hide and unhide

Hello all i am rather new to the whole c # and .net language. my question is in regards to the c# portion of the matter. this is my code block which i have for hiding and unhiding::

Expand|Select|Wrap|Line Numbers
  1.         private void Form1_KeyDown(object sender, KeyEventArgs e)
  2.         {
  3.             if (e.Alt && e.KeyCode.ToString() == "F")
  4.             {
  5.                 // When the user presses both the 'Alt' key and 'F' key,
  6.                 // KeyPreview is set to False, and a message appears.
  7.                 // This message is only displayed when KeyPreview is set to True.
  8.                 this.Visible = false;
  9.                 MessageBox.Show("KeyPreview is True, and this is from the FORM.");
  10.             }
  11.         }
  12.         private void textBox1_KeyDown(object sender, KeyEventArgs e)
  13.         {
  14.             if (e.Alt && e.KeyCode.ToString() == "F")
  15.             {
  16.                 // When the user presses both the 'Alt' key and 'F' key,
  17.                 // KeyPreview is set to False, and a message appears.
  18.                 // This message is only displayed when KeyPreview is set to False.
  19.                 this.KeyPreview = true;
  20.                 MessageBox.Show("KeyPreview is False, and this is from the CONTROL.");
  21.             }
  22.         }

now what my main question is how do i call to a form after it hidden per a keyboard shortcut... i do not want a system tray icon to show or anything this a key combination to bring it back. what it appears is that i may have to use another method due to the fact that i can't input to the form directly if it is hidden. any help is greatly appreciated.

Trae Wathen
Jun 4 '07 #1
1 1473
Plater
7,872 Expert 4TB
You need to create what I believe is refered to as a "global hook", your program will monitor keyboard events even when it does not have the focus.
I cannot remember how to do this (it might require a dllimport) but google "global hook in c#" or something.
They are not natively supported in .NET
See: http://support.microsoft.com/kb/318804
And : http://msdn2.microsoft.com/en-us/library/ms644959.aspx
Jun 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: deko | last post by:
Is there any way to work around the blank space created by hidden divs? I'm trying to use a relatively postioned divs with show/hide behaviors to annotate an image. The divs show/hide...
9
by: Wang, Jay | last post by:
I try to group several rows in a table into a div and show/hide them by click on a button somewhere with a javascript link. When clicked, the link will toggle the style of the div section's style...
5
by: mooeypoo | last post by:
Hello all, I'm a php developer. I have been using a very simple script to hide/unhide divs in my script: function DisplayI(obj) { obj.style.display=("none"==obj.style.display? "block" :...
2
by: Peter K | last post by:
How do I Hide/Unhide the Main Database Window in VB?
1
by: Simon | last post by:
Dear reader, In a form with the property "Default view" as DataSheet I like to hide some fields in the datasheet view. It is possible to manage this with the command Format>>Unhide...
3
by: toodi4 | last post by:
I'm using a javascript that hides and unhides text based on a button click. It works great across static fields on a form. The problem I have is that I'm trying to hide and unhide various fields...
3
by: =?Utf-8?B?aWxy?= | last post by:
Hi All I am developing an vb 2005 winforms application that connects to a database and displays a datagridview of the data. A user can select and then edit, or create a new entry by opening a...
1
by: Simon | last post by:
Dear reader, In a datasheet form you have the possibility to hide or unhide columns. But in case the datasheet form is a sub-form this functionality is not longer available.
4
by: somasekhar | last post by:
Does anyone know how to have a user click a checkbox to unhide a editfield Unclick of the checkbox would hide it again. There is an example of html file on the Javascript .But I want hide and unhide...
6
by: Ralph | last post by:
Hi, I was reading effictive C++ and some other books again and they all tell you about hiding implementation details (proxy/pimpl/inheritance) but they never really explain when to use it. I...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.