Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Printing Alignment (center)


Hallo Hi..I'm having problem how to print center in a form.Printer.CurrentY = 1000Printer.CurrentX = 1000Printer.Print "My Name"printer.endocThank you..




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Vertical Center Alignment
I would like to get a vertical center alignment in a text box . Like in a command button .

thank you

Center Alignment On Printer Object
Hello,

I would like to center (horizontally; width-wise) a line of text on a printer object. If the text line varies in size (depending on the printout), how would I go about aligning it in the center?

Any help would be great!

Thanks,
Mike

TextBox Alignment Unable To Center
I have a 1-3 text box. In the properties I set the Alignment=2 Centered. I also set the properties Text 000 autho unneccessory just for alignment. I do a textbox= Number, This is fine but the text will shift off center. I did a TextBox.Alignment = 2 in form load to be sure but still get the off center to Right. I also ajusted the textbox width but its still off center. Anyone ?



VB.6 User, Since 2002
Next Generation Lighting Controls
www.jmelectronics-online.com

Edited by - Jremote on 3/8/2005 10:52:10 AM

Settextalign Vertical Alignment To Center?
I am using the SetTextAlign to manage the position of text in a VB6 program. However, there does not appear to be any way to set the vertical alignment to the center of the text, as there is for the horizontal alignment. Does anyone know of another API function that will do this, or some other way to accomplish the same thing?
I am using rotated text, so it is a bit tricky and I am looking for an elegant way to do this.

Thanks,
Dennis

How To Format Text To Center Alignment In A ListView?
Hi,

How to format text to center alignment in ListView?

Margaret.

How To Set Alignment For Header Text In MSFlexgrid = Center
Hi all i want ask about how to center the header text in MSFlexgrid..what i have done:


VB Code:
Grid2.FormatString = "<No|<Code|Date|Description|Amount IN|Amount OUT|Bil"
<Code for Left Justify.How about to Center it.

Thanks in advance

How To Use Alignment (Center, Etc) A Cell In An Excell Sheet Using VB Code?
Hiya all,

Quick question? How to align a cell in an excell sheet using VB code? Thanx for you help!

Center Printing
I have this code to print some text in the center of a page but it fails to print in the center. It is usually an inch or two to the left and right of the middle.


Code:
header = "Workout Statistics for " & Date

Printer.CurrentX = (Printer.ScaleWidth / 2) - (Printer.TextWidth(header) / 2)

Any help would be great!

Thanks

Alignment In Printing
Hi,

I want to print from my program and i want to align my text to the right, but not with printer.currentx

Can anyone help me plz

Printing Alignment
I am learnig VB, No matter what I do, I can not get the right Format to get a nice looking printout. "Currency" aligns the Dollar signs in a column, not the points. For example,

$12.50
$1,230.00

Please help, I am going crazy,

Thanks

Luis

Printing Alignment
Hi All,

I am using the following code to print string "numbers" in columns. The code works to align the numbers on the left but when the numbers are e.g. 5 with a 10 below and 123 below that I need them to be right aligned. I am not able to use them as straight numbers as some numbers have to print with an asterisk e.g. 7*.

The column currently prints as follows:

        5
        10
        123
        7*
I need it to print like this:

         5
       10
     123
         7*

I hope it is clear what I am trying to achieve with this. Any help appreciated. Thanks.

Public Function AddSpaces(OrigString As String, TotLen As
Integer) As String
If Len(OrigString) >= TotLen Then
    AddSpaces = OrigString
    Exit Function
End If
AddSpaces = OrigString & Space(TotLen - Len(OrigString))
End Function




Printer.Print AddSpaces("0.0 - 0.1m", 25) + AddSpaces(FrmPene.Tet1, 6) + AddSpaces(FrmPene.Tet13, 6) + AddSpaces(FrmPene.Tet25, 6) + AddSpaces(FrmPene.Tet37, 6)

Printing Center Align
You all have seen the center aling in Microsoft Word.
How can i do the same and then print a string from a textbox or richbox?

