Click here to Skip to main content
16,006,378 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionReplace-Funktion for controlcollection Pin
User 584223728-Apr-09 7:50
User 584223728-Apr-09 7:50 
AnswerRe: Replace-Funktion for controlcollection Pin
Dave Kreskowiak28-Apr-09 8:57
mveDave Kreskowiak28-Apr-09 8:57 
AnswerRe: Replace-Funktion for controlcollection Pin
Alan Burkhart28-Apr-09 18:46
Alan Burkhart28-Apr-09 18:46 
QuestionInserting into a link table when inserting using a grid Pin
Ekjon28-Apr-09 6:59
Ekjon28-Apr-09 6:59 
AnswerRe: Inserting into a link table when inserting using a grid Pin
Ekjon28-Apr-09 8:05
Ekjon28-Apr-09 8:05 
QuestionDataGridView - Date column [Get Input format dd/MM/yyyy] Pin
Paramu197328-Apr-09 6:39
Paramu197328-Apr-09 6:39 
AnswerRe: DataGridView - Date column [Get Input format dd/MM/yyyy] Pin
Mycroft Holmes28-Apr-09 15:57
professionalMycroft Holmes28-Apr-09 15:57 
QuestionResize text to fill textbox? Pin
Garfunkiel28-Apr-09 6:34
Garfunkiel28-Apr-09 6:34 
Basically, my goal is to get a multiline TextBox or a RichTextBox to resize the font of its text until all of the text can be seen. The following code works to make the text fit on one line, but I am not sure how to change it to work for multiple lines.
Public Shared Function BestFontSize(ByVal g As Graphics, _
ByVal z As Size, ByVal f As Font, ByVal s As String) As Single

        Dim p As SizeF
        p = g.MeasureString(s, f)
        Dim hratio As Double = z.Height / p.Height
        Dim wratio As Double = z.Width / p.Width
        Dim ratio As Double = Math.Min(hratio, wratio)
        System.Console.WriteLine(f.Size * ratio)
        Return f.Size * ratio
    End Function
    Private Sub TextBox1_TextChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        If TextBox1.Text <> "" Then TextBox1.Font = New Font(TextBox1.Font.FontFamily, _
            BestFontSize(TextBox1.CreateGraphics, TextBox1.Size, TextBox1.Font, TextBox1.Text))
    End Sub

Is there a way to determine which characters are actually visible on screen? Any ideas on a better way to do this?
AnswerRe: Resize text to fill textbox? Pin
Dave Kreskowiak28-Apr-09 6:53
mveDave Kreskowiak28-Apr-09 6:53 
AnswerRe: Resize text to fill textbox? Pin
Luc Pattyn28-Apr-09 6:55
sitebuilderLuc Pattyn28-Apr-09 6:55 
QuestionHow to implement UNDO/REDO in vb.net windows Pin
dilipmca0428-Apr-09 5:06
dilipmca0428-Apr-09 5:06 
AnswerRe: How to implement UNDO/REDO in vb.net windows Pin
Henry Minute28-Apr-09 5:14
Henry Minute28-Apr-09 5:14 
AnswerRe: How to implement UNDO/REDO in vb.net windows Pin
0x3c028-Apr-09 5:45
0x3c028-Apr-09 5:45 
AnswerRe: How to implement UNDO/REDO in vb.net windows Pin
Dave Kreskowiak28-Apr-09 6:48
mveDave Kreskowiak28-Apr-09 6:48 
QuestionX - Key as a shortcut creates problem when typing. Pin
Atul Kharecha28-Apr-09 2:38
Atul Kharecha28-Apr-09 2:38 
AnswerRe: X - Key as a shortcut creates problem when typing. Pin
Jay Royall28-Apr-09 2:44
Jay Royall28-Apr-09 2:44 
GeneralRe: X - Key as a shortcut creates problem when typing. Pin
Atul Kharecha28-Apr-09 2:51
Atul Kharecha28-Apr-09 2:51 
GeneralRe: X - Key as a shortcut creates problem when typing. Pin
Jay Royall28-Apr-09 2:58
Jay Royall28-Apr-09 2:58 
AnswerRe: X - Key as a shortcut creates problem when typing. Pin
Tom Deketelaere28-Apr-09 2:46
professionalTom Deketelaere28-Apr-09 2:46 
GeneralRe: X - Key as a shortcut creates problem when typing. Pin
Atul Kharecha28-Apr-09 3:58
Atul Kharecha28-Apr-09 3:58 
GeneralRe: X - Key as a shortcut creates problem when typing. Pin
Luc Pattyn28-Apr-09 4:05
sitebuilderLuc Pattyn28-Apr-09 4:05 
GeneralRe: X - Key as a shortcut creates problem when typing. Pin
Tom Deketelaere28-Apr-09 4:16
professionalTom Deketelaere28-Apr-09 4:16 
QuestionCropping a High Resolution Image in VB.Net 2008 Pin
wkitlam28-Apr-09 1:22
wkitlam28-Apr-09 1:22 
AnswerRe: Cropping a High Resolution Image in VB.Net 2008 Pin
Luc Pattyn28-Apr-09 1:27
sitebuilderLuc Pattyn28-Apr-09 1:27 
GeneralRe: Cropping a High Resolution Image in VB.Net 2008 Pin
wkitlam29-Apr-09 22:37
wkitlam29-Apr-09 22:37 

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.