|
Have you checked out the DirectX tutorials that come with the managed DirectX SDK?
Logifusion[^]
If not entertaining, write your Congressman.
|
|
|
|
|
I am doing a desktop application in C#. I want to change the appearance of the windows in the porject. It want to avoid the common windows appearance. I want to get a MAC like apperance. Can anyone please tell me an idea for achieving this in C#.
Thanks
Regards
Hari
|
|
|
|
|
Your absolute best bet would be to use Avalon/WPF/.NET 3.0, a new framework ( still in beta ) that gives you a lot of control over how the UI looks.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thanks for the reply
But from where i can get that framework?
|
|
|
|
|
Hi..
I get 5 int values
For instance, they will look like the below...
int a = 2006; //year
int b = 3; //month
int c = 5; //day
int d = 1; //hour
int e = 3; //min
int f = 2; //second
but I want to put them in DB looks like "20060305010302" which means..
year has to be 4 digit, month has to be 2digit, day has to be 2digit..and so on...
so if I get the month data number 5, then I have to be able to convert number to 05 (because the DB column character is set for "yyyy:MM:dd:HH:mm:ss".
can I do this in one shot?? I can't think of anything good...
what i'm thinking is that comparing the length and if the length is shorter than 2 then, put the "0" in front of the number.... -_-...
please help... thanks
|
|
|
|
|
You can create a DateTime object and then use a Custom DateTime Format String.
For Example, this generates the output you want:
DateTime d = new DateTime (2006,3,5,1,3,2);
d.ToString ("yyyyMMddhhmmss");
MSDN Custom DateTime Format Strings
Hope this Helps,
Chris
|
|
|
|
|
Slight correction to the format string; "hh" gives hours in the range 1-12, use "HH" to get hours in the range 0-23:
DateTime d = new DateTime (2006,3,5,1,3,2);<br />
d.ToString("yyyyMMddHHmmss");
---
b { font-weight: normal; }
|
|
|
|
|
I need to distinguish Ctrl and Ctrl+arrow key commands in my app. Using ProcessCmdMsg rather than OnKeyDown handler allows me to register arrow keys, but when user strikes and holds Ctrl key, there are lot of messages with key code equal to this Control key, bud I'm not able to detect both Ctrl as modifier key and arrow key at the same time.
|
|
|
|
|
You can please try the below:
private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if ( e.Control && e.KeyCode == Keys.Up )
{
this.Text = "Control key + Up Key pressed";
}
else
{
this.Text = "Other Key pressed";
}
}
|
|
|
|
|
how to do like it was in C++
int fun() {
static int i = 0;
i++;
}
in general - i want a static varible in method - not static for all class but static only for one method..
Ideal compilator compiling comments without code...
|
|
|
|
|
There are no static local variables in C#.
Declare it in the class. It's stored exaclty the same as a static local is in C++. The only thing that differs is the scope.
---
b { font-weight: normal; }
|
|
|
|
|
If you write a variable in a method and does not make it global it will be static only for that function not for all classes.
|
|
|
|
|
I'm not getting an exception when my code runs thru this method, but it's also not writing out this record. Any suggestion?
<br />
private void WriteRecord(byte[] ByteBuffer, int TrackNumber)<br />
{<br />
SqlConnection myConnection = new SqlConnection(strConnect);<br />
SqlDataReader myReader = null;<br />
SqlTransaction transaction = myConnection.BeginTransaction();<br />
try<br />
{<br />
myConnection.Open();<br />
SqlCommand myCommand = new SqlCommand("SELECT * FROM DMV2 WHERE DMV2_TRACK_NO = " + TrackNumber + " AND DMV2_RCD_TYPE = 'Q'", myConnection);<br />
myCommand.Connection = myConnection;<br />
myReader = myCommand.ExecuteReader();<br />
myReader.Read();<br />
<br />
<br />
String DMV2_T_KEY = myReader["DMV2_T_KEY"].ToString();<br />
String DMV2_UNIT_NO = myReader["DMV2_UNIT_NO"].ToString();<br />
String DMV2_QUERY_TYPE = myReader["DMV2_QUERY_TYPE"].ToString();<br />
String DMV2_TRACK_NO = myReader["DMV2_TRACK_NO"].ToString();<br />
String DMV2_ORG_DTTM = myReader["DMV2_ORG_DTTM"].ToString();<br />
String DMV2_ORG_WORKSTATION = myReader["DMV2_ORG_WORKSTATION"].ToString();<br />
String DMV2_ORG_ID = myReader["DMV2_ORG_ID"].ToString();<br />
String DMV2_RCV_WORKSTATION = myReader["DMV2_RCV_WORKSTATION"].ToString();<br />
<br />
String myText = "INSERT INTO DMV2" +<br />
"(DMV2_RCD_TYPE, DMV2_QUERY_TYPE, DMV2_TRACK_NO, DMV2_T_KEY, DMV2_UNIT_NO, " +<br />
"DMV2_ORG_DTTM, DMV2_ORG_WORKSTATION, DMV2_ORG_ID, DMV2_RCV_DTTM, DMV2_RCV_WORKSTATION, " +<br />
"DMV2_RCV_STATUS, DMV2_DATA_TEXT)" +<br />
"VALUES ('R', '" + DMV2_QUERY_TYPE + "', '" + DMV2_TRACK_NO + "', '" + DMV2_T_KEY + "', '" + DMV2_UNIT_NO + <br />
"', '" + DMV2_ORG_DTTM + "', '" + DMV2_ORG_WORKSTATION + "', '" + DMV2_ORG_ID +<br />
"', CURRENT_TIMESTAMP, '" + DMV2_RCV_WORKSTATION + "', 'P','" + ByteBuffer.ToString() + "')";<br />
myCommand = new SqlCommand(myText, myConnection, transaction).ExecuteNonQuery();<br />
transaction.Commit();<br />
}<br />
catch(SqlException sqlError)<br />
{<br />
MessageBox.Show(sqlError.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);<br />
transaction.Rollback();<br />
}<br />
<br />
myConnection.Close();<br />
}<br />
<br />
<br />
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
You should switch to stored procedures if possible. One thing I see is this 'ByteBuffer.ToString()', this is going to return System.Byte[] -- thats all I see from here, the problem is probably a datatype. Copy the myText to your clipboard during an execution and try to run that query exactly as it was copied into SQL Query Analyzer, or use SQL Profiler to see whats happening.
Empires
|
|
|
|
|
Yeah I'm seeing System.Byte[]. Thanks for the heads up on that. However, if I put a messagebox(I can't step thru it on my pc so I have to use message boxes to see where I am at in the code) before the string is put together, but after the select statement is run, nothing pop's up. It's like it just dropping out of the method with out returning an exception. It's strange.
Would an SP work faster since it's server side? Or does it just make it easier to insert rows?
One other thing. Is looks like the primary key is a seeded key. Would this be something that could be causing the problem?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote: Would an SP work faster since it's server side? Or does it just make it easier to insert rows?
Or even make your application more secure - which is the primary reason I use stored procedures.
|
|
|
|
|
|
Colin Angus Mackay wrote: I don't see how this even compiles as TrackNumber is an int.
C# will work this out for you, if you concatenate a string and an int.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: C# will work this out for you, if you concatenate a string and an int.
I just tried it. So it does.
|
|
|
|
|
Learn something new everyday.
By the way I haven't read that link yet, but I did move all of the SQL statements to a SP. It works much better and seems like less of a headache. I should have done that a long time ago. I think I will still change how I'm passing my parameters to the SP as I'm still concatenating them together and do an ExecuteNonQuery. I think I'll look in to the parameters way of passing them, as well as read the link you sent me.
Thanks
Tom Wright
tawright915@gmail.com
|
|
|
|
|
What is a best approach for compressing directories structure witch contains multipile files into single zip file using c#.
|
|
|
|
|
|
i was wondering if it was possible to make a c# user control and imbed/anchor it into a vb6 form. what im trying to do is transition an application to c# 2.0 (three tier appplication with composite application block as teh front end). I would like to use c# user controls (these can be reused in the CAB) and wrapp it with a com/interop wrapper and use that same control in vb6, but im not sure how to approach it. any ideas?
|
|
|
|
|
Hi,
I use the new version of the ListView (.net framework 2.0). I decided to make it virtual (due to the large amount of items) and set the ownerdraw property to true (to have the full control of the items drawing).
The items (and sub items) are correctly displayed as long as i do not move the mouse over the subitems. Since i start to move the mouse over the subitems, the content (a string) disapears. It is like the Invalidate was not correctly done internally by the control. I put a break point in the function that draws the subitems and i never get into it (protected override void OnDrawSubItem) when i move the mouse over.
Here are the functions used to accomplish the work:
protected override void OnDrawColumnHeader(DrawListViewColumnHeaderEventArgs e)
protected override void OnDrawItem(DrawListViewItemEventArgs e)
protected override void OnDrawSubItem(DrawListViewSubItemEventArgs e)
protected override void OnRetrieveVirtualItem(RetrieveVirtualItemEventArgs e)
In my constructor i set the following properties;
SetStyle(ControlStyles.DoubleBuffer, true);
this.OwnerDraw = true;
this.VirtualMode = true;
this.DoubleBuffered = true;
I suspect a bug in the CLR. I would really appreciate if someone could light my candle on that issue.
Thank you!
Regards,
Fred.
- Frédéric dB -
|
|
|
|
|
A dirty (but reliable) solution would be to handle the OnMouseMove event and invalidate the listitems.
As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it
|
|
|
|