sinat_40442218
ttlily萝
2017-11-21 06:42

“Form1.MyText”不可访问,因为它具有一定的保护级别

  • textbox
  • namespace
  • class

这里的MyText是一个textbox的name,之前我用的是InputText,改成MyText还是不行,求帮助是怎么回事??
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;

using WindowsFormsApplication3;

[assembly:CommandClass (typeof(modaldialogClassLibrary3 .Class1))]

namespace modaldialogClassLibrary3
{
public class Class1
{
[CommandMethod("modaldialog")]
public void modaldialog()
{
using (Form1 form = new Form1())
{
form.ShowInTaskbar = false;
Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(form);
if(form.DialogResult==System.Windows.Forms.DialogResult.OK)
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\n"+ form.MyText.Text);
}
}
}
}


  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答