Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

non-square pictures

Posted on 1998-07-27
5
Medium Priority
?
327 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 400 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Suggested Courses

963 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