0

こんにちは、データを解析するアプリケーションを開発しています。その後、MapInfo を使用してマップ上のデータを視覚化したいと考えています。MapInfo インスタンスを正しく作成しましたが、インスタンスにデータを表示する方法や使用方法もわかりません。作成したインスタンスは、可視化しても可視化されません。

以下は私のコードです

namespace JA3_Trace_Viewer
{
public partial class JA3Main : Form
{
    public JA3Main()
    {
        InitializeComponent();
    }

    private void JA3Main_Load(object sender, EventArgs e)
    {

        MapInfo.MapInfoApplication mapinfoinstance = new MapInfo.MapInfoApplication();
        mapinfoinstance.Visible = true;
        DDockWindow winM = new DDockWindow();
        winM.Activate();            
    }
}

マップ上で視覚化したいデータは経度と緯度で、別の列でそれらをデータと呼ぶことができるので、助けてください。

前もって感謝します。

新しいコード:

    public partial class Form1 : Form
{
    // Sets the parent of a window.
    [DllImport("User32", CharSet = CharSet.Auto, ExactSpelling = true)]
    internal static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndParent);

    //Sets window attributes
    [DllImport("USER32.DLL")]
    public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

    //Gets window attributes
    [DllImport("USER32.DLL")]
    public static extern int GetWindowLong(IntPtr hWnd, int nIndex);

    //assorted constants needed
    public static int GWL_STYLE = -16;
    public static int WS_CHILD = 0x40000000; //child window
    public static int WS_BORDER = 0x00800000; //window with border
    public static int WS_DLGFRAME = 0x00400000; //window with double border but no title
    public static int WS_CAPTION= WS_BORDER | WS_DLGFRAME; //window with a title bar
    public static int WS_MAXIMIZE = 0x1000000;

    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        // Create a new instance of MapInfo.
        MapInfoApplication mapinfo = new MapInfoApplication();

        // Get the handle to the whole MapInfo application.
        // 9 = SYS_INFO_MAPINFOWND.
        string handle = mapinfo.Eval("SystemInfo(9)");

        // Convert the handle to an IntPtr type.
        IntPtr oldhandle = new IntPtr(Convert.ToInt32(handle));

        //Make mapinfo visible otherwise it won't show up in our control.
        mapinfo.Visible = true;

        //Set the parent of MapInfo to a picture box on the form.
        SetParent(oldhandle, this.pictureBox1.Handle);

        //Get current window style of MapInfo window
        int style = GetWindowLong(oldhandle, GWL_STYLE);

        //Take current window style and remove WS_CAPTION(title bar) from it
        SetWindowLong(oldhandle, GWL_STYLE, (style & ~WS_CAPTION));

        //Maximize MapInfo so that it fits into our control.
        mapinfo.Do("Set Window 1011 Max");
    }
}
4

1 に答える 1

0

クラスにはandMapInfoApplicationというメソッドがあり、コマンド文字列を渡すことができます。Do()Eval()mapinfoinstance.Do('Open Table foo_bar.TAB as foo')

MapBasic フォルダ内のフォルダにある MapBasic サンプルを確認しSamples\DOTNET\...てください。

于 2015-03-17T14:41:18.653 に答える