|
And what if you update the Opacity once every 10 calls to OnUpdate giving you 20 updates a second in stead of 200? I can imagine that trying to change the opacity of a control 200 times a second might be a bit much. And I don't think you would see much difference anyway. My screen doesn't refresh itself at 200Hz the last time I checked.
Mark
|
|
|
|
|
I understand that, but imagine that a game doesn't have only one Sprite, I could add for ex 10 Sprites. What do i do then? I really wan't to make this game engine visually(like Flash). I think that my problem is that I need to set priorities to the messages sent to the message queue, for example the
click\resize\move etc.. , I mean all the messages that are sent by windows to the Form to be processed
before the control messages. Do you have any ideea how I can do that in C#? something like override WndProc or make my own custom message queue??
|
|
|
|
|
I can't help you with setting priorities to messages. But I doubt you're going the right course with that anyway.
I think another solution would be to use timeSetEvent/timeKillEvent as mentioned by Luc and just use one for each control. But don't have it fire off periodically unless needed. So if you're sprite is idle, don't fire off any timers. If you're sprite is moving, have a timer tick at a reasonable interval until you're sprite is done moving. This way no unnecessary events will need to be processed.
I'm not sure how windows likes it if you have a massif amount of sprites with timers, but I guess you don't need to worry about that right now.
Another solution might be to have one timer (again with a reasonable interval), which basically is you refresh all event. On that event you can check the position and shape of all controls and redraw them in one go. This will probably generate quite some messages at that time, but probably a lot less compared to having a tick every 5ms.
|
|
|
|
|
Hi,
I have several comments:
1.
You can ask a timer to tick every 5 msec, that does not mean it will do that. Read my
timer article!
2.
If you use a Windows.Forms.Timer you will get ticks on the UI thread automatically,
saving half of the messages and avoiding the need for an explicit Invoke()
3.
PictureBox is not my favorite Control, it has limited functionality and unknown overhead.
4.
I guess your painting action is too expensive; I would suggest to optimise the paint
action, possibly by reducing the number of controls. In general the lightweight approach
gives the maximum performance, in its extreme form it means ypu use one Control (a Panel),
do all keyboard/mouse event dispatching yourself, and organize the paint event yourself,
carefully watching the invalidate region. IMO just adding lots of Controls is not the right
way to create a game.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi,
i have 3 seesons in my database ,Morning Evening, And Afternoon.they are checkboxin database means YES/NO...........I have a datagrid inthat i have a field like Session
In session column i want to retrieve data from database according to the data in DB.
if morning and evening is checked it shows like MORNING,EVENING
Please help me regarding this issue?
|
|
|
|
|
Have you figured this out yet? You may want to try using stored procedures to return MORNING,EVENING to the datagrid...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi,
how to storing instance of object in a class?
|
|
|
|
|
Create a class-level variable of the type of object you want to store.
If necessary, add property get/set accessors to your class to retrieve/update your object.
Paul
|
|
|
|
|
In Collection, Hashtable, ArrayList
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Hi,
In my DataGridView component there are two columns that have to be transparent when they are selected. Becouse these cells are CheckBox cells and their backgorund colors are important, I want that background color will be visible when they are selected.
The problem is while they are selected, if I minimize program to taskbar and maximize again, these cells background color remain same with the desktop. After changing selection they are repainted and become normal. Also at first run, the same problem occurs.
Do you have any solution or idea?
Thanks.
|
|
|
|
|
Hello,
I have created a DLL(C# CODE) with
signed key , com visibility is true and registered it with regasm but still when i try to use it in ASP page by calling server.createobject() i can not use.
I tried posted this on other section /net frame work, but there was no reply.
Hope this section provides some guidelines
Please suggest.
Pavas
Pavas
|
|
|
|
|
Did you got any error message ?
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
I restarted my system and i am able to create the object for it. I hope it will work now. Will surely update you once i am 100% sure or i get some error.
Many thanks for the reply
Pavas
|
|
|
|
|
Hi Guys and Gals.
I have never in my life before worked with Windows Services. I have an urgent project where I must create a Windows Service to Export data from a DB to another DB every 5 min. If anyone could give me guidance on this it will be greatly appreciated. I just dont know where to start or go about doing this.
Please help.
Regards,
Elizma
|
|
|
|
|
Hi Elizma,
I think first you need to make some test application in window services with timer. Two many article posted on web you can go through via google or you can find below link:
http://www.aspfree.com/c/a/C-Sharp/Timer-Objects-in-Windows-Services-with-C-sharp-dot-NET/
After that if you have any problem then you can discuss with us.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Thanks for the immediate valuable suggestions for all my posts....
I have a problem in databinding with datagridview.
mygridview.datasource=ds.Tables[0].DefaultView;
At this particular statement we get an error saying
" cross thread operation not valid; control mygridview accessed from a thread other than the thread it was created on."
Please suggest us...
Regards,
Priya
|
|
|
|
|
An article discussed the all problems. Go through below link:
http://www.codeproject.com/vb/net/AccessControlFromThread.asp
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
iet2000 wrote: mygridview.datasource=ds.Tables[0].DefaultView;
why don`t you use
mygridview.datasource= ds;
******************************
I just want to
know everything
|
|
|
|
|
Hi guys.
I am struggling in one point whether the values in an xml document can be converted in to a Generic List<t>. ie. when i will read an xml document, it will return a List<t>.I am converting the xml to a Generic List<t> because i have go through 3 tier architecture.
If possible please give me some Urls(sites) where i can get some idea.
smishra
|
|
|
|
|
Why do you need a list for 3 tier architecture? This is by no means a requirement of good n-tier design.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hello everyone,
With a C# made software, I create an Excel file with many sheets. Everything
goes well until I tried to remove PageBreaks.
I can add them but I can't delete them so I still have the automatic one
appearing there ...
I tried a lot of things such as:
Range AutoVPageBreaks=ExcelWorksheet1.VPagesBreaks[1].Location;<br />
AutoVPageBreaks.PageBreaks=XlPageBreaks.XlPageBreakNone;
or
VPageBreak VPB1= ExcelWorksheet1.VPagesBreaks[1];<br />
VPB1.Delete();
--> This one raised an error
I also tried to add before ResetPageBreaks() or DisplayPageBreaks=false but
nothing worked ... I still have the automatic pagebreaks ...
Does someone know howw to remove those pagebreaks? Do I need to set the
sheet to printpreview? If so, how? (I tried but that raised an error)
I hope you can help me.
Thank you.
|
|
|
|
|
My ListBox Contents are in the form
index. itemName
1. Jack
2. Jane
3. Joe
4. Bill
5. Tim
6. Sid
On removing say Jane I need to get the index of others in proper numerical order. Now ListBox Control only allows me access to the currently selectedItem via its selectedItem property but I need access to all the Items so that I can change them...
Any Advice...
Thanks
Please excuse if this is a very basic question. I'm pretty new to C#.
After Removal the above should become
1. Jack
2. Joe
3. Bill
4. tim
5. Sid
|
|
|
|
|
If you iterate through the Items collection, you get the zero based index of the item.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Yes I can do that as
IEnumerator enm = this.list.Items.GetEnumerator();
int i = 0;
//Get to The Desired Location
for(i = 0; i < index; i ++ )
{
enm.MoveNext();
}
//Here I can Get Individual Items
for(i = index; i < list.Items.Count; i ++)
{
String entry = enm.Current.ToString();
String newData = doSomething(entry);
// Now Here I Need to Set the Changed Data to ith Position in the List
// cannot Do enm.Current = newData as Current is a readonly Property of IEnumerator
}
Any More Advice...
|
|
|
|
|
I'm sorry, but I'm not sure what you are trying to achieve here. This has gone beyond the scope of your original query. Perhaps you could elaborate a bit.
Deja View - the feeling that you've seen this post before.
|
|
|
|