Solved

Ruler on form

Posted on 1999-01-11
2
327 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
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 100 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

772 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