.NET

Reply
Active Contributor
Posts: 29
Registered: ‎04-14-2005
Message 1 of 1 (45 Views)

Second time to run the dialog

45 Views, 0 Replies
11-22-2005 04:28 AM
I create the palette dialog at last. But I meet a new issue. I can load the dialog at first time. When I close it, I can run it again. Could anyone help me? I open a new file. It can be used by type "Leodock" in the commanf again.

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.DatabaseServices;

using Autodesk.AutoCAD.Windows;
using Autodesk.AutoCAD.Runtime;

namespace CsMgdAcad1
{

public class ModelessForm: System.Windows.Forms.UserControl
{
private System.Windows.Forms.Label label1;

private System.ComponentModel.Container components = null;

public ModelessForm()
{


}


protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region

private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(0, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(128, 64);
this.label1.TabIndex = 0;
this.label1.Text = "Leo Li. Hello World!";
//
// ModelessForm
//
this.Controls.Add(this.label1);
this.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.Name = "ModelessForm";
this.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Size = new System.Drawing.Size(128, 136);
this.ResumeLayout(false);

}
#endregion


private void ModelessForm_Load(object sender, System.EventArgs e)
{

}



private Autodesk.AutoCAD.Windows.PaletteSet ps;

[CommandMethod("leodock")]
public void testPalette()
{
if(ps == null)
{

ps = new Autodesk.AutoCAD.Windows.PaletteSet("Leo Li's first docking palette");

ps.Style = PaletteSetStyles.ShowCloseButton;

ps.Opacity = 90;
ps.MinimumSize = new System.Drawing.Size(300, 300);
System.Windows.Forms.UserControl myCtrl = new ModelessForm();

ps.Add("Leo", myCtrl);
ps.Visible = true;

}
}



}

}

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community