Solved

Form deletes painted picture, and getfocus problem

Posted on 2001-09-09
4
182 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

705 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

12 Experts available now in Live!

Get 1:1 Help Now