Printing - Alignment Of Currency
I am using the following code in a loop to print cheque amounts

Printer.CurrentX = 3300
Printer.CurrentY = 4625 + i * 275
Printer.Print .Fields!ChequeAmount

The amounts vary from $20.00 to $20,000.00 How do I right justify it so that is correctly aligned? Is there a print using method?

Hmmm, Printing Alignment Anyone?
Hi,

I need to print a PictureBox to the printer, with the result being centre aligned on the page, in the X and Y direction. Here is the code I am using:


VB Code:
Function PrintBarcodes()Dim picPrintX, picPrintY As Integer picPrint.Height = picLabel.Height * (Row + 1) picPrintX = (Printer.Width 2) - (picPrint.Width 2)picPrintY = (Printer.Height 2) - ((picLabel.Height * 10) 2) With Printer.PaperSize = vbPRPSA4.ColorMode = vbPRCMMonochrome.PaintPicture picPrint.Image, picPrintX, picPrintY.EndDocEnd WithEnd Function


This works great for the Y alignment, but the picture is printed slightly too much to the left when printed. Any ideas why this may be? Im sure the code works fine, and im sure the picture im printing has no white strip at the end of it. Maybe I havent set up the printer correctly or the paper isnt in the tray right...help please!

(VbAndersonic)

Printing Numerics In Alignment
I need some assistance. I am trying to out put some data using the statement below

Printer.FontName = "Courier"
Printer.Print ssno; Tab(15); name; Tab(50); Format$(Format$(hppd, "###,###.00"), "@@@@@@@@"); Tab(65); Format$(Format$(hytd, "###,###.00"), "@@@@@@@@"); Tab(75); Format$(Format$(hgoal, "###,###.00"), "@@@@@@@@"); Tab(100); Format$(Format$(dppd, "###,###.00"), "@@@@@@@@"); Tab(115); Format$(Format$(dytd, "###,###.00"), "@@@@@@@@"); Tab(125); Format$(Format$(dgoal, "###,##0.00"), "@@@@@@@@@")

I cannot get the numbers to right align.

i get the following on the printer.
3,948.71
948.71

when i output to debug.print the columns are aligned.

Thanks for you help in advance.

Printing Alignment Problem Please Help
Hi please help,

I want to print a customer address from a recordset at a given point.

The code I'm using is as follows;

Printer.CurrentX = 100
Printer.CurrentY = 550
Printer.Print rsInvoiceheader.Fields(3)

The problem I have is that the rsInvoiceheader.Fields(3) data is stored as multiline
so I get the following results

       Address Line 1
Address Line 2
Address Line 3
Address Line 4

Is there a way to print all lines in the field using Printer.CurrentX or will I have to store each line as seperate fields.

Any suggestions would be appreciated

Chris     

Center Horizontal And Vertical Printing
Public Health Notice: Take a very deep breath before attempting to read this.

ok im kinda new with printing i tried some stuff but couldn't do it i need to print text on a usercontrol center horizontal and vertical text but thats not the hard part im stuck at when the word is too big like this one ssssssssssssssssssssssssssssssssss its bigger than the width so i need some letters to go to the next line and when all the text is bigger than the usercontrol i wanna add a "..." at the end lol im stuck at these can somebody help me pls?

**RESOLVED** Center MSchart When Printing??
I have the following code in which I need to find a way to center the chart on the paper when printing:

VB Code:
Printer.Orientation = 2             'Print Landscape              Printer.PrintQuality = vbPRPQHigh   'Print quality = high                                      frmRepChart.PhoneChart.EditCopy 'copies a picture of the chart (meta file format) and the chart data to the clipboard                                   'adjust the coordinates to suit your needs               Printer.PaintPicture Clipboard.GetData(vbCFMetafile), 0, 0, frmRepChart.PhoneChart.Width, frmRepChart.PhoneChart.Height                                    Printer.Print                Printer.FontBold = True                Printer.FontSize = 12                Printer.FontUnderline = True                Printer.Print Tab(20); "CPMS Representative Trend Report"                Printer.Print                Printer.Print ""                Printer.Print ""                Printer.Print ""                Printer.Print ""                Printer.Print ""                Printer.Print ""                                    Printer.EndDoc 'sends the chart to the printer                                    Clipboard.Clear
The result of the above code is the Chart is placed at the top of the page...even with the title the chart overrides that and stays on top...

