Solved

non-square pictures

Posted on 1998-07-27
5
300 Views
Last Modified: 2010-05-03
How can I put a picture in another format (not a square or a retangle) in the form?
0
Comment
Question by:ruyluis
5 Comments
 
LVL 1

Expert Comment

by:khaledc
ID: 1466883
You posted the question twice, please delete one of them before you create a confusion.
Regards

0
 
LVL 1

Expert Comment

by:Jason_G
ID: 1466884
Hi ruyluis,
do you mean, another picture format such as .bmp, .jpg, etc.  Or do you mean you would like to produce different shapes using the PSet and Line methods?

Sincerely,
Jason

Jason Gorman (jason_gorman@scholars.com)
Learning Advisor, scholars.com
Microsoft Authorized Technical Education Center
Novell Authorized Online Training Provider
http://scholars.com
0
 
LVL 4

Accepted Solution

by:
Chizl earned 100 total points
ID: 1466885
Feel privileged, I'm giving you source code out of my own DLL.
This will work for anything with a hWnd.   CommandButtons, Forms, Pictures, ect..

'======================================================
'See
'RoundOffCorners()
'SquareOffCorners()

Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "User32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long

Public Sub RoundOffCorners(ObjectWithHwnd As Variant)
    Dim hr&, dl&
    Dim usew&, useh&
    usew& = ObjectWithHwnd.Width / Screen.TwipsPerPixelX
    useh& = ObjectWithHwnd.Height / Screen.TwipsPerPixelY
    hr& = CreateEllipticRgn(0, 0, usew, useh)
    dl& = SetWindowRgn(ObjectWithHwnd.hwnd, hr, True)
End Sub

Public Sub SquareOffCorners(ObjectWithHwnd As Variant)
    Dim hr&, dl&
    Dim usew&, useh&
    usew& = ObjectWithHwnd.Width * Screen.TwipsPerPixelX
    useh& = ObjectWithHwnd.Height * Screen.TwipsPerPixelX
    hr& = CreateEllipticRgn(0, 0, usew, useh)
    dl& = SetWindowRgn(ObjectWithHwnd.hwnd, hr, True)
End Sub
'======================================================

Chizl
http://www.karland.com/
http://www.sourcesite.simplenet.com/
0
 

Author Comment

by:ruyluis
ID: 1466886
Hi! I'm sorry, but I'm having a lot of troubles at my computer and I'm delaied with you. But I'm accepting now your answer. However, i couldn't use wath you suggested. i would like to know if you accept change e-mail with me to clarify the question. If you accept this, my e-mail is ruyluis@sti.com.br. Thanks
0
 
LVL 4

Expert Comment

by:Chizl
ID: 1466887
chizl@karland.com
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

760 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

23 Experts available now in Live!

Get 1:1 Help Now