Solved

Form deletes painted picture, and getfocus problem

Posted on 2001-09-09
4
185 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

756 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