|
Why are you calling Invalidate in the Paint event?? All you're doing is constantly telling the control to repaint itself from inside the Painting code of the control! You don't see a problem with this?
|
|
|
|
|
Hi Jase,
I agree with what Dave said; Invalidate does not belong in the Paint handler, the Paint handler should paint, and do nothing else; and elsewhere Invalidate/Refresh/Update should be called when something has changed in such a way that a repaint is necessary. If you want a sequence of frames, don't organize it in such a way that Paint calls Invalidate to call Paint again, instead use an explicit sequencing mechanism such as a periodic timer.
For best performance, you should keep your Paint handler code minimal:
- no blocking calls (e.g. no delays, no database access!);
- at best: no creation of objects (keep the Pens, Fonts, Brushes you need in class members, create them once and reuse them)
- if you must create an object, make sure you either keep it around for reuse OR dispose of it properly (calling Dispose for those classes that offer it).
|
|
|
|
|
Luc,
I noticed this anomaly with the doublebuffered control:
1. I use a different namespace from your animation, say PanelForm (or class):
and when I try to add controls on my form with the panel, in the Windows Form Designer,
it will add the following extra syntax in bold:
(in bold)
this.panel1 = new PanelForm.PanelForm.DoubleBufferedPanel();
and during a compile I get an error so the following is correct:
this.panel1 = new Menu.DoubleBufferedPanel(); (Removing the extra PanelForm. fixes the problem)
How come everytime I resize the panel or add something on the same form, it adds the Panel. extra in between PanelForm.Double Buffered -> PanelForm.PanelForm.DoubleBuffered in Windows Form Designer?
I can easily delete it everytime but after say 10 times it becomes frustrating.
2.I understand how you are saying do not use Invalidate in the Paint Event handler,
eventually when we put a car image on the form and use Vectors to move it, Invalidate will need to be done else the car will not move by itself ? or should I use a timer to achieve the same result !
I am just wanting to know, having GDI+ Graphics like Drawstring, DrawRectangle coupled with textboxes and labels is bad form ? and bad design ?
I can send some code over if you cannot understand what I am trying to achieve ? Would that be better?
I am a novice c# programmer, Object Orientation is new to me, so I am still learning the fundamentals after so much time on procedural old style programming !
Thanks also Dave for your feedback !
Regards,
Jase
|
|
|
|
|
hi Jase,
1.
you probably created a mess with classes inside other classes. In my example, I had public class DoubleBufferedPanel : Panel {...} directly in its namespace, and that is what I recommend.
2.
Stop using confusing names, a namespace should not be called PanelForm as it is NOT a form.
3.
AU Jase wrote: or should I use a timer to achieve the same result !
I already answered that one twice.
4.
AU Jase wrote: Graphics ... coupled with textboxes and labels is bad form ?
Not necessarily, however you could make another mess of it; and it may harm performance and cause flicker.
5.
IMO you need to study the basics first, walk before you run. Why don't you spend a day or two on an introductory book to C# and Windows programming? (And no, I don't have a recommendation at hand).
|
|
|
|
|
Hi i have a Already existed excel file in my root path of the application,
In tht i have to clear particular cells range like A2 to F75.
And i have insert my new datas into those cells,after tht its has to getting save on enduser side,
Please guide me,any one having idea baout this
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
|
This is a good starting point: http://csharp.net-informations.com/excel/csharp-open-excel.htm[^]
The UsedRange property of Microsoft.Office.Interop.Excel.Worksheet gives the cells that have values. The Microsoft.Office.Interop.Excel.Range type represents ranges of cells. The Cells property of Range is a two-dimensional array that lets you access individual cells. The Value2 property of a Range representing a single cell gives you the value of that cell.
|
|
|
|
|
Hi
I'm trying to set envronment variables programatically using below code. But its failed to set the environment variables.
System.Environment.SetEnvironmentVariable("PATH", "C:\Dev");
Thanks in advance
|
|
|
|
|
Do you see any error messages?
//daniel
|
|
|
|
|
No, its not giving any error messages
|
|
|
|
|
So, how do you know its failing? Do you attempt to read it once set or?
//daniel
|
|
|
|
|
yes, I've seen system environment variables in my computer properties. those were not set
|
|
|
|
|
One thing I see wrong is your specification of the directory. Try:
System.Environment.SetEnvironmentVariable("PATH", @"C:\Dev");
/ravi
|
|
|
|
|
Even though its not working
|
|
|
|
|
Per the documentation:
"Creates, modifies, or deletes an environment variable stored in the current process." (Emphasis mine)
If you expect the settings to remain in place after the program completes, you'll be disappointed.
|
|
|
|
|
Following on PIEBALDconsult's reply, specify EnvironmentVariableTarget.User as the target if you want the environment variable to be set after your process ends.
/ravi
|
|
|
|
|
hey I have to make a major project in c# .net. It should not be any management project.
Please can anyone suggest me some.
|
|
|
|
|
Some form of game is a good idea, for it shows you understand GUIs, General Programming, Threads and Timers.
It can be expanded upon to give online high score tsbles etc.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Time and again some guys ask for code for their homework. Sometimes quite interesting projects.
One of them was an application for sharing photos with his friends/family, with users being able to add comments etc. I think that something which can be used by your friends/family is a really good project, because that will teach you the most important point in software development: dealing with users, how to turn their requirements into functionality.
|
|
|
|
|
Come on man! Do you not have any ambition or interest in IT? Do something relevant to you and what interests you. If you have no interest try a career switch.
Regards,
Rob Philpott.
|
|
|
|
|
Final year project planning comes around so quickly doesn't it? The usual approach is to wait until April or May and then post a query starting Urgntz!
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
I've to submit the project by December.
I am new to .net. I've to submit the project in my college.I'l make the projec by myself, just want to know some ideas.
thank you.
|
|
|
|
|
Nagy Vilmos wrote: and then post a query starting Urgntz!
and gimme codes. send codes to my email: stupidfool@gmail.com
|
|
|
|
|
Hello!! Somebody help me
I m new in c#, I want to do practical like this
First I create two textbox and then one checkbox. I want that if i check the checkbox whatever I have to write in one textbox that display same text in other textbox and dispay readonly
Like temporary and permanent address same field in most of fill application form. please send me code
|
|
|
|
|
My dear friend, I shall not flame you, for you are new.
This is exactly the sort of thing you need to learn.
If we told you or gave you code you would have learnt nothing.
I suggest you use This[^] excellent research tool to find the answers you need.
There are many c# Tutorials available that can help an absolute beginner, and they will help you progress.
There is no other way you can advance, and certainly not by others doing it for you.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|