Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Ruler on form

Posted on 1999-01-11
2
Medium Priority
?
353 Views
Last Modified: 2010-05-03
I would like to put scalable rulers at the top and left edge of a form. When the mouse moves an indication is given of position on the ruler. Is there code, control - preferably free that will do this?
0
Comment
Question by:capel
[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
2 Comments
 
LVL 4

Expert Comment

by:chabaud
ID: 1455478
You could draw your rulers in pictureboxes.

Try create a form with one picturebox (use as top ruler):

Option Explicit

Private pos As Integer

Private Sub Form_Load()

    Dim i As Integer
   
    ScaleMode = vbPixels
    Picture1.Align = vbAlignTop
    Picture1.ScaleMode = vbPixels
    Picture1.AutoRedraw = True
    Picture1.width=350
    Picture1.DrawMode = vbCopyPen
   
    For i = 0 To 150
        If i Mod 10 Then
            Picture1.Line (3 * i, 0)-Step(0, 5)
        Else
            Picture1.CurrentX = 2 + 3 * i
            Picture1.CurrentY = 8
            Picture1.Print CStr(i \ 10)
            Picture1.Line (3 * i, 0)-Step(0, 10)
        End If
    Next
    Picture1.DrawMode = vbInvert
    Picture1.Line (pos, 0)-Step(1, 20), , BF
    Picture1.DrawMode = vbCopyPen
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Picture1.DrawMode = vbInvert
    Picture1.Line (pos, 0)-Step(1, 20), , BF
    pos = X
    Picture1.Line (pos, 0)-Step(1, 20), , BF
    Picture1.DrawMode = vbCopyPen
End Sub

0
 
LVL 1

Accepted Solution

by:
Johnn earned 200 total points
ID: 1455479
Then have a line control in each ruler and in the mousemove event move this line to the apropriate location within the ruler
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

704 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