INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

2 problems

2 problems

(OP)
Using XL 2007

1) Working with a user form. The form's name is UserForm1. When I double click on the form while writing code for the form's events, the window opens with the event titled "UserForm_Click", but the form's name is actually "UserForm1". Should it not open with the title, "UserForm1_Click". Why would it be doing that? Also, when testing, an error of some kind sometimes causes XL to crash.

2) I am changing the form's pixel colors to colors stored in an RGB byte array "P"
DrawDC = DrawDibOpen()
DrawDibDraw DrawDC, Hdc, 1, 1, -1, -1, BInfo, P(1, 1), _
0, 0, BInfo.biWidth, BInfo.biHeight, 0
DrawDibClose DrawDC

That works fine (even though Hdc is DC of the handle to UserForm1), but if the form is covered by another program's window and then uncovered, the form does not automatically repaint. All previously colored areas that were covered are white when the covering program's window is moved away. Are the two problems related? I've seen some questions and solutions about forcing a repaint by including a DoEvents in a loop, but that was in regard to a progress bar that has a loop running. How can I force a repaint event without resorting to using some kind of timer control?


Independent events are seldomly independent.

RE: 2 problems

(OP)
Maybe the form thinks its colors should still be the background color.

Any better ideas on how to color a form in XL. Maybe write the bmp as a file, then load the file to an image!

Independent events are seldomly independent.

RE: 2 problems

BigInch,
The answer to your first question is that the code is not within a module of the project, but within the userform itself. It does need to call Userform1_Click because the userform is itself the only user form.

For the second question, Please put the entire code so that I could more easily troubleshoot your problem.
~chemebabak

RE: 2 problems

(OP)
Thank you chemebabak.
Let me think about that.

I hate Windowz 8!!!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close