Any suggestions will be appreciated!!!

Thank you!

(Help Please!) Center And Resize Grid For Printing
Ok. I'm printing a msflexgrid full of pictures using:

Private Sub PrintGrid(MyGrid As MSFlexGrid)

Dim OldWidth As Integer

OldWidth = MyGrid.Width
MyGrid.Width = Printer.Width
Printer.PaintPicture MyGrid.Picture, 0, 0
Printer.EndDoc
MyGrid.Width = OldWidth

End Sub

Private Sub cmdPrintGrid_Click()
Call PrintGrid(MSFlexGrid1)
End Sub

It works, but is there a way I can resize the grid to fit the page as well as center it? Thanks to anyone with knowlege on this matter!

Printing A Form In The Center Of The Page
Hello,
Can anyone help me get this to print in the center of the page? All my code does is shift everything on the screen and then it still prints in the upper left area of the page. Thanks.

Kim


Private Sub cmdPrint_Click()
'print what's on the form
Dim rv As Long
Dim sWide As Single, sTall As Single

Me.ScaleMode = vbTwips
sWide = 8.5
sTall = 11
Me.Width = twipFactor * sWide
Me.Height = twipFactor * sTall

'center everything
With Picture1
.Left = Me.Width / 2
.Top = Me.Top / 2
.Width = twipFactor * sWide
.Height = twipFactor * sTall
End With

Me.Visible = True
'hide the buttons so they don't print
cmdRandom.Visible = False
cmdAdd.Visible = False
cmdSubtract.Visible = False
cmdMultiply.Visible = False
cmdDivide.Visible = False
cmdPrint.Visible = False

DoEvents

Picture1.SetFocus
Picture1.AutoRedraw = True
rv = SendMessage(Picture1.hwnd, WM_PAINT, Picture1.hDC, 0)
rv = SendMessage(Picture1.hwnd, WM_PRINT, Picture1.hDC, _
PRF_CHILDREN + PRF_CLIENT + PRF_OWNED)
Picture1.Picture = Picture1.Image
Picture1.AutoRedraw = False

Printer.Print ""
Printer.PaintPicture Picture1.Picture, 0, 0
Printer.EndDoc

'put it back to top and left
With Picture1
.Left = 0
.Top = 0
End With

'bring the buttons back
cmdRandom.Visible = True
cmdAdd.Visible = True
cmdSubtract.Visible = True
cmdMultiply.Visible = True
cmdDivide.Visible = True
cmdPrint.Visible = True
End Sub

TextBox Alignment Does Not Work On Printing
Hello,

I am trying to print a form with a couple of textboxes in it. On the form, the text in the TextBoxes are properly Aligned in the Center of the TextBox.

However on Printing the Text always shows up on the left of the textbox.

Is there any solution to have the text in the textboxes print in the center of the Textbox?

Thanks.

Mark

Printing Alignment Problem With Code
I added a Print button to my project. All it prints are the current values from the forms textboxes, nothing fancy. That is all I am after.

The feature does work and on some printers everything is lining up as it should, while on other printers the alignemnt is off.

Example:

Value1 45
Value2 45
Value3 45
Value4 45

On some printers, the above alignment can look like the following:

Value1 45
Value2 45
Value3 45
Value 45

