Solved

my own user control shape

Posted on 2002-03-28
4
148 Views
Last Modified: 2011-09-20
Hi,

when i create my user control, i draw it using shape control. Then it looks FLAT, but I want it to be 3D or looks like the command button .
How can i do it
0
Comment
Question by:toni2002
  • 3
4 Comments
 
LVL 22

Accepted Solution

by:
rspahitz earned 50 total points
ID: 6903877
Hi, again!
3D effects are achieved by adding gradiations of brightnesses.

If you look at a typical 3D button, you'll notice that the "surface" of the button is medium/light gray, the top and left are off-white, and the bottom and right are off-black.

There are several ways to achieve this:

1) Create a series of overlapping shapes, slightly offset from each other.  For example, create a series of light oval slightly up and left from the desired oval surface, then create a series of dark ovals slightly down and right, then place the primary oval at the correct location (with ZOrder = vbBringToFront.)

2) Actually draw arcs of various lengths and colors at various points to give the appearance of depth.  (This can be done using the Circle command onto the user control surface.)

I'll try to work out some details in the next comment.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6903925
OK, try something like this (assumes that your oval is twice as wide as it is high, i.e. width/height=.5) put into your user control's paint event.

  Dim sglRadiusX As Single
  Dim sglRadiusY As Single
  Dim iOffset As Integer
 
  Const PI As Double = 3.14159265358979
 
  sglRadiusX = Shape1.Width / 2
  sglRadiusY = Shape1.Height / 2
 
  For iOffset = 0 To 25 Step 5
    Me.Circle (Shape1.Left + sglRadiusX + iOffset, Shape1.Top + sglRadiusY + iOffset), sglRadiusX, &H606060, 225 * PI / 180, 45 * PI / 180, 0.5
    Me.Circle (Shape1.Left + sglRadiusX - iOffset, Shape1.Top + sglRadiusY - iOffset), sglRadiusX, &HF0F0F0, 45 * PI / 180, 225 * PI / 180, 0.5
  Next iOffset
 
0
 

Author Comment

by:toni2002
ID: 6907545
Hi rspahitz,

Thanx a lot for your interest and sorry for being late.
Both answers are right but I used the first one in my project.

Best wishes
Toni2002
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6910412
I'm glad it was helpful! :)
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

777 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