Solved

my own user control shape

Posted on 2002-03-28
4
152 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Notepad++ how to remove delimiter : from beggning of the line? 3 133
using web browser with BING 40 148
fso.FolderExists("\\server\HiddenFolder$") 4 96
Excel Automation VBA 19 115
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…
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…
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…
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…

734 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