I have design a window application form in 1440X900pixel resolution(which I dont aware of this could cause a problem). When I move this application to other PC with different resolution(or shows on a projector that only support low resolution), thing change nasty, all the control is out of shape. Any Idea, hints to workaround?I do notice there is a "AutoScaleMode" in the form properties, but dont know how to make use of it.
Another proplem is, I have a printpreview function in my application which preview the contains of the richtextbox. When the loaded rtf file is around 2MB, The generating preview process become terrible slow(roughly 3sec per page).Is it normal?
Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
' page that will be printed
Static intCurrentChar As Int32 = 0
' declaring a static variable to hold the position of the last printed char
Dim font As New Font("Calibri", 8)
' initializing the font to be used for printing
'If PrintDocument2.DefaultPageSettings.Landscape Then
' Dim intTemp As Int32
' intTemp = PrintAreaHeight
' PrintAreaHeight = PrintAreaWidth
' PrintAreaWidth = intTemp
' ' if the user selects landscape mode, swap the printing area height and width
'End If
Dim intLineCount As Int32 = CInt(PrintAreaHeight / font.Height)
' calculating the total number of lines in the document based on the height of
' the printing area and the height of the font
Dim rectPrintingArea As New RectangleF(marginLeft, marginTop, PrintAreaWidth, PrintAreaHeight)
' initializing the rectangle structure that defines the printing area
Dim fmt As New StringFormat(StringFormatFlags.LineLimit)
'instantiating the StringFormat class, which encapsulates text layout information
Dim intLinesFilled, intCharsFitted As Int32
e.Graphics.MeasureString(Mid(Form1.l.RichTextBox1.SelectedText, intCurrentChar + 1), font, New SizeF(PrintAreaWidth, PrintAreaHeight), fmt, intCharsFitted, intLinesFilled)
' calling MeasureString to determine the number of characters that will fit in
' the printing area rectangle
e.Graphics.DrawString(Mid(Form1.l.RichTextBox1.SelectedText, intCurrentChar + 1, intCharsFitted), font, Brushes.Black, rectPrintingArea, fmt)
' print the text to the page
intCurrentChar += intCharsFitted
'advancing the current char to the last char printed on this page
'If intCurrentChar < PrintString.Length Then
If intCurrentChar < Form1.l.RichTextBox1.SelectedText.Length Then
'Remove printed text from string
e.HasMorePages = True
Else
e.HasMorePages = False
'Restore string after printing
intCurrentChar = 0
End If
End Sub
Any help/hint/guide will be greatly wellcome^o^