MinimizeBox = True And Form.Close, Diiferent behavior between CF1.0 and CF2.0

In CF 1.0 and WM2003, if MinimizeBox of a form was set to true and you were to call Form.Close, it would mimimize the application.

With CF 2.0 and WM2005 however, the same scenario closes the form completely. Is this the expected/desired behavior If so, how can one programmatically minimize a form or send it to the back. Form.SendToBack does not seem to work if called from the contructor, form_load or form_activate.




Answer this question

MinimizeBox = True And Form.Close, Diiferent behavior between CF1.0 and CF2.0

  • Kalyani Sundaresan

    the ControlBox option now does nothing. The control button is always visible

    the control button is always a "X" unless ControlBox is true and MinimizeBox is false, then it's a OK

    Regardless of these settings, a form will ALWAYS close when you click the button

    What is going on This page is obviously rubbish now!

    http://msdn2.microsoft.com/en-us/library/bxz0e21k(VS.80).aspx

  • rezaA

    I wasn't able to reproduce your problem. I'm including the code below, please modify it so it shows the problem you mentioned, repost and I'll look into it.

    Using PPC 2003 SE device (ipaq 4700), with a v1 compiled EXE running against v1 4292 (SP3), if I call Form.Close(), the application exits. This is the same behavior I got using the same code compiled for v2 running under the WM 5 emulator.

  • Yılmaz ÜNAL

    when you ran your test..was the MinimizeBox set to TRUE



  • nay min thu

    To try and see how CF1.0 used to work, I wanted to create a app in vs2005 using CF1.0. i.e. New Project -> Device Application (1.0). However, vs told me "This project requires .NET Compact Framework v1.0, which is not installed on this machine."

    So I installed it (sp3) and my Add/Remove progs list shows Microsoft .Net Compact Framework 1.0 SP3, but I still get the same message (tried re-booting thank you). This should be ok to do eh Surely all I need is some version of CF1.0

    or

    Do I need CF1.0 without the service pack In that case where can I get it from, I can't find it anywhere on the net, MS site doesn't list it, all I can find are redistributables

    ___________________________________________________
    | | | | | |
    ___________________________________________________
    | | | | | | |
    ___________________________________________________
    | | | | | |
    ___________________________________________________
    | | | | | | |

    This is the brick wall I'm hitting my head off. I want my app to smart minimize, not close, so that users don't have to wait 12 seconds for it to load up every time they want to use it







  • Crakdkorn

    I tried this out on the PPC2003 emulator and had no trouble. If you want to try it elsewhere you would be wise to test it first. This code snippet is p/invoking to the native ShowWindow function using the native window handle for the form. Unforetunately I don't have a good, well supported way to offer instead.

    using System;

    using System.Windows.Forms;

    using System.Runtime.InteropServices;

    namespace DeviceApplication3

    {

    public partial class Form1 : Form

    {

    public Form1()

    {

    InitializeComponent();

    }

    private void m_bigMinimizeButton_Click(object sender, EventArgs e)

    {

    ShowWindow(this.Handle, SHOWWINDOW.SW_MINIMIZE);

    }

    public enum SHOWWINDOW : uint

    {

    SW_MINIMIZE = 6

    }

    [DllImport("coredll.dll")]

    internal static extern int ShowWindow(IntPtr hwnd, SHOWWINDOW cmdShow);

    }

    }

    -Noah

    .Net Compact Framework


  • kaebischer

    farseer, I think we are misunderstanding each other... The problem I was having is that MagicButton affects the way smart-minimize works in that the app would always close, not minimize

    Noah, thanks for the code.

    I'm only using MagicButton on my development device, not on production devices, so it's not really a problem, just strange

  • handsumblondy

    I didn't run the code, as I worked out that it was this 3rd party tool causing the prob, but I can confirm...

    The control box is always visible
    The minimise icon is always X unless cb=true and mb=false
    clicking the cb icon always closes the app even if mb=true ('X')

    This is only true if MagicButton is running. If you haven't used this, it is a handy 'task-manager' de/activated by holding the stylus on the control button(!) With this not running, the form behaves exactly as it is meant to.

    vs2005/cf2.0/ppc2003
    (http://www.trancreative.com/mb.aspx)

    p.s. I've just tried the lastest version, same result
    and sorry for ranting earlier



  • Blue Shirt

    anyone

    I'm amazed that something so fundamental has changed, or is it a bug

  • actinium.ga

    Michael, thanks for the reply.

    I'm pretty sure that transCreative MagicButton was causing interference with the control button. Once I'd removed that app, everything went back to normal

  • Paul from Iowa

    Unfortunately, this is not working for me...unless we are misunderstanding each other...

    i have an app with one form and all i did was add a button, which when clicked, closes the form. While debugging and tracing through the code, i notice that when the close method is called, the application ends.

    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
    this.Close();
    }
    }



  • Maxncl

    I'd like to know the answer to this please!

    Why has the behaviour changed I spent ages working out exactly how different true/false combinations worked for ControlBox & MinimizeBox when I first developed this app, so it would behave as I want

    Now I'm trying the app on different devices, some ppc2003, one WM5.0 (all with CF2.0) , and the behaviour is different! !

    I thought that forms not closing, but hiding when a user clicked the X was fundamental to the way mobile devices worked, and now I find that it's all changed!

    C'mon Microsoft, sort it our please, either do one or the other, and if you're going to change it, make sure you bloody well point it out!

    Does anyone know a link which explains what is going on

  • whitegrs

    hmmm, seems like I'm talking cr*p. I've been using this transCreative MagicButton, which uses the control button, and that was interfering with everything

  • Nontechie

    In Mike's test it was in the code snippet

    public Test()
    {
    this.Text = "click on the (x)";

    // this is the default value
    this.MinimizeBox = true; <---

    -Noah

    .Net Compact Framework


  • MinimizeBox = True And Form.Close, Diiferent behavior between CF1.0 and CF2.0