Click here to Skip to main content
15,562,015 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralTag Line Pin
The Man from U.N.C.L.E.11-Mar-10 8:55
The Man from U.N.C.L.E.11-Mar-10 8:55 
GeneralRe: Tag Line Pin
εїзεїзεїз11-Mar-10 9:46
εїзεїзεїз11-Mar-10 9:46 
GeneralRe: Tag Line Pin
The Man from U.N.C.L.E.12-Mar-10 9:37
The Man from U.N.C.L.E.12-Mar-10 9:37 
GeneralRe: codin prblm Pin
William Winner12-Mar-10 6:49
William Winner12-Mar-10 6:49 
AnswerRe: codin prblm Pin
DaveAuld11-Mar-10 4:17
professionalDaveAuld11-Mar-10 4:17 
AnswerRe: codin prblm Pin
Luc Pattyn11-Mar-10 5:24
sitebuilderLuc Pattyn11-Mar-10 5:24 
AnswerRe: codin prblm Pin
Daniel Engelkes11-Mar-10 15:46
Daniel Engelkes11-Mar-10 15:46 
QuestionHelp with Ruler in VB.net Pin
nyt197211-Mar-10 0:43
professionalnyt197211-Mar-10 0:43 
Hi experts/Friends,

I am learning VB.net and trying to make a ruler for my Text Editor. Following is my try please help me to improve it.

Public Class myRuler
    'Inherits System.Windows.Forms.UserControl


    Private Sub myRuler_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        Dim g As Graphics = e.Graphics
        Dim p As Point = New Point(0, 0)
        Dim s As Size = New Size(Me.Width, Me.Height)
        Dim curRec As Rectangle = New Rectangle(p, s)
        g.DrawRectangle(Pens.Black, curRec)
        'Converting Pixels to Twips
        Dim ptoTwip As Single = (Me.Width * 15)
        'Twips to Inches
        Dim twipToInches As Single = CSng(ptoTwip / 1440)
        Dim b As Single = 0
        'Draw Numders 1 2 3 etc.
        For a As Single = 0 To twipToInches
            g.DrawString(a, New Font("Arial", 10), Brushes.Black, b, 10)
            b = b + 96 '96 192 288
        Next
        '  Dim ptomm As Integer = Me.Width / 3.779527559
        'Draw Lines between inches, and long line every 5th
        Dim y As Single = 10.0F
        For x As Single = 0 To b Step 9.6
            g.DrawLine(Pens.Black, x, 0, x, y)
            'MessageBox.Show(x)
            If x Mod 2 = 0 Then
                y = 15
            Else
                y = 10
            End If
        Next
    End Sub



End Class

AnswerRe: Help with Ruler in VB.net Pin
Dave Kreskowiak11-Mar-10 2:52
mveDave Kreskowiak11-Mar-10 2:52 
AnswerRe: Help with Ruler in VB.net Pin
Smithers-Jones11-Mar-10 3:09
Smithers-Jones11-Mar-10 3:09 
AnswerRe: Help with Ruler in VB.net Pin
εїзεїзεїз11-Mar-10 5:57
εїзεїзεїз11-Mar-10 5:57 
AnswerRe: Help with Ruler in VB.net Pin
The Man from U.N.C.L.E.11-Mar-10 9:04
The Man from U.N.C.L.E.11-Mar-10 9:04 
GeneralRe: Help with Ruler in VB.net Pin
nyt197211-Mar-10 18:53
professionalnyt197211-Mar-10 18:53 
GeneralRe: Help with Ruler in VB.net Pin
The Man from U.N.C.L.E.11-Mar-10 23:36
The Man from U.N.C.L.E.11-Mar-10 23:36 
QuestionError Using Dll Crash Application Pin
Anubhava Dimri10-Mar-10 21:00
Anubhava Dimri10-Mar-10 21:00 
AnswerRe: Error Using Dll Crash Application Pin
εїзεїзεїз10-Mar-10 21:27
εїзεїзεїз10-Mar-10 21:27 
GeneralRe: Error Using Dll Crash Application Pin
Anubhava Dimri10-Mar-10 21:45
Anubhava Dimri10-Mar-10 21:45 
GeneralRe: Error Using Dll Crash Application Pin
Dave Kreskowiak11-Mar-10 2:52
mveDave Kreskowiak11-Mar-10 2:52 
GeneralRe: Error Using Dll Crash Application Pin
Anubhava Dimri11-Mar-10 18:13
Anubhava Dimri11-Mar-10 18:13 
Questionpowermill Pin
hellogany10-Mar-10 18:53
hellogany10-Mar-10 18:53 
AnswerRe: powermill Pin
Luc Pattyn10-Mar-10 19:08
sitebuilderLuc Pattyn10-Mar-10 19:08 
AnswerRe: powermill Pin
Dave Kreskowiak10-Mar-10 19:10
mveDave Kreskowiak10-Mar-10 19:10 
AnswerRe: powermill Pin
εїзεїзεїз10-Mar-10 21:12
εїзεїзεїз10-Mar-10 21:12 
Questionprinting in vb.net [modified] ... resolved Pin
Daniel Engelkes10-Mar-10 14:34
Daniel Engelkes10-Mar-10 14:34 
AnswerRe: printing in vb.net [modified] Pin
Wayne Gaylard10-Mar-10 15:19
professionalWayne Gaylard10-Mar-10 15:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.