|
The DirectX team recently released DX9, which has support for writing games in C#. I haven't looked at it in detail, but my first impression is that it will make writing DX code easier, but not easy, if that makes sense. You'll still need to learn about DX concepts.
If you choose to write in C#, there are a few disadvantages:
1) You need the .net runtime installed on the target machine
2) It will be slower than a C++ version, because you will be calling from C# code into native code. I don't know how much this slowdown is.
The advantages are that writing C# code is a lot easier than writing C++ code for most people.
|
|
|
|
|
I have a ListView sitting on an MDI tab (from the Magic library, if that makes a difference). If I set the tab's Dock property to DockStyle.Fill (and do the same with the ListView), the ListView control gets partially clipped by the status bar. I don't mind handing Resize events to keep things organized and prevent the clipping, but I'm wondering if there isn't a better way. Can the controls be told to size themselves correctly without an programmer intervention?
|
|
|
|
|
I can only assume that it's something to do with Magic's TabControl implementation, as I have done similar things with the standard TabControl without problem.
One possible workaround would be to set the DockStyle of the ListView to None, size it to fill the TabPage in the designer, then set the Anchor property to all sides (Left, Right, Top, Bottom).
|
|
|
|
|
That seems to work. Thanks, Furty.
|
|
|
|
|
Okay, here's a simplified version of what I'm trying to do.
I have a RichTextBox in a form for editing a text file; I've written a simple Find/Replace dialog (whose parent is the textbox itself).
Currently, when you hit "Find", it has to close the dialog so that you can see the selected text (selected by the RichTextBox.Find function). You can then use F3 to find again. If a RichTextBox doesn't have focus then the selection isn't visible, so there's no benefit to keeping the dialog open.
But what I'd really like to do is keep the Find/Replace dialog open while someone does as many find and replaces as they want.
Any ideas out there?
Paul
And you run and you run to catch up with the sun, but it's sinking Racing around to come up behind you again The sun is the same in a relative way, but you're older Shorter of breath, one day closer to death - Pink Floyd, Time
|
|
|
|
|
Try passing a reference to your RichTextBox to the find form, and calling the RichTextBox.Find method from the actual find form. Make sure you use the Show() method to open your find form, rather then the ShowDialog() method.
|
|
|
|
|
Do any free .NET grid controls exist?
-Domenic Denicola- [CPUA 0x1337]
“I was born human. But this was an accident of fate—a condition merely of time and place. I believe it's something we have the power to change…”
|
|
|
|
|
So far ive only seen two, the one in the C# section of this site, and the other is one that i am working on, gone a bit on the back burner now, but i intend to put a little more effort into its production.
[Davide Icardi] http://www.codeproject.com/useritems/CSharpGridControl.asp[^]
[Mine] http://www.onyeyiri.co.uk/csharp/grid/[^]
[edit]
shouldnt of mentioned mine, no where near ready.
[/edit]
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
When you move a splitter with the mouse, a pointy black/grey background of the splitter is painted. This I would like to change.
I tried to use the Splitter_Moving event, but it doesn't work. Maybe my painting was overpainted from System.
Does anybody know how to change this or can give me a tip?
Thanks
Stefan
|
|
|
|
|
You can't that easily. The splitter window is drawn using an hardcoded private function :
private void DrawSplitHelper(int splitSize) {
Rectangle local0;
IntPtr local1;
IntPtr local2;
IntPtr local3;
IntPtr local4;
if (this.splitTarget == null)
return;
local0 = this.CalcSplitLine(splitSize, 3);
local1 = this.ParentInternal.Handle;
local2 = UnsafeNativeMethods.GetDCEx(local1, IntPtr.Zero, 1026);
local3 = ControlPaint.CreateHalftoneHBRUSH();
local4 = SafeNativeMethods.SelectObject(local2, local3);
SafeNativeMethods.PatBlt(local2, local0.X, local0.Y, local0.Width, local0.Height, 5898313);
SafeNativeMethods.SelectObject(local2, local4);
SafeNativeMethods.DeleteObject(local3);
UnsafeNativeMethods.ReleaseDC(local1, local2);
}
As you can see, the implementation never takes care of properties you may have set (like ForeColor, ...).
The only way to get around this is to write your own splitter window. But that requires significant work since all of the splitter methods are declared private, thus won't be inherited.
Using a decompiler however, that's not a complex task.
Good luck!
|
|
|
|
|
Thank you.
So it's possible but very difficult? So I can't derive from SplitterClass and than overwrite the DrawSplitHelper?
What do you mean with "write your own splitter window"? Do you mean to take the panel-class and than write the whole Splitter Functionality by my-self? That would be hard, wouldn't it?
It seams that you know really much about C#. Can you give me a tip or a direction how to solve this problem with the Splitter?
Thanks
Stefan
|
|
|
|
|
STW wrote:
So I can't derive from SplitterClass and than overwrite the DrawSplitHelper?
You can derive the class since it's not internal nor sealed but, since almost all methods are private, by inheriting the class you won't get them. (that's a basic inheritance rule).
STW wrote:
What do you mean with "write your own splitter window"?
I mean "write your own splitter window".
The splitter class is a System.Windows.Forms.control derived class, so basically you have to do exactly that, and implement all the stuff. Fortunately, the .NET splitter class is much simpler than the MFC Splitter Window (which acts as a container and provides a lot of implementation for scrollbars, etc.). Using your own implementation, almost the only thing you have to do is to provide OnMouseDown, OnMouseMove and OnMouseUp handlers, and call the native WIN32 SetCapture()/ReleaseCapture() whenever needed.
That said, although I haven't tried it, I would simply try to override Splitter.WndProc(ref Message m) and implement my own WM_PAINT handler. Just in case...
Good luck!
|
|
|
|
|
Hi again,
This code is for sorting the numbers which are given randomly in an array.
private void BubbleSort(int[] a) {
for ( int i = 0; i < a.Length - 1; i++ ) {
for ( int j = 0; j < a.Length - i - 1; j++ ) {
if ( a[j] > a[j + 1] ) {
int temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp; }
}
}
}
private void sort_Click(object sender, System.EventArgs e) {
const int count = 1000;
Random r = new Random();
int[] a = new int[count];
for ( int i = 0; i < count; i++ )
a[i] = r.Next(1000); //numbers 0 - 999
BubbleSort(a);
for ( int i = 0; i < count; i++ ) {
richTextBox1.AppendText( a[i].ToString() + " " );
}
}
}
I want to ask why we used the second for loop can't we do it with only one "for loop"?
And why we substracted i(int) in the second loop's condition?
Kind Regards,
-
kromozom@msn.com for MSN Messenger
-
|
|
|
|
|
Yes Pal,
It's very much possible. Just see the code snippet.
private void Swap(int arr[], int pos1, int pos2)<br />
{<br />
int tmp = arr[pos1];<br />
arr[pos1] = arr[pos2];<br />
arr[pos2] = tmp;<br />
}<br />
<br />
public void BubbleSort(int arr[])<br />
{<br />
int ctr = 0;<br />
while(ctr<arr.GetLength(0)-1)<br />
{<br />
if(arr[ctr1] > arr[ctr1+1])<br />
{<br />
Swap(arr, ctr, ctr+1);<br />
ctr=0;<br />
continue;<br />
}<br />
ctr++;<br />
}<br />
}
U could use a for loop too if u want.
Hope this helps!
regards
Atul Kale
MCSD, MCT
Sr. Software Engineer
XcelVision Technologies Ltd.
|
|
|
|
|
oh, thanks buddy.
This is another(better I think ) way to do a sorting.
However I couldn't understand the while loop there?while (ctr)? and thanks again
If you wish you can add me into your MSN contact list(if you are using it )
-
kromozom@msn.com for MSN Messenger
-
|
|
|
|
|
Hey, I'm sorry, that code was a Copy Paste mistake. Since it was HTML it didn't understand the code in less than and Greater than signs. It took it as an HTML tag! Here's the rectified one.
private void Swap(int arr[], int pos1, int pos2)<br />
{<br />
int tmp = arr[pos1];<br />
arr[pos1] = arr[pos2];<br />
arr[pos2] = tmp;<br />
}<br />
<br />
public void BubbleSort(int arr[])<br />
{<br />
int ctr = 0;<br />
while(ctr<arr.GetLength(0)-1)<br />
{<br />
if(arr[ctr1] > arr[ctr1+1])<br />
{<br />
Swap(arr, ctr, ctr+1);<br />
ctr=0;<br />
continue;<br />
}<br />
ctr++;<br />
}<br />
}
Atul Kale
MCSD, MCT
Sr. Software Engineer
XcelVision Technologies Ltd.
|
|
|
|
|
oh, allright sometimes Copy&Paste can cause problems . I understood the while loop here now. Thanks again for your help.
-
kromozom@msn.com for MSN Messenger
-
|
|
|
|
|
I have a string.I want to store it in my database as BINARY,and then get it from database and convert it to string.So how can I convert string to binary and convert binary to string?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
have tried it out.. ;P;) ~
|
|
|
|
|
System.Text.Encoding
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
Thanks.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Hi all:
I hav problems when I try to connect to a Exchange Server with MAPI. The situation is as follows:
I have Exchnage Server in one machine and the ASP.NET application that access it in another machine. In order to logon I use this:
oSession.Logon(strUser, strPassword, False, True, 0, True, strProfileInfo)
and it connects. But when I try to access to any resource in the exchange (the inbox, for example) the next error appears:
"The information store could not be opened. [MAPI 1.0 - [MAPI_E_LOGON_FAILED(80040111)]]"
I think this is because access restrictions or something like that. Anyone has an idea of what is happening?
What is the best way to work against Exchange with this architecture (Exchange Server in one machine and ASP.NET application in another?
Any help will be apreciated.
Cheers,
Ivan
|
|
|
|
|
Hi,
I have have a form that is a child control in a panel. I would like to prevent anyone from moving this form. I have already set the form so it's not resizable.
Is there any way to lock the form to prevent it being moved.
Thanks!!
Stefan
|
|
|
|
|
You could fire the LocationChanged event and place the form back to orginal location.
Point OriginalLocation;<br />
private void Form1_Load(object sender, System.EventArgs e) {<br />
OriginalLocation = new Point(this.Left,this.Top);<br />
}<br />
<br />
private void Form1_LocationChanged(object sender, System.EventArgs e) {<br />
this.Location = OriginalLocation;<br />
}<br />
|
|
|
|
|
i have already draw many rectangle inside a form how can i move the rectangular form one position to another after i have selected the rectangular to move.
|
|
|
|