[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Draw border around Usercontrol

Posted on 2004-10-05
8
Medium Priority
?
997 Views
Last Modified: 2012-06-27
Hi all

I'm trying to draw a custom border around a usercontrol.

In the paint event I have this:

If Border = True Then
  UserControl.Line (1, 1)-(UserControl.ScaleWidth - 10, UserControl.ScaleHeight - 10), BorderColor, B
End If

But sometimes only top and left borders are displayed.

Anybody knows how to address the last visible pixel on x and y?


With kind regards


Ramses (x_terminat_or_3)
0
Comment
Question by:x_terminat_or_3
[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
8 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 12224695
just guess:

UserControl.Line (10, 10)-(UserControl.ScaleWidth + 10, UserControl.ScaleHeight + 10), BorderColor, B

?
0
 
LVL 2

Author Comment

by:x_terminat_or_3
ID: 12225093
Nope, that doesn't do it
0
 
LVL 7

Expert Comment

by:_agj_
ID: 12225240
why not use .Left+.Width-10 and .Top+.Height-10
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:x_terminat_or_3
ID: 12225254
Stop the presses, I found what was going on

The border was partially hidden because of a label.  I've set the label's backstyle to transparent and that did the trick.

Stupid me!  


Thanks for your input
0
 
LVL 10

Accepted Solution

by:
fds_fatboy earned 500 total points
ID: 12225289
Just a little extra bit. Are you drawing 1 pixel in from the edge?

If so,instead of this:

  UserControl.Line (1, 1)-(UserControl.ScaleWidth - 10, UserControl.ScaleHeight - 10), BorderColor, B

It is better and safer to convert all coordinates to/from pixels like this:

  UserControl.Line (ScaleX(1, vbPixels, Scalemode) , ScaleY(1, vbPixels, Scalemode))-(UserControl.ScaleWidth - ScaleX(1, vbPixels, Scalemode), UserControl.ScaleHeight - ScaleY(1, vbPixels, Scalemode)), BorderColor, B

0
 
LVL 2

Author Comment

by:x_terminat_or_3
ID: 12225301
Thanks this is excatly what I needed
0
 
LVL 10

Expert Comment

by:fds_fatboy
ID: 12225525
Happy to help - and unexpected points too.
0
 
LVL 2

Author Comment

by:x_terminat_or_3
ID: 12225537
I've given them since it was the exact answer to the question

"Anybody knows how to address the last visible pixel on x and y?"


With kind regards



Ramses (x_terminat_or_3)
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

650 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