Solved

Transparent Form + Transparent GIF = Splash Screen

Posted on 2001-07-19
12
256 Views
Last Modified: 2006-11-17
Im Hoping Someone Can Shed A Little Or Preferably ALOT Of Light On My Problem. I Have A .gif With A Transparent Background Which I Place In An Image Control And When I Make The Form Transparent Everything Disappears.
 
The API Calls I'm Using To Make The Form Transparent Are:

Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_TRANSPARENT = &H20&
Public Const SWP_FRAMECHANGED = &H20
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const SWP_SHOWME = SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOSIZE
Public Const HWND_NOTOPMOST = -2

Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long


Public Sub MakeFormTransparent(FormObject As Form)
    SetWindowLong FormObject.hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT
    SetWindowPos FormObject.hwnd, HWND_NOTOPMOST, 0&, 0&, 0&, 0&, SWP_SHOWME
End Sub


Any Help Would Be Greatly Appreciated
0
Comment
Question by:mgronlund
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 5

Expert Comment

by:KDivad
ID: 6299101
I've always suspected that an image control doesn't really exist and the image is actually on the form itself (same with labels). If this is true, then your code will make it disappear along with the rest of the form.

Don't know of a way around it unless you use form-shaping APIs to crop the form to the same shape as the gif's image.
0
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6299118
<Ping>
0
 
LVL 3

Author Comment

by:mgronlund
ID: 6299136
Thought About Doing That First But The Shape Is To Irratic
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 8

Expert Comment

by:DennisBorg
ID: 6299138
:ping:
0
 
LVL 5

Accepted Solution

by:
KDivad earned 300 total points
ID: 6299154
You can try a web-search for VB Shaped Form Creator. Last time I checked, you could use it to create shapes from images. It wasn't very good, but may have improved since then...
0
 
LVL 3

Author Comment

by:mgronlund
ID: 6299234
Tried It, Doesnt Do A Terrible Job But It Doesnt Do The Inside Transparentancies (Like The Center Of Od or a)

FYI Its At http://members.fortunecity.com/alexv/index.html?VBSFC.html
0
 
LVL 3

Author Comment

by:mgronlund
ID: 6299246
AHHHHHH NEVERMIND I Found An Option That Did What I Need Thanks!
0
 
LVL 5

Expert Comment

by:KDivad
ID: 6299585
Great! Glad you got your problem worked out.
0
 
LVL 3

Author Comment

by:mgronlund
ID: 6299613
Just In Case Anyone Tries To Do What I Did You Need To Set The Edge Tracer To Use Rectangle File.

The Only Problem Is That (For Example) My Image Made 800+ Calls To The API, That In Itself Made The Routine Too Large For VB To Handle. You'll Need To Do A Search And Replace For Screen.TwipsPerPixelX + OffsetX And Screen.TwipsPerPixelY + OffsetY And Assign Them A Variable, Also Might Need To Assign ScaleY * 15 and  ScaleX * 15 To A Variable. End Results Are The Same Just Results In Smaller Code And Faster Execution Since VB Won't Have To Do 800+ Calculations

0
 
LVL 8

Expert Comment

by:DennisBorg
ID: 6299638
mgronlund: Thank you for this latest comment. It certainly adds value to the PAQ.
0
 
LVL 5

Expert Comment

by:KDivad
ID: 6299739
I agree. It's great when the asker posts their results back like this.
0
 
LVL 3

Author Comment

by:mgronlund
ID: 6300040
Try To Help Those That Help Me,... Have One Wuestion What Is The PING Messages?
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

808 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