Solved

Ruler on form

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
VBA open file from excel cell 4 34
Validating VB6 Function 19 50
Adding to a VBA? 6 49
Visual Studio 2005 text editor 10 23
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…
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 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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now