hi,
i was trying to save the window size of my app using the generated
Settings class of Visual C# 2005 Express. for some reason, the stored
size was bigger from the actual size, so each time i start the app, it's
bigger than before, until it fills the screen (1024*768). the odd thing
is, that it works just fine in the IDE, and if i install it on a
different computer, and even if i use the executable produced by the IDE
instead of the one deployed by the MSI file compiled by the deployment
project.
since i have the Express edition at home, i took the app project to
work, and added a deployment project to the solution there, with a Team
Suite edition. then i ran the MSI on the work machine, and it worked
just fine (with higher resolution). when i took the MSI back home and
installed it, i received the symptom i described.
as mentioned in the subject, the actual value saved was that of the
form's ClientSize property. in the debugger, it seems like the expected
size is loaded, and then saved correctly. only outside the IDE it acts
weird.
i don't know how important that is, but this is an upgrade from a
previous version. the machine at work didn't have the previous version,
which was based on .NET 1.1. my home machine did, and this version,
based on .NET 2.0, seems to have upgraded it cleanly, except for that
problem.
here's some code:
in the form's constructor:
ClientSize = Settings.Default.ClientSize;
in a method called from the OnFormClosing() override:
Settings.Default.ClientSize = ClientSize;
Settings.Default.Save();
Tsahi 3 2540
* Tsahi Asher wrote, On 29-7-2007 23:39:
hi,
i was trying to save the window size of my app using the generated
Settings class of Visual C# 2005 Express. for some reason, the stored
size was bigger from the actual size, so each time i start the app, it's
bigger than before, until it fills the screen (1024*768). the odd thing
is, that it works just fine in the IDE, and if i install it on a
different computer, and even if i use the executable produced by the IDE
instead of the one deployed by the MSI file compiled by the deployment
project.
since i have the Express edition at home, i took the app project to
work, and added a deployment project to the solution there, with a Team
Suite edition. then i ran the MSI on the work machine, and it worked
just fine (with higher resolution). when i took the MSI back home and
installed it, i received the symptom i described.
as mentioned in the subject, the actual value saved was that of the
form's ClientSize property. in the debugger, it seems like the expected
size is loaded, and then saved correctly. only outside the IDE it acts
weird.
i don't know how important that is, but this is an upgrade from a
previous version. the machine at work didn't have the previous version,
which was based on .NET 1.1. my home machine did, and this version,
based on .NET 2.0, seems to have upgraded it cleanly, except for that
problem.
here's some code:
in the form's constructor:
ClientSize = Settings.Default.ClientSize;
in a method called from the OnFormClosing() override:
Settings.Default.ClientSize = ClientSize;
Settings.Default.Save();
My guess is that you have to set the ClientSize in the Form.Show event,
or after the InitializeComponent in the Form.Load event has run. The
constructor is too early in the forms lifecycle. Otherwise it'll just
get overridden.
Jesse
φιθεθ Jesse Houwing:
* Tsahi Asher wrote, On 29-7-2007 23:39:
>hi, i was trying to save the window size of my app using the generated Settings class of Visual C# 2005 Express. for some reason, the stored size was bigger from the actual size, so each time i start the app, it's bigger than before, until it fills the screen (1024*768). the odd thing is, that it works just fine in the IDE, and if i install it on a different computer, and even if i use the executable produced by the IDE instead of the one deployed by the MSI file compiled by the deployment project.
since i have the Express edition at home, i took the app project to work, and added a deployment project to the solution there, with a Team Suite edition. then i ran the MSI on the work machine, and it worked just fine (with higher resolution). when i took the MSI back home and installed it, i received the symptom i described.
as mentioned in the subject, the actual value saved was that of the form's ClientSize property. in the debugger, it seems like the expected size is loaded, and then saved correctly. only outside the IDE it acts weird.
i don't know how important that is, but this is an upgrade from a previous version. the machine at work didn't have the previous version, which was based on .NET 1.1. my home machine did, and this version, based on .NET 2.0, seems to have upgraded it cleanly, except for that problem.
here's some code: in the form's constructor:
ClientSize = Settings.Default.ClientSize;
in a method called from the OnFormClosing() override:
Settings.Default.ClientSize = ClientSize; Settings.Default.Save();
My guess is that you have to set the ClientSize in the Form.Show event,
or after the InitializeComponent in the Form.Load event has run. The
constructor is too early in the forms lifecycle. Otherwise it'll just
get overridden.
Jesse
thanks, getting that at the OnLoad event override fixed the problem.
tsahi
* Tsahi Asher wrote, On 30-7-2007 22:51:
φιθεθ Jesse Houwing:
>* Tsahi Asher wrote, On 29-7-2007 23:39:
>>hi, i was trying to save the window size of my app using the generated Settings class of Visual C# 2005 Express. for some reason, the stored size was bigger from the actual size, so each time i start the app, it's bigger than before, until it fills the screen (1024*768). the odd thing is, that it works just fine in the IDE, and if i install it on a different computer, and even if i use the executable produced by the IDE instead of the one deployed by the MSI file compiled by the deployment project.
since i have the Express edition at home, i took the app project to work, and added a deployment project to the solution there, with a Team Suite edition. then i ran the MSI on the work machine, and it worked just fine (with higher resolution). when i took the MSI back home and installed it, i received the symptom i described.
as mentioned in the subject, the actual value saved was that of the form's ClientSize property. in the debugger, it seems like the expected size is loaded, and then saved correctly. only outside the IDE it acts weird.
i don't know how important that is, but this is an upgrade from a previous version. the machine at work didn't have the previous version, which was based on .NET 1.1. my home machine did, and this version, based on .NET 2.0, seems to have upgraded it cleanly, except for that problem.
here's some code: in the form's constructor:
ClientSize = Settings.Default.ClientSize;
in a method called from the OnFormClosing() override:
Settings.Default.ClientSize = ClientSize; Settings.Default.Save();
My guess is that you have to set the ClientSize in the Form.Show event, or after the InitializeComponent in the Form.Load event has run. The constructor is too early in the forms lifecycle. Otherwise it'll just get overridden.
Jesse
thanks, getting that at the OnLoad event override fixed the problem.
tsahi
You're welcome.
Jesse This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: K.N.Ranjit |
last post by:
Here's my coding again:
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\Documents...
|
by: Xwire |
last post by:
Can anyone explain why when i set the .ClientSize of a form, and then check
the .ClientSize when the resize event fires, it is slightly off, generally
20(varys) pixels in the height but not...
|
by: Philip Wagenaar |
last post by:
I have made a form with a tab that containts groupboxes and those contain
checkboxes.
When I run the application sometimes the outlining for some groupboxes are
not shown, if I switch tabs and...
|
by: Patrick Lioi |
last post by:
We have form that is used as the base class of all of our forms, let's
call it BaseApplicationForm. We have another form, say
ChildApplicationForm that inherits from BaseApplicationForm.
The...
|
by: Paul |
last post by:
I have a windows form with ApplicationSettings bound to the location,
clientsize, and windowstate. Theses settings were created and stored
using the settings designer. The location, for instance,...
|
by: Galen Somerville |
last post by:
My current screen resolution is set to 1024 x 768. My form size always comes
up as 1032 x 748.
I have tried the help sample
' Retrieve the working rectangle from the Screen class
' using the...
|
by: =?Utf-8?B?bGpsZXZlbmQy?= |
last post by:
I want to implement the following:
If the user clicks on the border of a form, then I want to show a box around
the form that represents the form's bounds. As the user moves the mouse only
the...
|
by: =?Utf-8?B?VHJhY2tz?= |
last post by:
Does the toolstripcontainer etc work at all?
I want to save the settings for the toolstrip positions in my app so they
start up with the saved positions.
Tried using:
...
|
by: RobEveryThingIsPossible |
last post by:
IN VISTA
MS Access 2000 Printer Settings Not Saving With Vista Bus.
The printer settings (Label or Env.) keep on change back to another setting after saving them on a report or form, when...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
| |