|
-
Jun 6th, 2012, 01:01 PM
#1
[RESOLVED] Setting Form Size to Anything Smaller Than 132 x 38
How do we set a form size smaller than 132 x 38 pixels?
I would prefer any native vb.net way (if possible) over use of any windows API.
-
Jun 6th, 2012, 01:05 PM
#2
Re: Setting Form Size to Anything Smaller Than 132 x 38
try removing the titlebar
edit: + the controlbox + set borderstyle to none
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 6th, 2012, 01:08 PM
#3
Re: Setting Form Size to Anything Smaller Than 132 x 38
There is no Title Bar. But I'm not able to set the size smaller than this. When I do, it simply ignores it and resizes to this value. It looks like this is the minimum size we can set. Or I think I'm missing something.
-
Jun 6th, 2012, 01:09 PM
#4
Re: Setting Form Size to Anything Smaller Than 132 x 38
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 6th, 2012, 01:12 PM
#5
Re: Setting Form Size to Anything Smaller Than 132 x 38
OK.. I think I got it. Setting the FormBorderStyle to None does it. But I need the borders (Fixed Single). So?
-
Jun 6th, 2012, 01:13 PM
#6
Re: Setting Form Size to Anything Smaller Than 132 x 38
Have you set the BorderStyle to none?
Edit: Damn!!! I need to refresh before posting Sorry was testing it...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Jun 6th, 2012, 01:14 PM
#7
Addicted Member
Re: Setting Form Size to Anything Smaller Than 132 x 38
Why do you need the form smaller then that? There might be an easier work around.
-
Jun 6th, 2012, 01:21 PM
#8
Re: Setting Form Size to Anything Smaller Than 132 x 38
Set control box to false and text to blank
I placed a small button top left of the form with this code I was using the toolwindow border style but it should work with other styles as well.
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Me.Width > 200 Then
Me.Width = 50
Me.Height = 15
Else
Me.Width = 520
Me.Height = 225
End If
End Sub
-
Jun 6th, 2012, 01:22 PM
#9
Re: Setting Form Size to Anything Smaller Than 132 x 38
vb Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = ""
Me.ControlBox = False
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim r As Rectangle = Me.ClientRectangle
r.Height -= 1
ControlPaint.DrawBorder(e.Graphics, r, Color.Black, ButtonBorderStyle.Solid)
End Sub
End Class
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 6th, 2012, 01:26 PM
#10
Re: Setting Form Size to Anything Smaller Than 132 x 38
I did a few more tests and the code I posted above does not work with the fixed single border style but does work fine with the FixedToolWindow style
-
Jun 6th, 2012, 01:46 PM
#11
Re: Setting Form Size to Anything Smaller Than 132 x 38
Setting it to FixedToolWindow gives me the effect I was looking for. 
I really didn't want to mess around with the Paint event, since the form is doing a few weird things and would start having refresh issues.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|