That is very sad.
AndrewVos
Posts
-
Thoughts on Flash -
measure stringTextRenderer should work for this. http://msdn.microsoft.com/en-us/library/system.windows.forms.textrenderer.measuretext.aspx[^]
-
how to secure webservices without providing username and password????????? -
How to change the classname???If you want to use SendMessage to send something to a window, do what was mentioned above. Maybe inherit a NativeWindow, and set the caption to something like "My Special Window". Then you can use FindWindow("My Special Window") to find the handle of the window you want to SendMessage to. All you need to do then is override WndProc in the NativeWindow. Have a look at FindWindow on pinvoke.net.
-
Alright.... -
How to change the classname??? -
How to change the classname???Override CreateParams, and set the class name yourself. Not sure if it will give you an exact name though, but it's worth a try.
-
EventsYou can check the FormClosingEventArgs in FormClosing. Allows you to cancel closing the form. I don't really know if the child forms will stay open, but it sounds logical that they will.
-
Explicit Safety in SAOh, it's definately afrikaans. It's from SA, and it was taken in simons town I think. Was drunk at the time!
-
Explicit Safety in SA -
Weird "Inconsistent Accessibility" problem -
Get the proper path name, proper case I mean.Ok, I've got everything working. It seems GetDirectories is actually fast enough when using a search pattern. Thanks for reading through the code, and here's what I'm using now.
public List Generate(string generationString) { List results = new List(); string[] pathParts = generationString.Split(Path.DirectorySeparatorChar); DirectoryInfo currentDirectory = null; for (int index = 0; index < pathParts.Length;index++ ) { string pathPart = pathParts[index]; if (index == 0) { //The first part will be the drive. DriveInfo[] drives = DriveInfo.GetDrives(); foreach (DriveInfo drive in drives) { if (drive.Name.StartsWith(pathPart, StringComparison.InvariantCultureIgnoreCase)) { currentDirectory = drive.RootDirectory; } } if (currentDirectory == null) { break; } } else if ((index == pathParts.Length - 1) ) { //The last part could be anything, so we do a wildcard search. try { results.AddRange(Directory.GetDirectories(currentDirectory.FullName, pathPart + "*")); results.AddRange(Directory.GetFiles(currentDirectory.FullName, pathPart + "*")); } catch { } } else { //Just add the first result to the path. DirectoryInfo[] searchResults = currentDirectory.GetDirectories(pathPart); if (searchResults.Length == 0) { break; } else { currentDirectory = searchResults[0]; } } } return results; }
-
Get the proper path name, proper case I mean.string fixedPath = @"c:\program files\"; FileInfo fileObject = new FileInfo(fixedPath); fixedPath = fileObject.FullName; MessageBox.Show(fixedPath);
This would return "c:\program files".
-
Get the proper path name, proper case I mean.Well, so it looks right to the user. I'm working on a bit of autocomplete code (like the Run dialog). I do know about ComboBox/TextBox autocomplete, but it doesn't meet the specs.
-
Get the proper path name, proper case I mean.I'm looking for a way to get the proper path name, for example if I have: "c:\\program files" I would expect "C:\\Program Files". Any ideas? I'm using the code below now, but the use of GetFileSystemInfos is going to be a performance problem some time...
private string fixPathName(string path) { string[] pathParts = path.Split(Path.DirectorySeparatorChar); string fixedPath = null; for (int index = 0; index < pathParts.Length; index++) { string pathPart = pathParts[index]; if (index == 0) { fixedPath = pathPart; fixedPath = Path.GetFullPath(fixedPath); } else { fixedPath = Path.Combine(fixedPath, pathPart); DirectoryInfo parent = Directory.GetParent(fixedPath); FileSystemInfo[] paths = parent.GetFileSystemInfos(Path.GetFileName(fixedPath)); string pathProperName = paths[0].FullName; fixedPath = pathProperName; } } return fixedPath; }
-
[Message Deleted][Message Deleted]
-
Bug in ListView.Items.Insert(int,ListViewItem)? -
Comparing enums? -
Comparing enums?You're trying to compare the types to each other. The enum Equals takes two enum values.
-
Bug in ListView.Items.Insert(int,ListViewItem)?I seem to have found a bug in ListView.Items.Insert(int,ListViewItem). Could someone please try reproduce this? Maybe I could get a bug report submitted. (Problem seems to occur on 2.0 and 3.5) Steps to Reproduce: 1. Start a new project 2. Add a ListView with five items in it. 3. Label them 1 to 5 so we can see what happens. 4. Add a Button. 5. Add the following code to Button.Click:
ListViewItem item4 = this.listView1.Items[3]; item4.Remove(); this.listView1.Items.Insert(0, item4);
The items should be arranged like this: 4 - 1 - 2 - 3 - 5 Instead we see this: 1 - 2 - 3 - 5 - 4 Workaround: I have found if we switch to View.Details before doing the remove/insert then everything works fine. Replace the code in Button.Click with this:ListViewItem item4 = this.listView1.Items[3]; View oldView = this.listView1.View; this.listView1.BeginUpdate(); this.listView1.View = View.Details; item4.Remove(); this.listView1.Items.Insert(0, item4); this.listView1.View = oldView; this.listView1.EndUpdate();