No to everything except; Yes, I'm painting everything in the paint handler, and the program's memory is steady around 41,000K. The application is just eye candy. It doesn't do anything special except look and act like an analog clock that sits on the desktop. When I said "the loop is still running" I was referring to the timer. The timer was still ticking and the Me.Invalidate() function was still being called, but nothing was happening. I've actually come up with a solution that seems to be working. Originally I was painting everything to the form. I inserted a picture box and am painting on that now. So now the paint handler has PicBox.Invalidate() instead of Me.Invalidate(). It's been running for about ten minutes without freezing up. Adding the picture box seems to be the answer to the problem, but I'm still curious why it was not working before. Is there something that Microsoft built into the operating system that keeps the form from painting itself too many times? Thanks for all your help Luc, Adam
Adam Loudermilk
Posts
-
Question about Invalidate() for VB.Net -
Question about Invalidate() for VB.NetThanks for responding so quick Luc. I would like to get this thing finished. I've been working on it entirely too long. So, I took the DoEvents() out and switched the order of operations like you had said. Still no luck. Then I tried a couple of other things: 1. tried publishing the program to see if it would still act the same as a stand alone app. It compiled but when I try to install it an error comes up and won't install completely. 2. (very strange I know) If you press f5 and minimize the VB window really fast, then go over and double click on the system clock in the system tray the program will run perfectly until you close the "Date and Time Properties" window. After you close the D and T window the program will freeze again in about 4 seconds. I know that the computer is not too busy because I can move the form around the desktop just fine. It doesn't hang up at all. I'm really stumped! Not very sure what to do from here. If anyone has an idea please let me know. There is probably too much code to insert it all in one of these replies. Is there anyway to attach the project folder somehow? Thanks again for your help
-
Question about Invalidate() for VB.NetI tried replacing Me.Invalidate() with Me.Refresh and unfortunately I got the same results. It didn't affect it at all.
-
Question about Invalidate() for VB.NetI don't know how much you need (honestly I didn't think that any would be required to understand the problem). I've copied the timer tick() routine.
Private Sub ClockTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ClockTimer.Tick
Me.Invalidate()
HourHand.Position = System.DateTime.Now.Hour
MinuteHand.Position = System.DateTime.Now.Minute
SecondHand.Position = System.DateTime.Now.Second
Application.DoEvents()
End SubWhen the program first starts to run the clock will tick about five times. Then it will pause for about 3 seconds, tick one more time and then it stops. I know that it is something that XP is doing, but I'm unsure of how to force it. I've also changed the styles of the form:
Me.SetStyle(ControlStyles.UserPaint Or ControlStyles.FixedHeight Or ControlStyles.FixedWidth Or _
ControlStyles.SupportsTransparentBackColor, True)If someone has any idea what this might be I would appreciate you letting me know. Thanks
-
Question about Invalidate() for VB.NetThank you for straightening that out for me. I'm new to programming and the CodeProject. It's always nice to have a friendly person show you the way. Thanks for your help Diego Moita, Adam :suss:
-
Question about Invalidate() for VB.NetI was attempting to build an analog clock for my computer. I've got the program just about finished, but I'm having a problem with the form's Invalidate() Function. When I run the program everything works fine for 5-6 seconds, but after that the form won't paint itself anymore. I've checked in debug mode and the loop is still running but the form doesn't paint. So I went a step further and forced the paint event under the mouse_doubleclick(). It is keeping time and the loop is running, but the form won't paint by itself. I have a feeling that the problem is with something that XP is doing behind the scenes. Does anyone know how to solve this problem?
-
The 30 Day "No IDE" ChallengeThat would be an excellent way to learn more about programming. I'm pretty new to programming (1 1/2 years as a hobby) and it would be beneficial for me to go through that experience. The only reason I wouldn't do it is because API documentation sucks so bad! I might learn more about how the compiler works but I wouldn't be able to find enough definitions to actually have a full program to compile. But for you 10 and 15 year veterans it could only help. You already know the APIs or atleast enough to get through. So the worst thing is you would become faster and more efficient while expanding your API vocabulary. You're not going to maintain first place if you don't hone your skills every once in a while. I'm still very intrigued by this idea. If anyone has any suggestions about a language that has good documentation, or maybe good third party documentation for one of the VS languages, your sharing would be appreciated. This would be an awesome way for me to better understand what is happening behind the scenes, but it's impossible without better resources. I have another question. I've never worked on a large project. How do you guys (or girls) plan and implement code if you can't recall (off the top of your head) what methods' parameters are? It seems like that would be a very crucial part of the design stage. P.S. Great Idea!
modified on Thursday, September 25, 2008 9:38 AM
-
Using pointers and passing ByRef in Visual BasicThank you for responding. Visual Basic is tricky when it comes to this stuff. What i'm finding is that the runtime takes care of most of these fine details. And you should only spend so much energy on it. Especially when you are talking about making 52 different copies of something. From what I've found VB won't let that happen. But as far as the byval and byref information... It is a very good explaination. Thanks for helping me clear all that up.
-
Using pointers and passing ByRef in Visual BasicI'm trying to build a card game (who didn't do that once). And I'm struggling with the images. Obviously all of the card face images are different, but the card back images are all the same. Why would you make 52 copies of the same image in memory? So I'm trying to hold the card back image in a common place that all of the cards can access, and just use a pointer to it. I'm having some trouble using pointers in vb. they seem to be relatively easy to use sometimes and I can't figure them out other times. One other question that I had is about passing ByRef. If you pass a reference and assign it to a variable, what is being assigned? Is it the reference or another copy of what the reference points to? I appreciate any help on this. I'm sure they're common questions but I'm having a hard time finding answers.:)
-
timer!!!!I don't understand completely::confused: If all of these forms are in the same application then why don't you have form10 call form2's timer and tell it to stop.
-
Textbox Multiple line ProblemHow will the information be input. Will you be manipulating it as one large string or are you storing it as one large string.