|
-
Jul 7th, 2002, 07:49 AM
#1
Thread Starter
Lively Member
Help Please: Creating A Diamond...
Here's the dilema:
I need to create a bbunch of diamonds, all clickable, and have them right beside each-other.
Picture boxes don't work; they're square.
Shapes wont work; a) they have no diamond, b) they're not clickable.
I've been getting a headache over this for the last few days, any ideas from the rest of the world?
To err is human, to really mess up, you need a computer.
-
Jul 7th, 2002, 07:56 AM
#2
PowerPoster
It is not so hard. I will give u the general idea and u can have a shot at it first. I am off to noddy land soon but will post again tomorrow if u have had no luck.
Essentially, you have a picture box containing all of the diamonds. Draw them using the Picture.Line tool
Now u will have used formulae to position and size the diamonds so all u have to do is to measure the X and Y posn in the Picture MouseDown or MouseUp event and see if that X, Y fits within the diamond formula area.
-
Jul 7th, 2002, 08:12 AM
#3
Frenzied Member
I think also you could use the CombineRgn API call to set your own shapes instead of the square shape. I have no idea how to do it though, or even if that is definately the right API to use. beachbum's idea is probably better.
-
Jul 7th, 2002, 05:36 PM
#4
Thread Starter
Lively Member
Well.... You've successfully confused me...
To err is human, to really mess up, you need a computer.
-
Jul 7th, 2002, 05:48 PM
#5
If you wanted to use different objects, and not just drawn shapes, then try this with pictureboxes
VB Code:
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINT, _
ByVal nCount As Long, _
ByVal nPolyFillMode As Long) _
As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, _
ByVal hRgn As Long, _
ByVal bRedraw As Boolean) _
As Long
Private Const ALTERNATE = 1
Private Const WINDING = 2
Private Type POINT
x As Long
y As Long
End Type
Private Sub Form_Load()
Call CreateDiamond(Picture1)
End Sub
Private Sub CreateDiamond(pct As PictureBox)
Dim pWidth As Long, pHeight As Long, hRgn As Long
Dim p(0 To 3) As POINT
With pct
pWidth = (.Width / Screen.TwipsPerPixelX) - 1
pHeight = (.Height / Screen.TwipsPerPixelY) - 1
p(0).x = pWidth / 2
p(0).y = 0
p(1).x = pWidth
p(1).y = pHeight / 2
p(2).x = pWidth / 2
p(2).y = pHeight
p(3).x = 0
p(3).y = pWidth / 2
hRgn = CreatePolygonRgn(p(0), 4, ALTERNATE)
Call SetWindowRgn(.hWnd, hRgn, True)
End With
End Sub
And there's your diamond.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jul 7th, 2002, 07:09 PM
#6
Thread Starter
Lively Member
You kick ass!
But, the sides that run this way: \ are jagged... any ideas?
To err is human, to really mess up, you need a computer.
-
Jul 8th, 2002, 04:34 PM
#7
Junior Member
Wait wait wait! Wait!! I have the perfect solution!!
Just create all your controls as rectangles. Align them and everything, so it looks nice. Done? Good. Now... Flip your monitor either 45° to the right, or 45° to the left.
...
/smartassmode. :P
-
Jul 8th, 2002, 06:58 PM
#8
Hyperactive Member
Originally posted by RuneLancer
Wait wait wait! Wait!! I have the perfect solution!!
Just create all your controls as rectangles. Align them and everything, so it looks nice. Done? Good. Now... Flip your monitor either 45° to the right, or 45° to the left.
...
/smartassmode. :P
haha
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|