The code I used is the Printer.Print, and "Value1";space(#),value1.text
...(# is the number of spaces)

Can this be done a different way while still just printing the current values from the form? Please, NO API's. Thanks.

How To Set The Alignment Of A Line While Printing Using VBA Code ?
Hi everybody,
I am trying to print using VBA code through the Printer object. Is there any way I can set the alignment (Left/Center/Right) of a particular line ?

Print Alignment Problem While Printing From XP
Hi Guys,

      My application is supposed to print lots and lots of data every day using Dot Matix Printers. To make the printing faster I use generic/text printer driver. Every thing worked fine with windows 98 machines. But I tried printing from an XP Machine, I found that the alignment has been changed a way bit. I found that in XP Space required by each characters is a bit less when compared to 98. That is creating the problem I Guess.

Now its such that I'll have to make a different print alignment for XP and 98 which is not at all feasible.

Can any body help me out of this issue.

The font I'm using is roman10cpi. Does that make any sense. Or is there any thing more to be done while configuring a generic printer in XP ?

PLease help me...

Regards
Issac



Edited by - issacgeorge on 4/5/2005 3:59:53 AM

Table Alignment Problem When Printing
I have 2 tables displayed on a page. When I print preview the page (landscape orientation), the tables are no longer aligned. This only happens when the page height exceeds the standard height. How can I handle this?





 

Form, Label Printing Alignment And Format
I've been trying to find out how to align and format data on forms and inside labels...not printing to paper, just displaying on my screen at runtime.

Here is my goal:

I printed several dozen numeric items out to various places on forms and inside labels on those forms. I want the data to align (right justify) so that all the dollar amounts align properly. I have two decimal places (cents) that I want to be aligned vertically in each column. I can get the data to print accurately, I just cannot get it to format or align properly.

Here is my problem:

On forms -- I can't get the information to right justify when I print the data directly to a form with the Print Tab(x) feature. I can get information to left justify but that is all.

On labels -- I can't get information inside labels to always print two decimal places for currency (etc.). twenty five dollars rounds off to 25 with no decimal places. But, I want it to appear as $25.00 or 25.00 without the dollar sign.

I'm printing out data and dollar amount information in columns and I want it to align it on the decimal place (always two decimal places).

I've done a number of searches now over the last few days and have looked in my manuals and have looked online and I've even played with the attributes of labels and forms but have not had any success. This HIT-MISS methodology is getting old and time consuming.

Anyone have any suggestions or would someone direct me to a site that can explain this in simple terms?

Thank you in advance for any assistance.

Printing Data From A Listbox Using Loop But Problem In Alignment
Hi,

I have a problem when printing data from a listbox.I have 4 listboxes and i want those data to appear same as it looks on the form.

Sample:


List1 List2 List3
1 Fat Male
2 Thin Female
3 Very Nice Female
4 Friendly Male


but when i print, it looks like this in the paper:

List1 List2List3
1 FatMale
2 ThinFemale
3 Very NiceFemale
4 FriendlyMale

I need to set a specific distance for every row but it varies as the data in list2 varies.
I'm using this code.
For listword = 0 To List1.ListCount - 1
Printer.Print List1.List(listword) & " " & List2.List(listword) & " " & List3.List(listword) & " " & List4.List(listword)

Please help!

Thanks!

How Can Make Center Part Of Form Appear Scroll Bar When Center Element Are Too Many?
How can make center part of form appear scroll bar when center element are too many..??

Center
Using API to get the open save dialog box....

But everytime it opens it is sitting on the left upper position..i want it to be centered...any way to center this box ?

Jon

Center
Is there anyway you can make everything in a lsit box centered in the middle?Thx yall its very much appreciated

Can I Center This?
Is there a way to center on screen the "Windows Commom Dialogs", like "Printer" and "Browse for folder" dialog?

Thanks.

Sorry my English, I'm a Brazillian.

Alignment
Hey everyone,

I am a newby to VB and I am having a problem with my app.
the form is set for a size of 1024 X 768...
In the form I have a webbrowser set at the TOP of the form and it is 1024 X 691

FIRST PROBLEM: Even though I have "align controls to grid" OFF it still snaps the height to 690.969????

SECOND PROBLEM: I also have an image right below the webbrowser and they will NOT line up... It seams as thought there is a border around the webbrowser.

Any Ideas???

-Dave

Alignment
Hey,

Im making a basic 3D car-demo in DirectX8 and I have the car and wheels from seperate .x meshes. Now I want to align the wheels aligned to the car, any ideas?


Code:
D3DXMatrixTranslation matTrans, modCar.tCar(0).X, 0.5, modCar.tCar(0).Z
D3DXMatrixMultiply modDXMesh.tMesh(modCar.tCar(0).meshWheel(0)).matMesh, modDXMesh.tMesh(modCar.tCar(0).meshWheel(0)).matMesh, matTrans
Check the attactments how it is displayed when moving the wheel just to the car origin and i think you see how i would like them fitted into the cut-outs in the car.

Alignment Help!
Hello I am building a program that has 4 other forms load on top of it (floating tool menus) and i need them to load in a certain spot each time. and when a button is clicked switched to a different position. how would i do that? any help is greatly appreciated!

In further depth, lets say the program loads and they are put in a certain spot. But i go to Tools > Align Menus Right and they will all go to the top right. i used to know this and i feel stupid for asking but it has been so long.

Need Alignment Help
ok i have program, Im trying to make its so labor cost /parts cost/total cost all line up to the right

Dim str_customername As String 'Name of customer
Dim num2 As Single 'Hours of Labour
Dim num3 As Single 'Cost of parts and suplies

str_customername = customername
num2 = hours
num3 = cost
a = 35 'hourly labour cost
b = 1.05 'sales tax
c = num2 * (a) 'totals labour cost
d = num3 * (b) 'totals parts cost
picoutput.Print "Customer"; " "; customername
picoutput.Print "Labor Cost"; " "; FormatCurrency$(c) 'Labour cost in dollars
picoutput.Print "Parts Cost"; " "; FormatCurrency$(d) 'parts cost in dollars
picoutput.Print "Total Cost"; " "; FormatCurrency$(d + c) 'total cost of repairs
End Sub

Alignment
i have a flexgrid that has been populated with data from the database. To my observation all the data in columns in the flexgrid are align center.. how do i change the alignment?

UDT Alignment
I'm about to play around with ReadDirectoryChanges which requires a FILE_NOTIFY_INFORMATION type aligned on a DWORD boundary. How does one ensure the alignment?

EDIT: Actually it's just a Buffer whos format is defined by the type, so the problem really is how do I ensure that a Byte Array is aligned on a DWORD boundary? (Don't suppose VB does it anyway does it?)

Rtf Alignment
I have a rtf file that gets populated by 2 combo boxs
Combo1 contains paragraphs that are added to the rtf
Combo2 contains sentences that are added to the end of the paragraph one at a time
This works fine until a paragraph is indented then the sentences do not line up.
The sentences are always put at the very beggining of a line and do not line up like this:

Code:
Paragraph
Sentence
another sentence


How can i make the sentences line up with the paragraph?

What Is With The Alignment?
I'm toggling between two child forms and but when I go to the second form, it moves down for some reason...if I load the second form first and click to the first...the first moves down.

Alignment
hey! i just cannot seem to fix this tried evrything

i am using this statenment for left. right and center alignment

Case "center"
If SOP.scopetxt.SelLength > 0 Then
SOP.scopetxt.SelAlignment = rtfCenter
scopetxt.SetFocus
'End If
ElseIf SOP.summtxt.SelLength > 0 Then.......
same goes for rest of the txtboxes..

Case "left"
If SOP.scopetxt.SelLength > 0 Then
SOP.scopetxt.SelAlignment = rtfleft
scopetxt.SetFocus
'End If
ElseIf SOP.summtxt.SelLength > 0 Then.......
same goes for rest of the txtboxes..


Case "right"
If SOP.scopetxt.SelLength > 0 Then
SOP.scopetxt.SelAlignment = rtfright
scopetxt.SetFocus
'End If
ElseIf SOP.summtxt.SelLength > 0 Then.......
same goes for rest of the txtboxes..

but it just works with either first rtbox or works with all at the same time.....please tell me what am i doing wrong.....
...same happens with paste command if i cut something from 1 box and try to paste it in another it pastes in everybox....

thanks in advance!

Tab Alignment.
Private Sub command1_click()

Dim ABC, DEF, GHI, JKL As String
Dim i As String

ABC = "Have "
DEF = "A "
GHI = "Nice "
JKL = "Day "

i = ABC & DEF & GHI & JKL

MsgBox i

End Sub

When the button is clicked it gives a messageBox saying 'Have a nice day '.
The values within ABC, DEF, GHI, JKL will keep on changing in the application I'm writing.
And the values are automatically written in the Log File which is a notepad file. Even that is done
The problem is, that everytime the process runs, the values changes and the log comes
out in a diferrent tab layout. Its not aligned properly. Each time the process runs, the
values changes, and the output in the notepad comes some in all sorts of different
alignment. Some of the name are 6 characters long, some of them 2 characters long. I wanted
to know whether i can come up with a code which can align the log, each tim eits written
and I don't have to align it. The values within variables should append on the same tab
as previous one. can you help?.... waiting of ryour response. thank you..

Alignment In 95
I'm developing on a win 2000 machine, and in my app I have some of my text boxes right justified as they contain currency. Works correctly on my machine, and works correctly when installed on a 98 machine, but when installed on a 95 machine any justifications I have set are lost.

Why? How can I stop this?

Alignment PLZ HELP!
I am making a tab editor(like drums, not 'Tabs'), but I can't seem to align text.. I need "/" to line up.
Example of Tab: TAB
That's not a bad tab, but there are some out there. You notice the "/"'s line up? is there a type of format?
Here's what I had:
Code:
Data = Form1.txtEdit.Text
Data = Replace(Data, " ", "")
Form1.txtEdit.Text = Data

That gets rid of the spaces, but then it can take the tab out of line. Thats why I need a sub for aligning the "/" text. any ideas?

[EDIT]: The "/" is screwed up on this forum... it should be the character when you press SHIFT + (The key above ENTER)



Edited by - Jonotron on 5/14/2005 12:51:57 PM

Alignment
I wanted to know what is the code for center alignment for data in a range. In VBA code. I did alignment = center and it didn't work. Any help will be appreciated. thanks

Printing Printing Printing Printing Report Confused Help
Hey guys,

I want to print following bill. It has already been printed.
I want to fill some data in it and want to print it.

Have a look at attached image of the bill.
Dimensions are given too.

I tried with data report.
I put total field in report footer and send the value of this field from code itself.
But if there are 2 items then total field prints immediately after that.
whereas it should be printed at the bottom in front of the word TOTAL(printed in bill).

How to get it at right position?

How can I maintain the margins and dimensions each side?

Will data report do? or anything else should be right for doing this.

Help me people.

PLZ.

Kakadia.

Form At Center
I need another way to put the form at the center of the screen, other than startupposition.
I need somthing like
me.top = (THE CENTER)
me.left=(THE CENTER)

how to find it, think there is the screen command or something?

Center An Object
Hello,

I wanted to know if i want to place a label or an object in the centre of form or picture box then what should i do.

Like different systems have different resolutions. So if i want a label to appear in the center of a picturebox or form what statement can help me to do so.

Thank You,
Greatchap

Center Window
hi

I want when I strat a form no mather what is the screen resolution the form to be in the center. Is there something like that. thankz in advance

toni

Center Of A 3d Circle
hello all,
its been a while since i've posted. what im working on now is im trying to find the center of a 3d circle. i have searched the net and havn't found anything that was dumbed down enough for me to comprehend. any help or suggestions?
thanks
briar

Copyright © 2005-08 www.BigResource.com, All rights reserved