private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { string ilAdi = comboBox1.Text; if (ilAdi != "İl Seçiniz") { mi.Do("select * from iller where il_adi=\"" + ilAdi + "\" into selsec"); } if (int.Parse(mi.Eval("tableinfo(selsec,8)")) > 0) { mi.Do("add map window frontwindow() layer selsec"); mi.Do("set map window frontwindow() Zoom Entire Layer selsec"); mi.Do("remove map window frontwindow() layer selsec"); } //Yukarıdaki kısım comboboxtan seçim yapılan ilin üzerine zoom yaptırır. //Aşağıdaki kısım ise seçilen il adına göre ilçeleri listeletir ve combobox2 ye yani ilçeler comboboxına aktarır. mi.Do("select ilceadi from ilceler where iladi=\"" + comboBox1.Text + "\" order by ilceadi into selilceler noselect"); int count = int.Parse(mi.Eval("tableinfo(selilceler,8)")); mi.Do("fetch first from selilceler"); for (int i = 0; i < count; i++) { comboBox2.Items.Add(mi.Eval("selilceler.col1")); mi.Do("fetch next from selilceler"); } }
private void comboboxIller_SelectedIndexChanged(object sender, EventArgs e) { comboboxIlceler.Items.Clear(); mi.Do("select*from Yerlesim where il_adi=\"" + comboboxIller.Text + "\" group by ilce_adi order by ilce_adi into sel"); mi.Do("fetch first from sel"); for (int i = 0; i < Convert.ToInt16(mi.Eval("tableinfo(sel,8)")); i++) { comboboxIlceler.Items.Add(mi.Eval("sel.ilce_adi")); mi.Do("fetch next from sel"); } }
public string miEval(string mieval, string panel) { string getOperations = null; MapInfoApplication mi = connectMapInfo("", panel); getOperations = mi.Eval(mieval); return(getOperations); }
public static MapInfoApplication mi;//dinamik olarak bir mi objesi tanımlıyoruz //mi objesini kullanarak artık tüm MapInfo uygulamalarını kullanabiliriz. private void Form1_Load(object sender, EventArgs e) { mi = new MapInfoApplication(); //daha önce yaratılan mi objesine burada yön //verip onun bir MapInfoApplication ı olduğunu ifade eder int h = panel1.Handle.ToInt32(); // //her panelin bir handle numarası var ve bu no Int32 formuna çevrildi mi.Do("Set Next Document Parent " + h.ToString() + " Style 1"); mi.Do("set application window " + h.ToString()); string ws_path = Application.StartupPath + "\\" + "LESSON1.wor"; //MapInfo'dan projeye olustuşturduğumuz workspace mi.Do("Run Application \"" + ws_path + "\""); //uygulamanın akitive //olmasını sağlar } mi.Do("select il_adi from iller where il_adi<>\"\" order by il_adi into seliller noselect"); int count = int.Parse(mi.Eval("tableinfo(seliller,8)")); mi.Do("fetch first from seliller"); for (int i = 0; i < count; i++) { comboBox1.Items.Add(mi.Eval("seliller.col1")); mi.Do("fetch next from seliller"); } }
private void _buttonProjection_Click(object sender, EventArgs e) { //string newCoordsys = _miApp.Eval(string.Format("ChooseProjection$({0}, 1)", _coordsys)); string newCoordsys = _miApp.Eval("ChooseProjection$(\"\", 1)"); //MessageBox.Show(string.Format("Error: {0}", _miApp.LastErrorMessage)); if (newCoordsys != "") { this.Coordsys = newCoordsys; } }
private void Form1_Load(object sender, EventArgs e) { foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses()) { if (p.ProcessName == "MapInfow" & p.MainWindowTitle == "") { p.Kill(); } } mi = new MapInfoApplication(); int h = panel1.Handle.ToInt32(); mi.Do("Set Next Document Parent " + h.ToString() + " Style 1"); mi.Do("set application window " + h.ToString()); string ws_path = Application.StartupPath + "\\" + "default5.wor"; mi.Do("Run Application \"" + ws_path + "\""); gMainWinId = mi.Eval("windowid(0)"); mi.Do("create buttonpad \"a\" as toolbutton calling OLE \"info\" id 2001"); mi.Do("create buttonpad \"b\" as toolbutton calling OLE \"cizgiciz\" drawmode 33 id 2003"); mi.Do("create buttonpad \"c\" as toolbutton calling OLE \"noktaAt\" id 2004"); mi.Do("create buttonpad \"d\" as toolbutton calling OLE \"kapaliAlan\" drawmode 35 id 2005"); comboboxIller.Items.Clear(); mi.Do("select*from iller into sel noselect"); mi.Do("fetch first from sel"); for (int i = 0; i < Convert.ToInt16(mi.Eval("tableinfo(sel,8)")); i++) { comboboxIller.Items.Add(mi.Eval("sel.il_adi")); mi.Do("fetch next from sel"); } mi.SetCallback(callb); }
// this block is used to set in which panel the workspace will work // take the id of the window where the workspace is running. // We need windows_id after to create a legend and a thematic in that window. public void createWorkspace(string tab_panel_border, ref string windows_id) { try { mi.Do( "set next document parent " + tab_panel_border + "style 1"); // set the document to be the child window of the panel mi.Do("set application window " + tab_panel_border); // AppDomain.CurrentDomain.BaseDirectory is ./bin/debug mi.Do("run application \"" + AppDomain.CurrentDomain.BaseDirectory + "/workspace1.WOR" + "\""); windows_id = mi.Eval("frontwindow()"); mi.Do("Set Map Window FrontWindow() Zoom Entire Layer 1"); // zoom on the entire layer } catch (Exception e) { MessageBox.Show("Başka bir MAPINFO uygulaması açık."); Close(); } }
private void Form1_Resize(object sender, EventArgs e) { if (mi != null) { // The form has been resized. if (mi.Eval("WindowID(0)") != "") { // Update the map to match the current size of the panel. MoveWindow((System.IntPtr) long.Parse(mi.Eval("WindowInfo(FrontWindow(),12)")), 0, 0, this.map.Width, this.map.Height, false); } } if (FormWindowState.Minimized == this.WindowState) { notifyIcon.Visible = true; notifyIcon.ShowBalloonTip(500); this.Hide(); } else if (FormWindowState.Normal == this.WindowState) { notifyIcon.Visible = false; } }
//mi objesini kullanarak artık tüm MapInfo uygulamalarını kullanabiliriz. private void Form1_Load(object sender, EventArgs e) { mi = new MapInfoApplication();//daha önce yaratılan mi objesine burada yön //verip onun bir MapInfoApplication ı olduğunu ifade eder int h = panel1.Handle.ToInt32();// //her panelin bir handle numarası var ve bu no Int32 formuna çevrildi mi.Do("Set Next Document Parent " + h.ToString() + " Style 1"); mi.Do("set application window " + h.ToString()); string ws_path = Application.StartupPath + "\\" + "LESSON1.wor";//MapInfo'dan projeye olustuşturduğumuz workspace mi.Do("Run Application \"" + ws_path + "\"");//uygulamanın akitive //olmasını sağlar } mi.Do("select il_adi from iller where il_adi<>\"\" order by il_adi into seliller noselect"); int count = int.Parse(mi.Eval("tableinfo(seliller,8)")); mi.Do("fetch first from seliller"); for (int i = 0; i < count; i++) { comboBox1.Items.Add(mi.Eval("seliller.col1")); mi.Do("fetch next from seliller"); } }