Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB.NET Printing Alignment???

VB.NET Printing Alignment???

Scheduled Pinned Locked Moved Visual Basic
questioncsharpgraphics
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    harveyhanson
    wrote on last edited by
    #1

    How do i make print text aligned to the centre on a page, i have tried font.style, font. everything and cant find it!: ive also tried adding this above: txtPrint.TextAlign = HorizontalAlignment.Center The code i am working with is: ev.Graphics.DrawString(txtPrint.Text, New Font("Century Gothic", 30, FontStyle.Bold), brushes.Black, 120, 120)

    S 1 Reply Last reply
    0
    • H harveyhanson

      How do i make print text aligned to the centre on a page, i have tried font.style, font. everything and cant find it!: ive also tried adding this above: txtPrint.TextAlign = HorizontalAlignment.Center The code i am working with is: ev.Graphics.DrawString(txtPrint.Text, New Font("Century Gothic", 30, FontStyle.Bold), brushes.Black, 120, 120)

      S Offline
      S Offline
      Snews
      wrote on last edited by
      #2

      Use the MeasureString to get the width and height of the string and then calculate the center of the control or window to position your text. Ex. The Window's Width / 2 - TheFontWidth / 2 for the X cordinate AND The Window's Height / 2 - TheFontHeight / 2 for the Y cordinate I think you can use the TextRenderer Class to to perform some more advanced drawing even in VB.NET

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups