Sign in to follow this  
namingway

Couple of Questions

Recommended Posts

1.With C# how can I make it so user cannot type text in combo boxes and restrict them to only select from its drop down list? 2.Is there a better or (more proper) way of copying or list or array in C# other than array1 = array2 (naturally they have the same data type. 3. This is more of an opinion I am after for developing a 3d map editor(tile based) in C#. I am looking at 3 options MDX, OpenGL and XNA. I'd rather not use directX if I can avoid it and I know OpenGL but I'm wondering about the capabilities of OpenGL in C#, is it restricted at all? Lastly I've heard quite a bit about XNA but I'm not fully aware of its capabilities in comparison to directX and OpenGL. Any and all opinions would be useful :D:D

Share this post


Link to post
Share on other sites
1)Not quite sure what you mean here, you can disable a text box so that a user cannot type anything into it (have it greyed out). But then if you have a dropdownlist next too it, whats the point of the textbox?

2) The CopyTo function

http://en.csharp-online.net/Copy_one_array_into_a_second_array_with_CopyTo

coming from a C++ background, using the equals operator can be ambigious and would usually mean assigning one pointer to another.

3) I'm not sure muttering OpenGL and XNA in the same sentence is quite correct. XNA is a set of development tools for games, whilst OpenGL is specifically a API for graphics rendering.

The capabilities of OpenGL are comparible to DirectX, however using one over the other does impose certain design restrictions on your code. They operate "slightly" differently and its important to pick an API that you are most comfortable with and fits in with your plans for your software, such as whether you want to export the code onto another platform, like an xbox for example.

Using XNA is supposedly meant to help with cross-compatibility between platforms like the PC and the XBOX. haven't used it so I cannot comment anymore.

Share this post


Link to post
Share on other sites
1. Set the property DropDownstyle to DropDownList.

2. moosedude covered this.

3. IIRC MDX is no longer developed(?). OpenGL should be fine in C#, shaders etc. are all available. I haven't used XNA but it seems likes its a framework over DirectX that lets you run your code on Windows/360.

Share this post


Link to post
Share on other sites
OK,

1) In the visual designer set the DropDownstyle of the ComboBox to DropDownList - this way it does not accept user input in the manner you described and will only let the user select an option from the items list.

2) I agree with moosedude, CopyTo is a better way of copying an array. However, if you are talking about copying an array / collection into a Control such as a ComboBox or ListBox I would be inclined to use the AddRange() method like so:


// Create a new List of objects
List<object> myList = new List<object>();

// Set the combo box Items collection to contain the new list
comboBox1.Items.AddRange(myList.ToArray());



Make sure the Items collection is empty before doing this (use Clear).

3) XNA is a game development framework - I think it would be worth your while taking a more indepth look at it (Start Here). I don't know anything about OpenGL or DirectX so could not comment - however, I do beleave Microsoft have dropped Managed Direct X now (can someone verify this?).

Cheers,

James

Share this post


Link to post
Share on other sites
Quote:
Original post by ZeroSum
...

3. IIRC MDX is no longer developed(?). OpenGL should be fine in C#, shaders etc. are all available. I haven't used XNA but it seems likes its a framework over DirectX that lets you run your code on Windows/360.


MDX is indeed dead, yours truly's melancholy notwithstanding [smile]

XNA is a 'wrapper' that covers both DirectX for Windows and various APIs of the XBox 360. The big advance is that your code (mostly) works on both the 360 and Windows without any changes. It's a nice platform and I haven't run into any serious limitations compared to MDX, though there certainly are enough things done differently to wrap your head around. I had plenty of misgivings at first when they dropped MDX for it, but for me the solid FBX importer alone makes up for most of those hard feelings.

(What is FBX?)

Share this post


Link to post
Share on other sites
thanks for the replies, I probably should have specified but i meant the graphical side of XNA and yes I was aware of MDX being dead but didn't want to rule it out just in case it was still a viable option, but at the moment it looks like I'll stick with something I know. OpenGL.

Share this post


Link to post
Share on other sites
In my experience, the XNA graphical stuff is just a very thin wrapper around native D3D9. You work the same interfaces, use the same functions, etc. I started working with XNA with a good knowledge of the native API, and had no trouble at all using XNA.

For managed languages there's also SlimDX, which is just a wrapper around D3D9 and D3D10. It's a good replacement for MDX.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this