Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. CF 1.0 SP3 - WinCE - FullScreen and Controls.Clear() - Add()

CF 1.0 SP3 - WinCE - FullScreen and Controls.Clear() - Add()

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpvisual-studiotestingbeta-testinghelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marco Stinger
    wrote on last edited by
    #1

    Hi I'm developping a WinCE 5.0 app using VS 2003, C# and CF 1.0 SP3. I'm currently testing on the WinCE 4.1 Emulator but a quick check on the CE 5.0 Device confirmed the behaviour. I create a full screen Form setting: ControlBox = False FormBorderStyle = None WindowState = Maximmized I add 3 buttons (button1, button2, button3) and add the following : private void button1_Click(object sender, System.EventArgs e) { this.Controls.Clear(); } private void Form1_Click(object sender, System.EventArgs e) { this.Controls.Add(button1); this.Controls.Add(button2); this.Controls.Add(button3); this.Refresh(); // this.Invalidate(); // button1.Invalidate(); // button2.Invalidate(); // button3.Invalidate(); // this.Invalidate(); // button1.Visible = true; // button2.Visible = true; // button3.Visible = true; // button1.BringToFront(); // button2.BringToFront(); // button3.BringToFront(); } As you see I clear the controls with the first button and then try to reasign the 2 controls to the form on the OnClick event of the form. Guess what happens ? No controls appear on the first clieck, button2 and button3 on the second click and all of them on the third click. But there's more: The controls don't show, but they are there: I click where I remeber the control was and I get the button.OnClick event !!!!!! :omg: :confused: As you see I've tried everithing I know (visible, invalidate, refresh etc etc) but I allways get the same behaviour. Do you know how I can get the right behaviour ? I found a workaround, but I'm still looking for the right solution. the workaround is: private void button1_ParentChanged(object sender, System.EventArgs e) { (sender as Control).Visible = ((sender as Control).Parent != null); } So the buttons turn invisible after the Controls.Clear() and return visible after the Controls.Add(). Please note that this is just a TEST APP, the real app must asign dinamically the controls so Controls.Clear() and Controls.Add() MUST be used Please Note: if I don't set the FormBorderStyle = None property then everything works perfectly !!! :wtf: :wtf: :wtf: Please help Ciao Marco

    I 1 Reply Last reply
    0
    • M Marco Stinger

      Hi I'm developping a WinCE 5.0 app using VS 2003, C# and CF 1.0 SP3. I'm currently testing on the WinCE 4.1 Emulator but a quick check on the CE 5.0 Device confirmed the behaviour. I create a full screen Form setting: ControlBox = False FormBorderStyle = None WindowState = Maximmized I add 3 buttons (button1, button2, button3) and add the following : private void button1_Click(object sender, System.EventArgs e) { this.Controls.Clear(); } private void Form1_Click(object sender, System.EventArgs e) { this.Controls.Add(button1); this.Controls.Add(button2); this.Controls.Add(button3); this.Refresh(); // this.Invalidate(); // button1.Invalidate(); // button2.Invalidate(); // button3.Invalidate(); // this.Invalidate(); // button1.Visible = true; // button2.Visible = true; // button3.Visible = true; // button1.BringToFront(); // button2.BringToFront(); // button3.BringToFront(); } As you see I clear the controls with the first button and then try to reasign the 2 controls to the form on the OnClick event of the form. Guess what happens ? No controls appear on the first clieck, button2 and button3 on the second click and all of them on the third click. But there's more: The controls don't show, but they are there: I click where I remeber the control was and I get the button.OnClick event !!!!!! :omg: :confused: As you see I've tried everithing I know (visible, invalidate, refresh etc etc) but I allways get the same behaviour. Do you know how I can get the right behaviour ? I found a workaround, but I'm still looking for the right solution. the workaround is: private void button1_ParentChanged(object sender, System.EventArgs e) { (sender as Control).Visible = ((sender as Control).Parent != null); } So the buttons turn invisible after the Controls.Clear() and return visible after the Controls.Add(). Please note that this is just a TEST APP, the real app must asign dinamically the controls so Controls.Clear() and Controls.Add() MUST be used Please Note: if I don't set the FormBorderStyle = None property then everything works perfectly !!! :wtf: :wtf: :wtf: Please help Ciao Marco

      I Offline
      I Offline
      Ingo
      wrote on last edited by
      #2

      Did you tried to use 'new' : button1 = new System.Windows.Forms.Button() Another question: why do you clear them from their parent. You could set them invisible, setting them visible again shoudl work without problem. I can't test your code, because i've just got Windows CE 4.0. Ingo

      M 1 Reply Last reply
      0
      • I Ingo

        Did you tried to use 'new' : button1 = new System.Windows.Forms.Button() Another question: why do you clear them from their parent. You could set them invisible, setting them visible again shoudl work without problem. I can't test your code, because i've just got Windows CE 4.0. Ingo

        M Offline
        M Offline
        Marco Stinger
        wrote on last edited by
        #3

        [quote] Did you tried to use 'new' : button1 = new System.Windows.Forms.Button() [/quote] I don't need to create a new button..it's already there, I just need to set it's parent. Visible works but I need to get 'em off the parent form completely Thanks for the effort ;)

        I 1 Reply Last reply
        0
        • M Marco Stinger

          [quote] Did you tried to use 'new' : button1 = new System.Windows.Forms.Button() [/quote] I don't need to create a new button..it's already there, I just need to set it's parent. Visible works but I need to get 'em off the parent form completely Thanks for the effort ;)

          I Offline
          I Offline
          Ingo
          wrote on last edited by
          #4

          Yes I know that it's there. But if you use the constructor there should be no problem. If there is a problem they way you tried, it sounds a little bit like a bug to me. So I would try something different. :) Ingo

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups