I forgot to mention that I'm working with .NET Compact Framework, but your answer helped me enough to find the solution. On Compact Framework I had to check for this.Site.DesignMode
rather than just this.DesignMode
. Thanks a lot :)
Tormod Fjeldskaar
Posts
-
Detect if control is hosted in the Visual Studio designer? -
Detect if control is hosted in the Visual Studio designer?I'm creating an animated custom control using System.Windows.Forms.Timer as the animation trigger. I would like to freeze the animation during design time, however, as the animation may disturb the user. Is it possible to detect somehow that that the control is hosted in the Visual Studio designer?
-
API & DLLQuoting Wikipedias definition for each term: API[^]: "An application programming interface (API) is a source code interface that a computer application, operating system or library provides to support requests for services to be made of it by a computer program." DLL[^]: "Dynamic-link library (also written without the hyphen), or DLL, is Microsoft's implementation of the shared library concept in the Microsoft Windows and OS/2 operating systems." Hence, a DLL is one way to expose an API or parts of an API to the programmer. Another way to expose an API is through a Web Service[^]. So, to recap, the MS Office API is the specification of what functionality you as a programmer can use to interact with MS Office, while the MS Office DLL (DLLs actually, there are lots) is the binary code executed by the computer through you program if you use the API.
-
Default program of file.I can't see that it does. The page you point to describes how the Default Programs API works, i.e. how to tell windows the capabilities of a certain application.
-
Default program of file.To see how this information is stored in the registry, you may want to read what Microsoft has to say about file types[^].
-
ScrollBar on Form .NET 2005 C# Windows FormSorry, I have no project to point you to, but the documentation can be found here[^]. Adjust the properties
Minimum
andMaximum
to determine the interval of the scroll bar. Respond to theValueChanged
event and read theValue
property to reflect changes when the user scrolls (or optionally use data binding). -
deserialization problemYou don't need a common arraylist to serialize several arraylists into one file. Just make several calls to
formatter.Serialize
passing the same stream:formatter.Serialize(myStream, arr1)
formatter.Serialize(myStream, arr2)
formatter.Serialize(myStream, arr3)To restore the arraylists, make the calls to
formatter.Deserialize
in the exact same order:arr1 = (ArrayList) formatter.Deserialize(myStream);
arr2 = (ArrayList) formatter.Deserialize(myStream);
arr3 = (ArrayList) formatter.Deserialize(myStream); -
deserialization problemIf you serialize the lists into separate streams, just remember which list resides in which stream and you'll be fine. If you serialize the lists into one common stream, though, make sure you deserialize them in the exact same order they were serialized.
-
can i use optional parametersOne way to solve it is to use polymorphism method overloading:
private void MyMethod(int x, int y, int z)
{...}private void MyMethod(int x, int y)
{
MyMethod(x, y, 10); //gives z default value 10
}private void MyMethod(int x)
{
MyMethod(x, 5); //gives y default value 5
}-- modified at 2:56 Tuesday 7th August, 2007
-
Expiring appThe program needs a way to tell that it's the first time it runs, though... Otherwise, the user could just delete the file or registry key, and the program would create a new one, practically giving you 60 more days of testing.
-
Double characters in regexpThis should do it:
//\s*{\s*__(?.*(?=__))__\s*(?\x23[^}]*)*}
-
How to safely Form.Invoke from another thread? [modified]How about wrapping both your
protected override void Dispose(bool disposing)
-method and your invoke-procedure in alock(...)
-block? Ref.: http://msdn2.microsoft.com/en-us/library/c5kehkcz(vs.80).aspx -
DataGridViewforeach(DataGridViewRow row in yourDataGridView.Rows) { foreach(DataGridViewCell cell in row.Cells) { /* do your stuff */ } }