|
The Office 2003 scheme? Every Office has introduced a new scheme which has pretty much set the standard for products until the next Office is released. With a release schedule 5 years away (at least), basing your product on Office is probably not a good idea. Just go with the typical flat style which is still the basic scheme of the newer variants.
Another option is to use a third-party library that keeps up-to-date with the Office scheme. Even before the new Office comes out, the company should update their UI and release new assemblies, which - if they are backward compatible - you could simply add a publisher policy to the GAC or using binding redirection in your app's .config file to use the new versions even without recompiling (if it's already deployed, for example, and isn't ready for a rebuild). That'd probably be your best option, unless you want to maintain your own UI toolkit in a similar fashion. Just make it as abstract as possible, perhaps even supporting whatever theme a user wants.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
5 years down the road we may very well be using Avalon instead of System.Windows.Forms. That would pretty much throw away all your UI work.
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
Longhorn and Avalon[^] is the way MS are going. However they still haven't released any information about the actual look and feel of the new presentation layer.
It might be worth looking into using something like MyXaml[^] as this will help keep your presentation layer seperate from the rest of your application logic. Allowing you to change the UI without having to recompile your application code.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
If i have a xmldocument like this:
<?xml version="1.0" standalone="yes"?>
<sessions version="1.0">
<session name="Development">
<parameters>
<developmentsession>true</developmentsession>
<rootdirectory>n:\realsoftware</rootdirectory>
<debuglevel>1</debuglevel>
</parameters>
</session>
<session name="AppserverDevelopment">
<parameters>
<developmentsession>true</developmentsession>
<rootdirectory>f:\pro.net\realsoftware</rootdirectory>
<debuglevel>1</debuglevel>
</parameters>
</session>
</sessions>
And if i do this in the code section:
private void cboSessions_SelectedIndexChanged_1(object sender, System.EventArgs e)
{
ds.Clear();
string pad = "//session[@name='" + cboSessions.SelectedItem.ToString() + "']";
XmlDocument xml = new XmlDocument();
xml.Load(@"c:\kopie van sessions.conf.xml")
XmlNodeList contactNodes = xml.SelectNodes(pad);
string box = contactNodes.Item(0).OuterXml;
xml.LoadXml(box);
XmlTextWriter xmltw = new XmlTextWriter(@"c:\testnodes.xml",new UTF8Encoding(false));
xml.WriteTo(xmltw);
xmltw.Close();
ds.ReadXml(@"c:\testnodes.xml");
this.chkDevelopment.DataBindings.Add("Checked", ds.Tables["parameters"].DefaultView, "developmentsession");
}
Now i have a form with the combobox and the check and textboxes. If i do it with this code, he shows it correctly but when i click my combobox again he says there is a mistake:
An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll
Additional information: This would cause two bindings in the collection to bind to the same property.
What can i do about this? I want to be able to switch between the sessions and make changes to them.
thx in advance
|
|
|
|
|
Be sure to remove any existing binding on the Checked before adding a new one.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi C# gurus,
I have a casting problem in the following set of classes:
<br />
class Polymino<br />
{<br />
...<br />
}<br />
<br />
class Tetramino : Polymino<br />
{<br />
...<br />
}<br />
<br />
class ITetramino : Tetramino<br />
{<br />
...<br />
}<br />
<br />
class GameBoard<br />
{<br />
...<br />
private Polymino m_polymino;<br />
...<br />
<br />
public Polymino polymino<br />
{<br />
get { return m_polymino; }<br />
set { m_polymino=value; }<br />
}<br />
...<br />
}<br />
<br />
class Tetrion : UserControl<br />
{<br />
...<br />
private GameBoard m_gameBoard;<br />
...<br />
private Tetramino m_currentTetramino;<br />
...<br />
<br />
public void Start()<br />
{<br />
m_currentTetramino=GetRandomTetramino();<br />
m_gameBoard.polymino=m_currentTetramino;<br />
}<br />
...<br />
<br />
private Tetramino GetRandomTetramino() ...<br />
}<br />
Polymino is the base class of all.
In the Tetrion.Start method, when I call m_gameBoard.polymino=m_currentTetramino , I have an error in the m_gameBoard.polymino property call. I guess it's a casting problem. In C++ this kind of thinking is okay, but it seems that it does not work in C#, even if I do a cast like that: m_gameBoard.polymino=(Polymino) m_currentTetramino .
Can anybody help me and tell me why the debugger stops at this call?
Best regards.
Thanks.
There is no spoon.
|
|
|
|
|
What is the exact exception you are receiving, including the Type and message (if any)?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath,
I have no exception... The call stack is full of "Tetour.exe!Tetour.GameBoard.set_polymino(Tetour.Polymino value = {Tetour.STetramino}) Line 49 + 0xa bytes"
STetramino is derived from Tetramino which is derived from Polymino. as STetramino is a specialized class based on Polymino class, the casting should work... like for C++...
There is no spoon.
|
|
|
|
|
Yes it should, just like the ArrayList which collects objects can take an instance of any class no matter far down the derivation tree it is.
Are these simple classes or controls (or possibly modify control properties directly)? If so, are you using multiple threads? Odd problems can occur when getting and most often setting properties on controls from another thread besides the main UI thread.
What causes the break into the debugger if you're not seeing an exception? Are you just stepping through lines or does it break while executing?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
it breaks while executing.
All the classes I show you are simple classes. the only classes derived from a UserControl are the Tetrion and TetraminoPreview classes.
The complete code of Tetrion.Start() method looks like this:
<br />
public void Start()<br />
{<br />
Debug.WriteLine("Tetrion.Start");<br />
m_gameStatus=GameStatus.gameStarted;<br />
m_gameBoard.Initialize();<br />
<br />
m_currentTetramino=GetRandomTetramino();<br />
m_gameBoard.polymino=m_currentTetramino;<br />
m_nextTetramino=GetRandomTetramino();<br />
<br />
if (m_tetraminoView != null)<br />
{<br />
m_tetraminoView.tetramino=m_nextTetramino;<br />
m_tetraminoView.Display=m_bShowNextTetramino;<br />
m_tetraminoView.Draw3D=m_gameBoard.Draw3D;<br />
m_tetraminoView.DrawGrid=m_gameBoard.DrawGrid;<br />
}<br />
<br />
Invalidate();<br />
}<br />
<br />
The code stops its execution at the call m_gameBoard.polymino=m_currentTetramino;
while there are no break points.
There is no spoon.
|
|
|
|
|
you were right. the exception is:
"An unhandled exception of type 'System.StackOverflowException' occurred in Tetour.exe"
There is no spoon.
|
|
|
|
|
I suspect the exception is actually being thrown because of GetRandomTetramino() . In some cases, the break appears on the next line after the offending line because the exact problem is not addressable. A StackOverflowException would most likely be one of those exception cases. What does the implementation for GetRandomTetramino() look like?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
The GetRandomTetramino method selects a specialized tetramino. The code looks like this:
<br />
private Tetramino GetRandomTetramino()<br />
{<br />
Random rnd=new Random(DateTime.Now.Millisecond);<br />
Tetramino tetramino=null;<br />
<br />
TetraminoType[] tetraminoType=(TetraminoType[]) Enum.GetValues(typeof(TetraminoType));<br />
<br />
switch (tetraminoType[rnd.Next(tetraminoType.Length)])<br />
{<br />
case TetraminoType.iTetramino:<br />
tetramino=new ITetramino();<br />
break;<br />
<br />
case TetraminoType.jTetramino:<br />
tetramino=new JTetramino();<br />
break;<br />
<br />
case TetraminoType.lTetramino:<br />
tetramino=new LTetramino();<br />
break;<br />
<br />
case TetraminoType.oTetramino:<br />
tetramino=new OTetramino();<br />
break;<br />
<br />
case TetraminoType.sTetramino:<br />
tetramino=new STetramino();<br />
break;<br />
<br />
case TetraminoType.tTetramino:<br />
tetramino=new TTetramino();<br />
break;<br />
<br />
case TetraminoType.zTetramino:<br />
tetramino=new ZTetramino();<br />
break;<br />
<br />
default:<br />
tetramino=new ITetramino();<br />
break;<br />
}<br />
<br />
return tetramino;<br />
}<br />
<br />
the shapes are correctly coded because when I do a m_tetraminoPreview.tetramino=new ITetramino for example, it shows me the correct shape.
There is no spoon.
|
|
|
|
|
It's not a problem with casting, but with too many method calls on the stack (hence the StackOverflowException ). Somewhere, you either have an unterminated recursive loop or are too deep in method calls. Examine the stack trace, which should give you some insight into how many calls are on the stack and which one is the offending call.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
That's what I wanted to do, but the call stack is full of the same message:
"Tetour.exe!Tetour.GameBoard.set_polymino(Tetour.Polymino value = {Tetour.OTetramino}) Line 49 + 0xa bytes C#"
when I insert a breakpoint in the GameBoard.polymino set property, it always loop in this property, while I do only 1 call. I think it does not have to loop inside this call because I call this property only one time, and it's just an assignement.
There is no spoon.
|
|
|
|
|
I guess you did say "full of" in a previous thread. Sorry I missed it.
This is an odd problem indeed. Is the original code you posted for the polymino property (which, using the .NET naming guidelines, should actually be Polymino , but I won't get started on that since it's a different topic) correctly declare the same as it is in your code (i.e., is what you posted the exact same thing as what's in your code)?
That's obviously the offending line. Are you sure you're not typing polymino again instead of m_polymino ? This would definitely cause the recursion that's causing the stack overflow.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have found the problem it's in the GameBoard.polymino property.
I wrote:
<br />
public Polymino polymino<br />
{<br />
get { return m_polymino; }<br />
set { polymino=value; }
}<br />
while it was:
<br />
public Polymino polymino<br />
{<br />
get { return m_polymino; }<br />
set { m_polymino=value; }
}<br />
I forgot the "m_" so it made a recursive call to itself and then the stack overflowed. When you talk about "recursive" I checked the code of the property I wrote, and all came from this bad line. And now, the casting works the way I expected: like in C++. I correctly wrote the property in the topic, but not in the project
I hope the engine of this game will be finished soon :p
Thanks for the help Heath!
There is no spoon.
|
|
|
|
|
after binding my table to the datagrid what is an easy way to make a column readonly please
|
|
|
|
|
Set DataGrid.ReadOnly to true . It's important to look at the class documentation, at least for simple things like this.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
that will do the whole grid i only want a column?
|
|
|
|
|
Then explicitly define a DataGridTableStyle with DataGridColumnStyle derivatives matching up with your columns you want to display. For any columns you want to disable editing, set DataGridColumnStyle.ReadOnly to true . For more about tables styles, see the documentation for the DataGridTableStyle[^] class in the .NET Framework SDK. It also includes sample code.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
will this work after binding my grid to the table that i am create from the database ie DataTable tbl = LoadData();
MyDatagrid.DataSource = tbl;
|
|
|
|
|
Yes, and you don't need to re-initialize it. You can even add multiple table styles to handle multiple data sources. Again, read the documentation I provided a link for.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
on the case let you know how i get on many thanks
|
|
|
|