Both answers helped so thanks again!
[quote=298378:@Dave S][code]
dim p as picture /// THIS IS NEVER POPULATED
dim x as integer=Canvas2.Width /2 - p.Width /2
dim y as integer=Canvas2.Height /2 - p.Height /2
dim w as integer=p.width+50
dim h as integer=p.height+50
g.ForeColor = &c80000000
g.FillRoundRect(x, y, w, h, 10, 10)
’ How do I do something like this?
g.DrawPicture(p, x, y)
[/code]
and where does “P” get defined???
but this does not do TWO things
- insure that “P” is scaled, or fits inside the define area (your draw picture has no scaling information)
- does not CLIP the rounded corners of “P” … since the draw picture comes AFTER the rectangle, the square corners of the picture will obsuure you fill area.
maybe something like
g.drawpicture(p,x+10,y+10, w-20,h-20, 0,0,p.width,p.height)
the 10 is to compensate for your radius[/quote]
[quote=298388:@Paul Lefebvre]There are lots of ways you can do this, but you just need to keep track of the sizes you want to use and do the math.
Something like this will draw a RoundRect to fit into the Canvas area and then will draw a picture (scaling if necessary) to fit into the RoundRect.
[code]
Dim p As picture = SeaSlug
Const kBorder = 10
g.ForeColor = &c80000000
// Draw a RoundRect to fit within the size of the Canvas, subtracting a border value
Dim rrWidth As Integer = g.Width - kBorder * 2
Dim rrHeight As Integer = g.Height - kBorder * 2
Const kPicBorder = 50
Dim picWidth As Integer = rrWidth - kPicBorder * 2
Dim picHeight As Integer = rrHeight - kPicBorder * 2
g.FillRoundRect((g.Width - rrWidth) / 2, (g.Height - rrHeight) / 2, rrWidth, rrHeight, 10, 10)
g.DrawPicture(p, (g.Width - picWidth) / 2, (g.Height - picHeight) / 2, picWidth, picHeight, _
0, 0, p.Width, p.Height)
[/code][/quote]