Click here to Skip to main content
15,897,163 members
Home / Discussions / C#
   

C#

 
Questionwhy my ticks always the same, please help thanks very much. Pin
matthew_net25-Jun-08 5:25
matthew_net25-Jun-08 5:25 
AnswerRe: why my ticks always the same, please help thanks very much. Pin
Mohammad Dayyan25-Jun-08 5:36
Mohammad Dayyan25-Jun-08 5:36 
GeneralRe: why my ticks always the same, please help thanks very much. Pin
matthew_net25-Jun-08 5:49
matthew_net25-Jun-08 5:49 
GeneralRe: why my ticks always the same, please help thanks very much. Pin
Luc Pattyn25-Jun-08 6:48
sitebuilderLuc Pattyn25-Jun-08 6:48 
GeneralRe: why my ticks always the same, please help thanks very much. Pin
Dan Neely25-Jun-08 7:08
Dan Neely25-Jun-08 7:08 
AnswerRe: why my ticks always the same, please help thanks very much. Pin
Dan Neely25-Jun-08 5:45
Dan Neely25-Jun-08 5:45 
GeneralRe: why my ticks always the same, please help thanks very much. Pin
matthew_net25-Jun-08 6:02
matthew_net25-Jun-08 6:02 
QuestionGDI / FPS Question Pin
Harvey Saayman25-Jun-08 4:32
Harvey Saayman25-Jun-08 4:32 
hey guys...

please consider the following code...

private int fpsCounter = 0;
private string fpsString = "0";

public myControl()
{
    InitializeComponent();

    animationTimer.Start();  // 10ms multimediaTimer
    fpsTimer.Start();        // 1000ms multimediaTimer
}

private void clockPanel_Paint(object sender, PaintEventArgs e)
{
    fpsCounter++;
    drawData(e.Graphics, clockPanel.ClientRectangle);
    drawClock(e.Graphics, clockPanel.ClientRectangle); // drawString(fpsString) happens in here 
}

private void fpsTimer_Tick(object sender, EventArgs e)
{
    fpsString = fpsCounter.ToString();
    fpsCounter = 0;    
    clockPanel.Invalidate();
}

private void animationTimer_Tick(object sender, EventArgs e)
{
    calculateAndUpdateDrawingVariables();
    clockPanel.Invalidate();
}


Questions
1. Will this give me an accurate frames per second reading?
2. the reading i get is +/- 100(which makes sence cuz 1000 / 10 = 100), but when the animation timer is set to 1ms the fps value is +/- 500. Is this because the image cant be drawn/calculated that fast and the image wont repaint again until previous panel.Invalidate() has not been completed?
3. quite a bit happens in calculateAndUpdateDrawingVariables(); and it runs 100times per second(animationTimer = 10ms). Any tips on what to avoid in a method like this that runs so many times to use less CPU power?

thanx

Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL

you.suck = (you.passion != Programming)

AnswerRe: GDI / FPS Question Pin
leppie25-Jun-08 5:00
leppie25-Jun-08 5:00 
GeneralRe: GDI / FPS Question Pin
Dan Neely25-Jun-08 5:12
Dan Neely25-Jun-08 5:12 
GeneralRe: GDI / FPS Question Pin
Harvey Saayman25-Jun-08 5:14
Harvey Saayman25-Jun-08 5:14 
GeneralRe: GDI / FPS Question Pin
User 665825-Jun-08 5:25
User 665825-Jun-08 5:25 
GeneralRe: GDI / FPS Question Pin
Harvey Saayman25-Jun-08 7:41
Harvey Saayman25-Jun-08 7:41 
AnswerRe: GDI / FPS Question Pin
User 665825-Jun-08 5:19
User 665825-Jun-08 5:19 
GeneralRe: GDI / FPS Question Pin
Harvey Saayman25-Jun-08 7:48
Harvey Saayman25-Jun-08 7:48 
QuestionHow to count Startup Services and Processes using C# Pin
Neeraj Kr25-Jun-08 3:56
Neeraj Kr25-Jun-08 3:56 
AnswerRe: How to count Startup Services and Processes using C# Pin
Manas Bhardwaj25-Jun-08 5:11
professionalManas Bhardwaj25-Jun-08 5:11 
AnswerRe: How to count Startup Services and Processes using C# Pin
Neeraj Kr25-Jun-08 20:15
Neeraj Kr25-Jun-08 20:15 
GeneralRe: How to count Startup Services and Processes using C# Pin
Manas Bhardwaj25-Jun-08 22:40
professionalManas Bhardwaj25-Jun-08 22:40 
GeneralRe: How to count Startup Services and Processes using C# Pin
Neeraj Kr25-Jun-08 22:44
Neeraj Kr25-Jun-08 22:44 
AnswerRe: How to count Startup Services and Processes using C# Pin
Neeraj Kr25-Jun-08 22:40
Neeraj Kr25-Jun-08 22:40 
Question[Message Deleted] Pin
mabby21625-Jun-08 3:05
mabby21625-Jun-08 3:05 
AnswerRe: Write entries to a text file--Need Help!! Pin
Ashfield25-Jun-08 3:17
Ashfield25-Jun-08 3:17 
GeneralRe: Write entries to a text file--Need Help!! Pin
mabby21625-Jun-08 3:27
mabby21625-Jun-08 3:27 
GeneralRe: Write entries to a text file--Need Help!! Pin
leppie25-Jun-08 3:29
leppie25-Jun-08 3:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.