|
Disable the button when the related form is opened, and re-enable it when the related form closes.
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.”
|
|
|
|
|
Well, after months of trying to figure out the whole Regex stuff, I'm glad to say that I just stumbled upon this cute little website. It's a Regex cheat sheet, and as soon as I read the first page, I understood everything. This site was so helpful and so I thought I might aswell share it with everybody!
Jay.
Oops, I almost forgot to paste the link. Here it is:
http://krijnhoetmer.nl/stuff/regex/cheat-sheet/[^]
foreach( inch on Jason )
{
Girlfriend.IsHappier();
}
|
|
|
|
|
Just printed it, thanks for sharing
I are troll
|
|
|
|
|
|
That only covers the very basics.
|
|
|
|
|
Hi, I would like to display two different Icons next to my nodes in a treeview only problem is they are different sizes. I could set the Image list to the size of the largest one but i dont want big gaps around the smallest one. Can anyone help me out?
|
|
|
|
|
you could use an image editor to resize your images . . .
|
|
|
|
|
sorry I must not have explained myself properly. As far as I can tell to use icons in treeview you create an image list. This image list is then used by treeview. My problem is that the image list only outputs images to treeview of one size. I can generate images of any size i like but they are scaled by the imagelist to say 32x32. in this case the image i have of 32x32 will be fine but the image i have of 16x16 will be stretched to 32x32. I dont want to stretch my image to 32x32. I could use an image editor to make it 32x32 and keep the actual image the same size but it leaves big gaps in my treeviw and looks really bad. any ideas?
|
|
|
|
|
you can tell the imagelist what size to make your images: ImageList.ImageSize[^]. The docs say the default is 16x16 so if they're being scaled to 32x32 then maybe something is changing the default value and you need to reset it to the size you want.
|
|
|
|
|
I have a menu item with a shortcut key of "del" so that I can do all entry deletion through the item's handler.
However, if an entry is being edited, I don't want it deleted if the user presses the del key, instead, I want to have normal the normal del behavior of text boxes.
At first thought, I wanted to simply go with a sort of, "If editing an entry, then entry.RaiseKeyEvent(key, e), else delete entry," though I can't as RaiseKeyEvent is a protected method.
For now, I have simply used my own implementation of what I believe the expected del behavior to be, but would highly prefer to be able to let the control use its own...
In case there is a way to solve this problem that by-passes my original question, I also have another case where I would need to do something like this...
Thank you for reading this at least, =]
|
|
|
|
|
Hi,
one of these should help you out: Control.IsInputKey() or Control.ProcessCmdKey()
Can't remember which exactly.
|
|
|
|
|
You can override Control.IsInputKey() for a user control so that the control can handle events for arrow keys or other typical keys, but I'm not seeing that stopping the menu item from using its shortcut key... ...
|
|
|
|
|
Acshi wrote: However, if an entry is being edited, I don't want it deleted if the user presses the del key, instead, I want to have normal the normal del behavior of text boxes.
I had the same problem some time ago and my first solution was to disable the shortcut-key before editing text. That got messy quite fast, and thus I changed the shortcut-key to Ctrl-DEL . I don't know if that's a viable option for your project though
I are troll
|
|
|
|
|
hello
TransactionScope vs oConn.BeginTransaction - seems like TransactionScope yields cleaner code but is there more to it than just cleaner code?
Thanks
dev
|
|
|
|
|
AFAIK, TransactionScope can "escalate" to use the distributed transaction manager if required, whereas BeginTransaction uses the distributed transaction manager for every transaction.
|
|
|
|
|
My application writes data into the Registry which is causing a UAC issue on vista. I keep data in the registry so I can access it across different applications we have (this is not a mass product but only installed on selected machines).
Since I am storing data into the LocalMachine SOFTWARE keys, is that was is causing the UAC errors, or should I store the application config settings somewhere else?
|
|
|
|
|
Look into the use of the applicationdata folder, I beleive it is designed for this type of use instead of the registry. I think you'll find fighting Vista's UAC will drive you nuts whereas changing the data store is fairly simple.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Anything that is user specific will work just fine, such as Environment.SpecialFolder.ApplicationData and HKCurrentUser.
Anything that applies to all users will fail unless you have admin rights and elevated privileges apply, as for Environment.SpecialFolder.CommonApplicationData and HKLocalMachine.
The logic is: a single regular user is not allowed to influence the machine's behavior for other users.
|
|
|
|
|
I am trying to find out the best practice for calling one function out a set at random. I am using this to establish a random event in a video game.
For instance, let's say over time a bunch of different things could happen to a plant over time. So, every 5 hours, a random thing happens to this plant (resulting in 1 of many functions being fired).
The current way I am thinking about this follows in this example:
A timer knows about a list of 100 plants. When the timer ticks, it is randomly decided that the InsectInfestation method will be fired and it will affect 30 plants.
Where is the best place to store these random event methods?
The plant? An interface to the plant?
What is the best method of firing one at random?
A delegate in the timer that queues up the methods contained in the 30 affected plants? If so, how do I call up these methods in an algorithm?
---------------
TyloCook
|
|
|
|
|
Hmmm... interesting... there are many ways.
Perhaps the Plant (IPlant interface?) could have an Update method? And in the Update method you generate a random number and use a switch to determine what should happen to the individual Plant?
Or perhaps you could have a facility to apply some other class (Decorator Pattern?) to the Plant. So you have a Plant and then do something like myPlants [ i ].Infestations.Add ( new InsectInfestation() ) ;
At any rate, the effects of the infestation should be handled by the Plant, not by an outside agency.
|
|
|
|
|
now i am doing my project ussing C# to recive input from extrnal circuit I use sound card but i can't access the sound card if you now the class library used for recive input from sound card write me
|
|
|
|
|
There are many.
However, Google for 'DirectSound c#' should get you started.
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.”
|
|
|
|
|
i can insert picture from file location but can not use ctrl+v to paste the image.
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.V)
{
DataFormats.Format df;
df = DataFormats.GetFormat(DataFormats.Bitmap);
if (Clipboard.ContainsImage())
{
rtbDoc.Paste(df);
e.Handled = true;
Clipboard.Clear();
}
}
modified on Saturday, April 11, 2009 5:50 PM
|
|
|
|
|
Hi,
Clipboard.GetImage() is required, you can't paste a data format.
BTW: CTRL/V should not clear the Clipboard.
|
|
|
|
|
here is the code...
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.V)
{
DataFormats.Format df;
df = DataFormats.GetFormat(DataFormats.Bitmap);
StringCollection strcollect = Clipboard.GetFileDropList();
Image image = Image.FromFile(strcollect[0]);
Clipboard.Clear();
Clipboard.SetImage(image);
if (Clipboard.ContainsImage())
{
rtbDoc.Paste(df);
e.Handled = true;
Clipboard.Clear();
}
}
|
|
|
|