473,405 Members | 2,310 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,405 software developers and data experts.

Make a control sizable.

Is it possible to make a user control sizable, so that when the program is running, it can be resized?

--
I am a 14 year old C# developer, I am completely self taught, so please don't get mad if I ask a stupid question. Thanks.
Nov 16 '05 #1
3 3275
Bill English wrote:
Is it possible to make a user control sizable, so that when the program is running, it can be resized?


I guess you mean giving the user ability to resize a control.
Hmmm...
The first thing I though of...

Make a new panel lets say size 50x20 px, with a border so you can see it. In the panel create a button slightly smaller, lets say
48x18 px. Anchor the button on all four sides to the panel.

Now for the event handlers:

(On mouse down on the panel)
resising = true;
note the mouse position.

(on mouse move on the panel)
if resizing is true
start resizing the panel depending on how much the mouse poition changed

(on mouse up)
if resizing
resizing = false;

Obviously I didnt test this. This is just what I thought of, but you could try this. Also, if you need any clarification, ask,
I'll be happy to help.

Just in case you meant resizing the button from with the code.
yourButton.Width = 50;
yourButton.Heigh = 20;

Hope this helps.
Nick Z.
Nov 16 '05 #2
> I am completely self taught, so please don't get mad if I ask a stupid
question. Thanks.

Amigo, we're all completely self-taught. Welcome to the club, and have fun.

Tom Dacon
Dacon Software Consulting
Nov 16 '05 #3
Placing the control in a panel was a great idea thanks. I'll try to make it look nice and have different cursors for the panel mouse enter. Thanks Again.
--
I am a 14 year old C# developer, I am completely self taught, so please don't get mad if I ask a stupid question. Thanks.
"Nick" wrote:
Bill English wrote:
Is it possible to make a user control sizable, so that when the program is running, it can be resized?


I guess you mean giving the user ability to resize a control.
Hmmm...
The first thing I though of...

Make a new panel lets say size 50x20 px, with a border so you can see it. In the panel create a button slightly smaller, lets say
48x18 px. Anchor the button on all four sides to the panel.

Now for the event handlers:

(On mouse down on the panel)
resising = true;
note the mouse position.

(on mouse move on the panel)
if resizing is true
start resizing the panel depending on how much the mouse poition changed

(on mouse up)
if resizing
resizing = false;

Obviously I didnt test this. This is just what I thought of, but you could try this. Also, if you need any clarification, ask,
I'll be happy to help.

Just in case you meant resizing the button from with the code.
yourButton.Width = 50;
yourButton.Heigh = 20;

Hope this helps.
Nick Z.

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Matthew Hanna | last post by:
Hello All! I have a control that just acts on its own to save various properties concerning the form it is placed on. When the form unloads the control saves the current properties including...
1
by: MrNobody | last post by:
I want to have a DataGrid that fills up the entire Window but does not slip underneath a StatusBar along the bottom... currently I first set Anchor to AnchorStyles.Bottom then the Dock to...
3
by: Ron Vecchi | last post by:
I have a situation where I need to make PlaceHolderA equal to PlaceHolderB and keep the contents of PlaceHolderB after PlaceHolderA has been destroyed. is this possible seeing that it is a...
6
by: Selden McCabe | last post by:
I have a form with a bunch of image buttons. When the user moves the mouse over a button, I want to do two things: 1. change the Imagebutton's picture, and 2. make another control visible. I'm...
6
by: Kishan Hathiwala | last post by:
Can anyone show me how to make control array like created in vb6? I am making one program in vb.net 2002 using winsock control (provided with vb6). so whenever new connection request comes, it...
3
by: Bill | last post by:
I have a report with a text box named Discount. If this text box shows a value of 0, I do not want the text box to be visible. I have tried the following code, but it disables the control even...
6
neo008
by: neo008 | last post by:
Hi All, I want control box of my MDI form Invisible. I dont want user to click on cross button to exit. I tried Unload events but I dont find it suitable for my project. Can somebody help?...
2
by: =?Utf-8?B?QXR1bCBSYW5l?= | last post by:
I have one panel in which i have my control, know i want to move it at run time using mouse.
3
by: DelphiCoder | last post by:
I wrote a gallery div where you see a photo, and at the top right corner of the photo I have images of arrows to go back and forth to see other photos, along with other controls. My question is:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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.