Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
R

ruzu

@ruzu
About
Posts
4
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Graphics causing high CPU load
    R ruzu

    Hello there, I'm having problems with displaying graphics - I use a timer to update a panel every few seconds, and CPU load increases linearly with run time of my little program. It looks like this: //Timer that triggers my paint panel: public: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) { panel1->Paint += gcnew System::Windows::Forms::PaintEventHandler( this, &Form1::panel1_Paint); panel1->Invalidate(); } //Paint panel public: System::Void panel1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) { e->Graphics->DrawImage(test, 1, 1); } There's probably something wrong with the way I call up panel1_Paint -- but it's the only way I could figure out from the Visual C++ help file.. Oh and it would be great if anybody knew how to call up panel1_Paint and have it not delete all things I previously painted on it. Thanks in advance.

    C / C++ / MFC

  • Newbie question - data storage
    R ruzu

    Yes, but I need non-static variables.. I've solved the problem anyway -- I initialized the variable twice, inside and outside of the function - so two instances of the variable, one with class scope and one with function scope were created. Yea, newbie mistake, so embarrassing :) Still, thanks a lot guys for the quick help.

    C / C++ / MFC

  • Newbie question - data storage
    R ruzu

    I have a plain Form class in which I have a function "timer1_Tick" which is executed on each tick event. In this function I use this line in order to call up a panel1_Paint function, which is also part of the Form class: [code] panel1->Paint += gcnew System::Windows::Forms::PaintEventHandler( this, &Form1::panel1_Paint );[/code] And that's it. I just need a place where to initialize data. Obviously I can't initialize the data inside my timer1_Tick or inside the panel1_Paint function because it'd be initialized again and again. I tried initializing some values in the constructor Form1(): [code] int a; Bitmap^ bitmap; Form1() { InitializeComponent(); int a = 20; Bitmap^ bitmap = gcnew Bitmap("test.gif"); } [/code] But when I try to use them in my panel1_Paint function further down I see that they, while they have been initialized, they have not been assigned values yet. This is a variable scope problem I guess.

    C / C++ / MFC

  • Newbie question - data storage
    R ruzu

    Hi folks, I'm creating a simple Visual C++ program which is supposed to display an animation: A timer event calls a panel_Paint() which writes the graphics on screen. My problem is that I cannot store data anywhere that will tell the panel_Paint() function at which frame of the animation it is so it knows which file to display - if I initialize a variable inside the function, it will be re-initialized next time it is called, and if I try to initialize a variable outside the function, I am told that I can only initialize static variables there. I'm new to Visual C++ and this kind of event-driven programming, maybe somebody can tell me where I can store data for my functions to use. Thanks in advance. -- modified at 20:59 Friday 20th January, 2006

    C / C++ / MFC
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups