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. C#
  4. Modal UserControl, exist some way?

Modal UserControl, exist some way?

Scheduled Pinned Locked Moved C#
helptutorialquestion
3 Posts 3 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.
  • P Offline
    P Offline
    Palladino
    wrote on last edited by
    #1

    Hi friends, This time I have a very strange need, I recognize ;-)! In my application, there is three custom UserControls that represent "windows": MyFakeWindow UserControl1 MyFakeWindow UserControl2 MyFakeWindow UserControl3 There is also, a "FakeWindowManager" that controls which window is the current, which the windows order and things like this. Two methods stand out: void FakeWindowManager.Load(MyFakeWindow window) DialogResult FakeWindowManagerAsModal.Load(MyFakeWindow window) The problem is in the second method. How to do to simulate a MODAL window? Does anybody have an idea? Any suggestion, road, shines, am accepting everything... :D Thank´s in advance, Marcelo Palladino Brazil

    M H 2 Replies Last reply
    0
    • P Palladino

      Hi friends, This time I have a very strange need, I recognize ;-)! In my application, there is three custom UserControls that represent "windows": MyFakeWindow UserControl1 MyFakeWindow UserControl2 MyFakeWindow UserControl3 There is also, a "FakeWindowManager" that controls which window is the current, which the windows order and things like this. Two methods stand out: void FakeWindowManager.Load(MyFakeWindow window) DialogResult FakeWindowManagerAsModal.Load(MyFakeWindow window) The problem is in the second method. How to do to simulate a MODAL window? Does anybody have an idea? Any suggestion, road, shines, am accepting everything... :D Thank´s in advance, Marcelo Palladino Brazil

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      ShowDialog() show the form as modal window. Is that what you want? Mazy No sig. available now.

      1 Reply Last reply
      0
      • P Palladino

        Hi friends, This time I have a very strange need, I recognize ;-)! In my application, there is three custom UserControls that represent "windows": MyFakeWindow UserControl1 MyFakeWindow UserControl2 MyFakeWindow UserControl3 There is also, a "FakeWindowManager" that controls which window is the current, which the windows order and things like this. Two methods stand out: void FakeWindowManager.Load(MyFakeWindow window) DialogResult FakeWindowManagerAsModal.Load(MyFakeWindow window) The problem is in the second method. How to do to simulate a MODAL window? Does anybody have an idea? Any suggestion, road, shines, am accepting everything... :D Thank´s in advance, Marcelo Palladino Brazil

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        A control and a window are distinct window classes with different window styles. Instead of having to modify window styles and going to the work of implementing a pump, simply host the control in a borderless form and return the dialog result from the form:

        public static DialogResult Load(MyFakeWindow window)
        {
        Form f = new Form();
        f.FormBorderStyle = FormBorderStyle.None;
        f.Controls.Add(window);
        window.Dock = DockStyle.Fill;
         
        DialogResult result = f.ShowDialog();
        f.Dispose();
         
        return result;
        }

        -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

        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