Results 1 to 5 of 5

Thread: Form.Height?

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Form.Height?

    I'm trying to move a command button to the buttom of a form, but sounds like I'm having a problem

    btnAdd.Location = New Drawing.Point(360, Me.Height - btnAdd.Height)

    This way the button will be outside the form, but if I use this code instead, it will work
    btnAdd.Location = New Drawing.Point(360, Me.Height - btnAdd.Height - 30)


    Why do I have to subtract 30 pixels? is that for the titlebar perhaps?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Hyperactive Member
    Join Date
    Dec 2001
    Location
    Dublin, Ireland
    Posts
    262
    Here's how I place button on a form using Me.ClientSize as the best way imho:-

    Dim btn as New Button
    'place on bottom-left
    btn.Top = Me.ClientSize.Height - btn.Height
    btn.Left = 0
    btn.Text = "Bottom"
    Me.Controls.Add(btn)
    'place on bottom-right
    btn = New Button()
    btn.Top = Me.ClientSize.Height - btn.Height
    btn.Left = Me.ClientSize.Width - btn.Width
    btn.Text = "Bottom-Right"
    Me.Controls.Add(btn)
    'place on top-left
    btn = New Button()
    btn.Top = 0
    btn.Left = 0
    btn.Text = "Top-Left"
    Me.Controls.Add(btn)
    'place on top-right
    btn = New Button()
    btn.Top = 0
    btn.Left = Me.ClientSize.Width - btn.Width
    btn.Text = "Top-Right"
    Me.Controls.Add(btn)

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    tnx alot, worked
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4
    Member BinaryAnge's Avatar
    Join Date
    Jun 2002
    Location
    Columbus,Ohio
    Posts
    51

    This way works

    I dont think the way above works try 1 of these insted, which one is just a matter of choice

    Dim B As New Button()
    Dim P As New PointF(100.0, 100.0)
    B.Text = "Button"
    B.Location = B.Location.Ceiling(P)
    Me.Controls.Add(B)

    or

    Dim B As New Button()
    B.Text = "Button"
    B.Location = B.Location.Ceiling(New PointF(100.0, 100.0))
    Me.Controls.Add(B)

    I know for a fact, these ways work

  5. #5
    Member BinaryAnge's Avatar
    Join Date
    Jun 2002
    Location
    Columbus,Ohio
    Posts
    51

    this is the easiest

    i almost forgot this way is the easiest

    Dim B As New Button()
    B.Text = "Button"
    B.Location = New Point(500, 100)
    Me.Controls.Add(B)

    the other ways use the "ceiling" which rounds "pointf", this way you can just plot with a point.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width