Solved

my own user control shape

Posted on 2002-03-28
4
146 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

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

21 Experts available now in Live!

Get 1:1 Help Now