|
Thanks
It worked to some extend but i still want to some thing
Suppose that currently i am on form2 which u call f2 and i press the back button it should move to the currently running form1 but how to refer to the
currentl running form1.
Because in Main method
Application.run(new Form1);
creates an object but has no name to refer to
Any idea .
Thanks for u r help.
|
|
|
|
|
you can use:
Form1 form1 = new Form1();
Application.Run(f1);
and pass the form1 to form2 constructor.
Good Luck!
|
|
|
|
|
but is there a way to convert a byte array into int ?
[Edit]
Never mind, I found it. There goes the 5 minute rule again.
Anyway for those interested, use BitConverter.ToInt32
[/Edit]
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
Support Bone
It's a weird Life
|
|
|
|
|
I am trying to implement cut copy and paste in my application. I have the cut,copy and paste buttons on a toolbar and they are always visible. I have tried hooking the Controls Enter event but this solves only half the problem. I also need to be able to tell if text is being highlighted.
This is not on a menu so I cannot just hook the menu_click event
Thanks in Advance
Forever Developing
|
|
|
|
|
I ran into this and solved it in a funny way...
Instead of using the TextBox control, I subclassed the RichTextBox to mimic an "Enhanced" TextBox.
In the subclass set the Multiline property to false, and the height to 20. This essentialy makes the RichTextBox look like TextBox.
Now you can hook into the SelectionChanged event and check the Can<xxx> properties to enable/disable your buttons. Call the SelectionChanged handler from the Enter event for the object to handle the initial setup.
|
|
|
|
|
A good way is to take advantage that WM_COMMAND messages are passed to a control's parent (keep in mind that all controls in System.Windows.Forms are just wrapper classes for Windows Common Controls). If you override WndProc in your main form, all child controls - as well as their children, and so forth - will send you a WM_COMMAND message that you can mask for the EN_SETFOCUS or EN_SELCHANGE notification message. You then use the Message.HWnd property to get the Window handle (HWND ) and use Control.FromChildHandle to get the control. You can then cast it to a TextBoxBase (base class for both TextBox and RichTextBox ) and call the Cut , Copy , or Paste methods on it.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I got a great idea. It is a little bit cheesy, but it appears that Microshnizzle does it this way alot, so if they can do it, so can we! Make ONE function for each of the following handlers and subscribe all of your text boxes to it.
1. Mouse UP
2. Key press (interested in the left and right arrows)
When either of these events is fired, check the Selection for the Textbox (Textbox.SelectionLength). If the selection Length is NOT zero, then Enable your cut and copy buttons, if the length is 0, nothing to copy, so Disable the cut and copy buttons!
|
|
|
|
|
Hi, I would like to know how is it possible to see:
1. if a specific application is being installed, and
2. how could i get the path to the executable.
Edit: i found out, i will have to read the machine's registry, in order to be able to get the path to an application. Could someone post an example of how i can reach the application's directory by accessing the registry?
thank you.
|
|
|
|
|
It depends on the installer technology. If the app installer is a Windows Installer package, you can use WMI to not only list the apps installed, but to watch when new ones are installed (add an event and hookup code to it). See the System.Mananagement namespace for information. There are also a few articles that talk about the WMI integration with VS.NET on this site, too, though nothing specific to your problem.
Also with Windows installer, each component SHOULD (and often does) have a key path that represents the executable. If you know the component ID (a GUID) you can get its key path.
For other installer technologies, it's specific to the implementation and often times will not be possible. You could also use a FileSystemWatcher but this could be expensive as you'd have to watch a lot of files, or take a snapshot of the system before and after (a system diff), but that's even more expensive.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I want to make a Modeless Dialog box that will pop up and allow processing to continue in the main window. The dialog box is only displaying some information and just needs an OK button that will destroy it. If I use .Show() instead of .ShowDialog() to make it modeless, processing continues, however, the dialog does not redraw and it goes permamently not responding with an hourglass.
What is the proper way to do a modeless dialog box?
Thanks
|
|
|
|
|
|
Before going thru the effort of making a new thread.. Try .Refresh() right after the .Show() call.
|
|
|
|
|
I apologize if this has been answered here before but I found nothing browsing through this forum. Through a bit of web search I found an article from a MS Support guy that the control NumericUpDown does not support the XP/System theme by default and you actually have to code your own which ticks me off a bit since I do not have the knowledge to do so. Does anyone want to share either some code example or an url where this is featured, I've searched for days but I have found nada.
Thanks for any help on this matter.
|
|
|
|
|
|
Read the Theme API documentation - it's really not too hard to use. Since the topic isn't actually called "Theme API", search for this function and sync your TOC to see the entire topic: OpenThemeData .
I think I saw some here on CP about using this, but never forget google.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks for the quick replies guys, I'll check it out.
|
|
|
|
|
i am doing a program and i put main() in my first form,i want to make my program appear in the taskbar(tray),this code need to have main in it ,and project mustn't have two main()???any help
|
|
|
|
|
See the NotifyIcon component documentation. There are also a few articles on the subject here on the CP site. Your application needs only one static Main method (an application should have only one entry point to execute the application) and use the NotifyIcon to add an icon to the system tray.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Do you know if there is a way to get a message from Windows Explorer when my application is about to drop data into it?
At this point I am calling
control.DoDragDrop(dataVar, DragDropEffects.All);
when drag is triggered?
The problem is that I have to create a bunch of files and it takes a while, so I'd like to do all that OnDrop instead of OnItemDrag in case the user decides to cancel.
Another problem is that the dataVar needs to be in different formats depending on whether the user is dragging internally or externally (to windows explorer). I have no idea how to do that.
Any help would be appreciated,
Elena
Elena
|
|
|
|
|
Unfortunately, this is not as easy as is hoped. I was looking for something similar, if not identical, and it's not just a case of droping an object into the windows enviroment.
I've been trying to figure this out for weeks now, and i've had to go an look at COM and IDL to study the interfaces used by objects in unmanaged code to handle streams, before I can even begin to grasp how it would work in managed code.
It's all fun and games if you enjoy going balled through hair tearing though
I'm sure Heath will be able to fill you in far better than I can, but this is just a warning from someone who's stuck on the same thing!
Cata
|
|
|
|
|
As Cata mentioned, this has all been covered in the past. Search this forum for previous posts. You could also look at Catalysts's profile and see the messages posted. Most of them are related to this problem.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi,
Im looking for some sample code in C# which shows how to access multiple frames / pages in a TIFF image file and display them in a PictureBox Control.
I have researched the area and found a sample application in VB.Net but i cant seem to convert it correctly.
I have a problem getting the list of GUID's out of the image...
Thanks
Andrew
|
|
|
|
|
VB.NET and C# (and all other languages that target the CLR for that matter) use the same class libraries and all compile to IL. It's important to understand the Framework technology, not the language! VB.NET isn't that hard (hell, code monkeys have been using it - and coincidentally creating bad apps - in straight VB for years). Just remember that most of the calls are probably just to classes, methods, properties, structs, etc. that are just as accessible in C# as they are in VB.NET.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I have cloned the mainMenu to the context Menu. If I set the .Enabled or .Disabled in the form load event. These feature works properly. But If I minimize the form to use the contextMenu, the mnHide menuItem is not Hidden. If I click on Hide when the form is hidded, this causes the form to be squeezed to just the min, max and close buttons, when I do finaly hit the Show button.
Right now my issue is getting the mnHide button to hide, but this isn't working? Is there another way to hide the cloned context menu items ?
//
//contextMenu1
//
this.contextMenu1.MenuItems.Add(mnShow.CloneMenu());
this.contextMenu1.MenuItems.Add(mnHide.CloneMenu());
private void contextMenu1_Popup(object sender, System.EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.mnShow.Enabled = true;
this.mnHide.Enabled = false;
}
else
{
this.mnShow.Enabled = false;
this.mnHide.Enabled = true;
}
}
Thanx in advance for your help.
**DAN**
|
|
|
|
|
mnShow and mnHide are not the correct objects to enable / disable. Remember, you cloned them so they are not the same object reference. Instead, try something like this:
Menu mnShowClone = mnShow.CloneMenu();
Menu mnHideClone = mnHide.CloneMenu();
this.contextMenu1.MenuItems.Add(mnShowClone);
this.contextMenu1.MenuItems.Add(mnHideClone);
private void contextMenu1_Popup(object sender, EventArgs e)
{
mnShowClone.Enabled = this.WindowState == FormWindowState.Minimized;
mnHideClone.Enabled = !mnShowClone.Enabled;
}
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|