﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Issues  » Problem with showing form...</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Wed, 03 Jun 2026 15:08:37 GMT</lastBuildDate><ttl>20</ttl><item><title>Problem with showing form...</title><link>http://forum.strataframe.net/FindPost10240.aspx</link><description>Note: I have tried the same following routine with a regular Windows application and SF Application, and the problem only occurs with SF form. Very simple to duplicate.&lt;br&gt;
&lt;br&gt;
a) Create an SF application.&lt;br&gt;
b) Stretch the form bigger than the default.&lt;br&gt;
c) Set the the "WindowState" to Minimize.&lt;br&gt;
d) Drop a "NotifyIcon" component and put the following code for the "Double Click" event:&lt;br&gt;
&lt;br&gt;
if (this.WindowState == FormWindowState.Minimized)&lt;br&gt;
{&lt;br&gt;
      this.StartPosition = FormStartPosition.CenterScreen;&lt;br&gt;
      this.WindowState = FormWindowState.Normal;&lt;br&gt;
      this.Activate();&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
When the form shows, the top left conner gets centered, rather than the form itself. Therefore, the form gets pushed to bottom right of the screen.&lt;br&gt;
&lt;br&gt;
I did the exact thing with Windows app, and it works right. I think SF creates a collection of forms in the "Program.cs" and when it tries to paint the form, it gets messed up.&lt;br&gt;
&lt;br&gt;
Can you advise please?&lt;br&gt;
Thanks!&lt;br&gt;
&lt;br&gt;</description><pubDate>Fri, 13 Jul 2007 09:55:01 GMT</pubDate><dc:creator>Ben Hayat</dc:creator></item><item><title>RE: Problem with showing form...</title><link>http://forum.strataframe.net/FindPost10264.aspx</link><description>[quote]The CenterToScreen is a method that immediately executes the code to center the &amp;#119;indow.   When you set the StartPosition it is not immediately evaluated and executed.  CenterToScreen will always work.[/quote]&lt;br&gt;
Now, how did you know this? :)&lt;br&gt;
You're "D" man! Thanks...</description><pubDate>Fri, 13 Jul 2007 09:55:01 GMT</pubDate><dc:creator>Ben Hayat</dc:creator></item><item><title>RE: Problem with showing form...</title><link>http://forum.strataframe.net/FindPost10262.aspx</link><description>[quote]Why is that?[/quote]&lt;/P&gt;&lt;P&gt;The CenterToScreen is a method that immediately executes the code to center the &amp;#119;indow.&amp;nbsp;&amp;nbsp; When you set the StartPosition it is not immediately evaluated and executed.&amp;nbsp; CenterToScreen will always work.</description><pubDate>Fri, 13 Jul 2007 09:50:40 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Problem with showing form...</title><link>http://forum.strataframe.net/FindPost10256.aspx</link><description>[quote][b]Trent L. Taylor (07/13/2007)[/b][hr]Ben,&lt;br&gt;
&lt;br&gt;
This isn't a StrataFraem issue from what I can tell because we don't do anything with the form positions. We don't stored off the loaded forms. All of this functionality is native to .NET and we do not modify it. However, you can fix your problem by adding the following code in the DoubleClick of the NotifyIcon.&lt;br&gt;
&lt;br&gt;
[codesnippet]this.WindowState = FormWindowState.Normal;&lt;br&gt;
this.CenterToScreen();[/codesnippet][/quote]&lt;br&gt;
&lt;br&gt;
Hi Trent;&lt;br&gt;
&lt;br&gt;
Your solution works, but seems like the only difference between my code and yours is:&lt;br&gt;
Yours: this.CenterToScreen();&lt;br&gt;
Mine:  this.StartPosition = FormStartPosition.CenterScreen;&lt;br&gt;
&lt;br&gt;
Why is that?&lt;br&gt;
&lt;br&gt;
Secondly, here a sample that is identical to SF, but uses normal Windows form and my approach worked&lt;br&gt;
&lt;br&gt;
But thanks for reply!</description><pubDate>Fri, 13 Jul 2007 09:35:07 GMT</pubDate><dc:creator>Ben Hayat</dc:creator></item><item><title>RE: Problem with showing form...</title><link>http://forum.strataframe.net/FindPost10251.aspx</link><description>Ben,&lt;/P&gt;&lt;P&gt;This isn't a StrataFraem issue from what I can tell because we don't do anything with the form positions.&amp;nbsp; We don't stored off the loaded forms.&amp;nbsp; All of this functionality is native to .NET and we do not modify it.&amp;nbsp; However, you can fix your problem by adding the following code in the DoubleClick of the NotifyIcon.&lt;/P&gt;&lt;P&gt;[codesnippet]this.WindowState = FormWindowState.Normal;&lt;BR&gt;this.CenterToScreen();[/codesnippet]</description><pubDate>Fri, 13 Jul 2007 09:20:17 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Problem with showing form...</title><link>http://forum.strataframe.net/FindPost10246.aspx</link><description>[quote][b]Greg McGuffey (07/12/2007)[/b][hr]Just zip up the solution and add it as an attachment (scroll down, its under the emotocons) (if I'm following your question).[/quote]&lt;br&gt;
&lt;br&gt;
Thanks Greg; I missed the bottom part.&lt;br&gt;
&lt;br&gt;
Here is a small program for SF to look at.&lt;br&gt;</description><pubDate>Fri, 13 Jul 2007 08:24:54 GMT</pubDate><dc:creator>Ben Hayat</dc:creator></item><item><title>RE: Problem with showing form...</title><link>http://forum.strataframe.net/FindPost10244.aspx</link><description>Just zip up the solution and add it as an attachment (scroll down, its under the emotocons) (if I'm following your question).</description><pubDate>Thu, 12 Jul 2007 19:42:37 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Problem with showing form...</title><link>http://forum.strataframe.net/FindPost10241.aspx</link><description>Can you tell me how I can upload the test app in this forum?&lt;br&gt;
&lt;br&gt;
Thanks!&lt;br&gt;</description><pubDate>Thu, 12 Jul 2007 12:15:53 GMT</pubDate><dc:creator>Ben Hayat</dc:creator></item></channel></rss>