Solved

my own user control shape

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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 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…

679 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