|
What you send to the translators doesn't necessarily have to be what you compile into resource files, so do whatever makes it easier. Since they are XML files (and you can also use plain text files using key=value pairs, but then you can only localize strings and not any Type that is attrbuted with a specific TypeConverter ), you can do just about whatever you want.
When you compile the resource files, however, they must be compiled into separate satellite assemblies. These satellite assemblies are identified by a specific culture.
Take a fully-qualified assembly name:
System, culture=neutral, version=1.0.5000.0, publicKeyToken=b77a5c561934e089 Notice the neutral? Primary assemblies (those assemblies that contain the IL module(s)) must always be neutral (but can contain your neutral language, which is why I mentioned using the assembly-level attribute NeutralResourcesLanguageAttribute for faster look-ups). Satellite assemblies replace "neutral" with whatever locale/language for which they were compiled.
Both the ResourceManager and the ComponentResourceManager (which extends the former) look-up resources in satellite assemblies using this information. You could create your own resource manager classes to look for resources in a single assembly, but there's so many problems with that.
It's inflexible and bloats the size of your assemblies when N-1..3 languages are necessary for any particular user (1..3 denotes cases when have locale-specific resources, which fallback to language-specific resources, which fallback to neutral resources). You also loose the ability to integrate with visual designers, unless you plan on implementing your own plugins for each designer instead of making the designers work for you (which is how the ComponentModel currently works).
Be sure to read-up on the classes I've mentioned as well as the links I gave you. It explains a lot of information.
Just going through an example of localizing a simple sample application and examining the code really helps, too. Create a new project, throw some controls on the form, assign some text, then localize it using the steps I've mentioned. Examine the source, compile the project, and examine the output. You can learn a lot from such an example.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi all,
Do the SQL Server CE on Pocket PC have the capability of recording locking ?
Thanks
|
|
|
|
|
From the documentation, locking is used by the engine which does not accept hints like with SQL Server 2000 and other mature RDBMS's. SQL Server CE is lightweight and does not implement many features.
For specific information on locking, please see the documentation listed above - especially the second item.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi~
I have encountered a very difficult problem and worked for a long time but still can't solve it. Pls help it.
The problem is :
There are two cases. One is for .net full vesion, one is for .net compact framework.
For the .net full version, "ListViewEx" is a class which extend listView.
class ListViewEx : ListView
{
ListViewEx()
{
}
protected override OnPaint(PaintEventArg e)
{
MessageBox.Show("ABC");
base.OnPaint();
}
The problem is the overriding OnPaint not be executed if a instance of this class newly be created but the base class (I don't know the method (OnPaint()) of the class "Control" or class "ListView" will be called and draw the listview only without showing message box.
However, the overriding OnPaint method seems works if the extended window control is not listview but button or panel. (Other control also not work). What is the problem?
For the CF case,
The case is that the if Class for example "ListViewEx2" extend the class ListView, the overriding Method OnPaint() still not work since the virtual void OnPaint method in the ListView Class is not supported.
However, as the ListView extend Control, and the control also got the virtual method OnPaint(), that mean the ListViewEx2 also got the virtual OnPaint method and which can be overrided by ListViewEx2. Then why the overrided method in ListViewEx2 does not executed?
Thanks
}
|
|
|
|
|
OnPaint is not used by the ListView control, as you could see by disassembling or decompiling the System.Windows.Forms.dll assembly.
Almost every control in Windows Forms simply encapsulates the Winodws Common Controls. In the case of some controls like ListView owner drawing the control simply by overriding OnPaint is not possible. To owner draw a List-View common control you need to override WndProc , define several custom drawing structures, and P/Invoke several native APIs.
For more information about the native List-View common control that is encapsulated by the ListView managed control, see http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/listview/reflist.asp[^].
For examples on this site about owner-drawing a ListView control, see the search http://www.codeproject.com/info/search.asp?cats=3&cats=5&searchkw=ListView[^].
You could also try searching this forum for "ListView" by clicking "Search comments" directly above this message area. We've talked about custom drawing a ListView quite a bit, and I know that I personally have posted several snippets of code that show how to draw certain parts through the custom drawing routines that the native Common Controls use.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Sorry - stupid question most probably - is C# platform independant like C++ or is it Microsoft based (like VC++)?
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
The language itself has been submitted for ECMA, the language specification is available here: C# Language Specification[^]. You can actually download (from Microsoft) the Shared Source CLI which is the ECMA CLI and C# language specification here: Shared Source Common Language Infrastructure 1.0 Release[^]. You will find specific namespaces such as System.Windows.Forms that have been written to wrap specific Windows functionality that is meant to target Windows, controls specifically for that namespace. There is also a port that will run under Linux called Mono which can be found here[^], this is targetting the ECMA standard.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Can we Serialize an enter Form?
|
|
|
|
|
And what do you mean by an "enter Form". It's rather ambiquous, and serialization doesn't really care what kind of object you're serializing so long as its attributed directly with SerializableAttribute . That attribute is not inheritted. Since the Form class is not attributed with SerializableAttribute , then you need to attribute your derivative class.
But ask yourself why you need to serialize it and what, specifically, you need to serialize. Much of the form is specific to that instance and should not be serialized (like the Handle ) if you plan on either re-creating it or saving it across multiple sessions (a session being separate logins, processes, etc.).
To control how your form (or any object) is serialized, implement ISerializable .
For more information on serialization, read Serializing Objects[^] in the .NET Framework SDK online. The SDK is also installed by default with VS.NET and can be installed stand-alone from http://msdn.microsoft.com/netframework[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi everybody I have a problem with DataGrid Control, That is:
I try to extract the column number and the row number by double click anywhere on the Datagrid
But there is no response by DoubleClick event when I try to DoublClick any Cell in the DataGrid ,the response occurs when I just click the Header Column or Header Row please can I get some help.
|
|
|
|
|
1.Firstly, DoubleClick event should fire, without any doubt. I do not find any problem in it.
2.Click or DoubleClick Event Handler of the DataGrid or other Controls has EventArg argument, you would not be getting the colum number / row number information from the EventArg . You should use either
MouseDown or MouseUp event Handler which has MouseEventArgs in the arguments.
MouseDown Event and HitTest method will get you the desired.
Refer the below link for details.
DataGrid HitTest Method[^]
|
|
|
|
|
sir,
i need to get system informations such as number of services,etc.i write queries such as select * from Win 32_service etc.But i don't know more about this table.I want to use some where clause also in the above query.for eg: i want to get all services whose mode is manual.I need column names for Win32_service
help mee
|
|
|
|
|
|
thank you very much,Mr.Nick Parker.You gave me the correct link
|
|
|
|
|
|
Hi,
I am writing a forms based application, which has been working fine, until I moved my project to another computer with the same version of Visual studio. Now my initial form does not show up at all.
This is what I have done:
I have a console application that starts three forms, one after the other. Each form implements two methods invloved in starting the form in its own separate thread.
class UIForm : ....
{
Thread formThread = null;
public void OpenForm()
{
// formThread is a private member of the current form
formThread = new Thread( new ThreadStart( this.ShowForm ) );
formThread.Start();
}
private void ShowForm()
{
Application.Run( this );
}
.
.
.
}
The console application then starts the form like this:
UIForm theForm = new UIForm();
theForm.OpenForm();
This worked fine until I moved my project to another machine.
Any help, comments or advise is much appreciated!!
Thanks!
|
|
|
|
|
Given my limited understanding of all things .Net, take what I say with a grain of salt.
The thread that creates the window must be the one that updates the window. The thread that creates the window must also participate in a message loop. Although you may get away with violating these rules some of the time, it is guarenteed to bite you in the butt sometime in the future.
Unless you are doing something really special, I would have one thread handle all of the UI and have the other threads doing non-UI stuff. Use Form.Invoke() to handle communication between the threads.
|
|
|
|
|
I agree to what you say, but I don't see how I violate any of the rules in the startup phase. The form is started in its own thread, which should then be bound to the message loop. Or have I misunderstood things?
|
|
|
|
|
You created the window using one thread then executed another to make it visible. This violates the first principle I stated above.
Try creating the window with the new thread.
|
|
|
|
|
Thank you very much! I discovered your solution by trial and error, but I did not understand why. Now I now that there is something behind it. Again, thank you.
|
|
|
|
|
Hello, i'm having a problem getting an byte[] out of an arraylist...
I use an enumerator so the code is as followed:
bIpAdres = Convert.ToByte(ipsEnum.Current);
bIpAdres however is a byte[], and the values in the collection are also arrays, but writing
Convert.ToByte[]
doesn't work.
How should I do this?
Grtz, Bert
|
|
|
|
|
While the answer is in the documentation, the name should say enough: Convert.ToByte converts an argument to a single byte . Notice how it's singular?
If ipsEnum.Current represents a byte[] array, then simply cast it:
bIpAdres = (byte[])ipsEnum.Current;
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
So if I understand you correctly you have an ArrayList that contains a byte[] as elements. If so and you are confident that the ArrayList does in fact contain the values then the following will work.
foreach(byte[] arr in arrList)
{
//Do something
};
Alternatively,
foreach(object obj in arrList)
{
byte[] arr = (byte[])obj;
};
|
|
|
|
|
I've got a (managed)directX function i'm trying to call that takes a stream to an bitmap/image file or object, but i'd like to have the image file handled directly, rather than using a stream to a file.
But i'm wondering whether serialisation is the right way to go. Will this remove the image formatting? Is there a way to cast a Bitmap or Image into a byte[] structure?
I really should know this, but all this matrix maths and texture alignment has melted my brain
Cheers
Cata
|
|
|
|
|
Save the Bitmap to a MemoryStream , then call MemoryStream.ToArray to get a byte[] array.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|