Is there any auto re-size property of form in vb6 with respect to the control size ?
like this.Auto Size = false in c# ?
Your question can be interpreted in more than one way.
If you are asking if controls can be set to automatically resize in VB6 forms then the answer is no, resizing controls when the form resizes has to be done in code. It's not that hard if you're careful about how you design the form.
If you are asking if there is a way to set whether or not a form can be resized then you can use the BorderStyle property of the form, there are various options depending on what you want.
Related
I'm needing some assistance with what I can tell a vendor developing a form in an application I don't have the source to. We've found a bug with one of their large Winforms where if it's opened in an RDP session at 1024x768, the bottom 250px or so of the form which is ~1000px high is unreachable.
They're being difficult about saying there's no solution which I know to be nonsense, but I don't have a Visual Studio environment presently set up to build a proof of concept to test for myself and then show them otherwise.
From what I can tell from other StackOverflow questions and MSDN documentation pages, something like the following should resolve the problem so the form will auto-size to the maximum displayable height then put a vertical scrollbar in to allow viewing the bottom part of the form. Will the following achieve my goal?
public MyTallForm()
{
InitializeComponent();
this.AutoScroll = true
this.AutoSize = true
}
AutoSize responds to change in controls inside the form by growing & shrinking the form as needed.
AutoScroll responds to change in controls inside the form by displaying/hiding the scrollbars.
Thus, AutoScroll won't be activated if AutoSize is active since the form is always large enough. If the problem is from too small display resolution, you'll want AutoScroll.
If the form kept open between RDP sessions, you might need to subscribe to DisplaySettingsChanged to be aware of resolution changes, and either simply Maximize (not sure if it's already maximized, toggling to Minimized and back to Maximized perhaps?) or use GetWorkingArea if you need detailed size.
Set AutoScroll = True and AutoScaleMode to Dpi In Form Properties
Hope it helps.
I am designing a form in c#. I want to specify the "Client-Area" of the form in the designer.
The Size property sets the size of the complete form, including the NC area. Is there any way to set the client area size?
Have you looked at the ClientSize property? This property allows you to modify the size of the client area of the control. Seems to be what you're looking for.
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.clientsize.aspx
This question already has answers here:
Transparency for windows forms textbox
(8 answers)
Closed 8 years ago.
I want to do textBox a Transparent Background c# .net
Visual Studio is making a mistake if you define Properties
Put this in the constructor:
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
The class need to enable the transparent style. (For some reason it isn't supported by default).
public class MyControl : System.Windows.Forms.UserControl
{
public MyControl ()
{
// Create visual controls
InitializeComponent();
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
}
}
Or if it's not a custom control:
mycontrolObject.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
More about Control.SetStyle Method
Other Control Styles
I've found a workaround for this problem, which I have on my own.
Most of what I've read over here is true. And the approaches "à la" AlphaBlendTextBox are way too complex or too time-consuming for some environments, already heavily charged.
Assume you have a given background color and a given picture or whatever you want to see through the RichTextBox control. This is what I've done (summarized):
on the main form, you place the picture, text, buttons or whatever as projected, with the proper background color and / or picture
create a new form and position it wherever appropriate
set this new form TransparencyKey to SystemColors.InactiveBorder
take care of this form border properties (FormBorderStyle to FormBorderStyle.None; ControlBox,MinimizeBox, MaximizeBox and ShowIcon to false, TopMost to true, StartPosition to FormStartPosition.Manual, SizeGripStyle to SizeGripStyle.Hide), so there's no visible form structures
create a RichTextBox with the same size of the form and located on its upper, left corner
set this box BackColor to SystemColors.InactiveBorder (remember the TransparencyKey?)
and its BorderStyle to None as well
take care of textbox contents: color(s), font(s) and strings
synchronize this form visibility with whatever you need to and... voilà! You can see your application background through whatever you write and edit on the text box!
I can't pretend this approach fits everybody, but it is way simpler than others I've seen and, as long as I can keep it that way, I do prefer the simpler solutions.
Of course, when you close the main form, you must take care of the child form, but this is pretty basic for you, isn't it?
Enjoy!
This is not an easy task. .Net TextBox control is a wrapper around Win32 Edit control, so you will need to do sub-classing to achieve background transparency.
Take a look at this sample: AlphaBlendTextBox - A transparent/translucent textbox for .NET
typically in java if you have a layout manager of somesort, when you resize the page then the components in that panel will resize accordingly. I think my app is missing some sort of layout manager to control resizing as at the moment everything is just static
Is there a way to make it resize on the changing of the form size? say the user makes the page bigger, then the componenets adjust and so on.
Thanks
.NET has layout managers as well.
Personally, I prefer the TableLayoutPanel for my WinForms apps.
Once you layout the Table (using a combination of static/dynamic sized rows/columns) you add your child controls to the table cells. Once you add your controls, you can dock or anchor the controls to the cell so that they are automatically adjusted when the window is re-sized.
Two main options:
Anchoring. Set your control to "anchor" to the sides of your form. This means that if the form resizes, the control will stay a constant distance from that side. So, if you anchor Top, Left and Right, then your control will stay in the same position, but resize horizontally with the width of the form. Play with it. It'll be obvious.
Docking. Set your control to "dock" to a side of the form, or the center. This is usually done with containers, and it will make the widget take up that entire portion of the form no matter how large it gets.
In Windows Forms you make use of the Control.Anchor property, which will cause the control to adjust accordingly when the window resizes.
To do this with windows forms you use the Anchor and Dock properties of the control
See this for a guide on how to use them
I have a Form with a TabControl on it.
Onto the TabControl TabPages are dynamically added (FYI: It's about configuration settings for different dynamical loaded modules).
Now I would like to have a way to get the Form - and/or the TabControl on the Form - to adjust its size according to the size of the added TabPage.
While writing this I realize that this could be someway more complicated than I thought: Since the different TabPages can be different in size the Form does have to change its size whenever another TabPage is selected or I have to set it to the size of the biggest TabPage once which seems to be the best approach.
Of course I could set the size programmatically by setting width and height to fitting values but first I need to know if there is no automated way to solve my problem and if not what is the best approach to realize this.
I already tried AutoSize=true which didn't solve my problem. ;)
I'm working with Visual Studio 2005 .Net 2.0 and C#.
First off it's generally considered bad UI practice to have a magically resizing form when all a user is doing is switching tabs.
With that said, I don't think you can do what you're asking to without writing code.
However it should be easy enough to determine the size of the largest control you'll be adding to the tab control, then sizing the form (before its displayed) accordingly. If you set the Anchor properties of the tab control to Ttop,left,right,bottom or set its dock to fill, you'll get the tab control to resize with the form... Of course you'll need to account for the visual padding when computing the form size from a house control.