Author Topic: show and hide windowsForm  (Read 1514 times)

0 Members and 1 Guest are viewing this topic.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
show and hide windowsForm
« on: March 31, 2014, 02:36:17 AM »
Hello!

Maybe it´s simple but I have not much experience with c# work with in methodes and classes.  I want when I start program with command "interpol"
1) start and show windows form
2) button1_Click hide windows form and select a block
3) after selecting windows form shows again and update the text from label1

If I think wrong, corretects that
1) create a formObjekt names frm
2) if click button run : frm.Hide()
                             : getblock
3)                          : frm.Show()
Code: [Select]
namespace Kotierung
{
    public partial class Form1 : Form
    {
         public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
        }

        [CommandMethod("interpol", "_interpol", CommandFlags.Modal)]
        public void frmStart()
        {
            Document doc = AcAp.DocumentManager.MdiActiveDocument;
            Form1 frm = new Form1();
            frm.Show();

            //AcAp.ShowModelessDialog(AcAp.MainWindow.Handle, frm);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            frm.Hide();
            GetBlockEntity.GetBlock(label1);
            frm.Show();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            frm.Hide();
            GetBlockEntity.GetBlock(label2);
            frm.Show();
        }

    }
}
   

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: show and hide windowsForm
« Reply #1 on: March 31, 2014, 02:59:46 AM »

A couple of things

Why is this commented out ?
Code - C#: [Select]
  1. //AcAp.ShowModelessDialog(AcAp.MainWindow.Handle, frm);

Can you please post the full code solution you are trying to use ?

I can't really see a specific question, just a general one for code to be provided. Do you have specific questions ?

Which build of AutoCAD and VisualStudio are you writing for ?
Regards,
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: show and hide windowsForm
« Reply #2 on: March 31, 2014, 03:03:57 AM »

Did this similar question get answered to your satisfaction ?
http://www.theswamp.org/index.php?topic=46635.0
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: show and hide windowsForm
« Reply #3 on: March 31, 2014, 03:41:52 AM »
Hello!
VS 2010;
The question is, I want try to get possibillity to can show and hide Objekt "frm" from all methods.
Finally program should do interpolation between heigth block.
button "erste Höhe" - select first heigth block
button "zweite Höhe" - select second heigth block

groupbox Berechnung
displa distance between Blocks and slope...

...

fixo

  • Guest