473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Control resize and positioning at run time. VB.Net

Can any one help me, regarding resizing and positioning a control at run time in VB.Net.
Nov 10 '08 #1
1 22565
joedeene
583 512MB
Can any one help me, regarding resizing and positioning a control at run time in VB.Net.
Well, to start off with, you can set the control's size by using the Control.Size Property. Also, you can set the position(or location I think you are referring to) by using the Control.Location Property.

Here's a sample code to increase a button's, the control's, size each time you click on the button.

Expand|Select|Wrap|Line Numbers
  1.         private void button1_Click(object sender, EventArgs e)
  2.         {
  3.             button1.Size = new Size(button1.Width + 5, button1.Height + 5);
  4.         }
  5.  
To change the location of the control, the following code may be useful: It changes the location by adding 5 pixels to both the button's X and Y coordinates.

Expand|Select|Wrap|Line Numbers
  1.         private void button1_Click(object sender, EventArgs e)
  2.         {
  3.             button1.Location = new Point(button1.Location.X + 5, button1.Location.Y + 5);
  4.         }
Those are just sample snippets to get you familiar with using those properties. I'd also like to point out that you've posted this in the wrong forum. So, I will ask an Admin to move it to the proper forum. Please read thoroughly through the Posting Guidelines as you are a new member.

Also, I just noticed you're in VB.NET, and I've given code in C#. If you cannot translate the code off hand then have a look at this site as it will help you in comparing the differences between the two languages and help you translate it.

joedeene
Nov 10 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: cefrancke | last post by:
I have a Tab control containing pages and many other controls. I would like to set the position of the tab control during Load or Open (btw, where is the place to do this?). During Design Time,...
1
by: Jink Welby | last post by:
Can anyone tell me how to create at ActiveX control ar run-time in code without using a form? I want to instantiate and use the control from within a non-visual class. Please help! Thanks in...
0
by: obj | last post by:
Dear all: My english is poor.forgive me. i use GDI+ class in my MFC program.I want to do resize the Bitmap.But I have a importance point of time of execution of Resize Bitmap. I use c# to...
2
by: Karl | last post by:
Can anyone tell me how to add a required field validator control at run-time? I have a form that the textbox controls are all added at run-time. This all works fine. When I add a validator...
0
by: Zorpiedoman | last post by:
Get your expert hat on.... I've created a UserControl which inherits ContainerControl. When I drop another control onto this control in design time view, I want to rename the new control and...
4
by: AB | last post by:
Hi All, I would like to add controls that stored in DB dynamically, and I don't know their names or their number. The names of the controls is important therefore I can't create cmbArr(0),...
0
by: Kasey | last post by:
In my application I don't want the operator to have access to the operating system. Can I call the control panel date/time from inside my application and have the operator change the date/time and...
1
by: --== Alain ==-- | last post by:
Hi, I still have problem updating my custom control at design time. When i change a property of my custom control in the property window, i would like to see this change immediately on my custom...
1
by: =?Utf-8?B?QnJldHQ=?= | last post by:
I have a basic user control that I want to localize. I created a global resource and connected up the properties I want to localize using an explicit localization expression. Everything works...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.