Solved

Form deletes painted picture, and getfocus problem

Posted on 2001-09-09
4
183 Views
Last Modified: 2010-05-18
Hi,

I have an application with MDI form, and a few child forms. I have a form "frmPicturePreview", in which I can call another form: "frmAddText" to add text to the picture preview form. The picture is being painted into frmPicturePreview with the paintPicture method. The problem is that when I call the frmAddText, it behaves like an erasure, in a way that if it's over the frmPicturePreview it erases the picture. Weird, huh? Does anyone know about this problem (bug?) and how to fix it?

My other problem is the "GetFocus" method. It looks like just clicking the form title doesn't fire this method. Or even clicking on the form itself. How can I know if the form is the active one? I tried to use MDIForm1.ActiveForm, but it kept telling me that I have an error.

Thanks a lot!
0
Comment
Question by:meravkn
4 Comments
 
LVL 38

Expert Comment

by:PaulHews
ID: 6469551
Windows applications only repaint when it is necessary (when they are minimized and restored or when they are covered by another window.)  When you are drawing on a form using paintpicture, your application doesn't know it has to maintain that drawing if the form needs to be repainted.  There are two ways to fix this.

in form load:

frmPicturePreview.AutoRedraw = True

or in the Paint event for your form, put in a call to the code that does the paintpicture.

0
 
LVL 9

Accepted Solution

by:
Valliappan AN earned 25 total points
ID: 6469808
For your getfocus problem, you could try the activate event of form.

And to find the active form name, hope can use, Screen.ActiveForm.Name,

Hope this helps.
0
 
LVL 1

Author Comment

by:meravkn
ID: 6472696
Thank you very much, I requested to split the points between two of you.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 6472912
I have reduced the points in half.  Now you can accept one of the experts comment as an answer and post another question in this topic area for the other for the other 25 points.

Thank you
Computer101
Community Support Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA color chart bars 12 79
Paint/Redraw window while dragging 16 68
passing a value with stream reader AFTER a ";" 3 59
VB6 ListBox Question 4 34
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now