I have commented the same in one of the relative questions in the forum!
Hi All,
I am able to hide all the tabs from Ribbon and display my custom tab whenever I open the MapInfo application standalone and also from the Sample .NET form button (Onform Load and Onform Unload) which calls MBX file which will embed the MapInfo.
Thanks to @Peter Horsbøll Møller? & @David Wilson? suggestions and their example code.
Usually, Whenever we double click on the top ribbon area for any windows application, Application gets maximized or minimized. when I do the same in Mapinfo standalone with the Custom MBX it is working as usual ( Hiding Quick access toolbar along with the other Tabs in the ribbon).
But, When I click on the MapInfo Application from the .NET form, I can see the quick access toolbar showing up.It is resizing the MIPro window Onform when we double click on left upper corner. It makes MapInfo window smaller and that makes quick access toolbar visible. you can see the same in below images.
Before double-clicking on the ribbon
![Before double click]()
After Double-clicking on the ribbon
![after double click]()
This is the .NET form code
private void button1_Click_1(object sender, EventArgs e)
{
string handle = mapinfo.Eval("SystemInfo(9)");
// Convert the handle to an IntPtr type.
IntPtr oldhandle = new IntPtr(Convert.ToInt32(handle));
//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");
String path = @Environment.CurrentDirectory;
String command = "Run Application \""+path+"\\..\\..\\MapProcess\\HideRibbon.MBX\" mode current";
mapinfo.Do(command);
}
I really want to know
- How do we hide the quick access toolbar from the .NET form?
- Should I call any method from any definition file? I used IMapInfoPro.def and MapBasic.def files in the entire process. is there any specific method we should call in Mapbasic code?
- How to disable that Maximize or minimise MapInfo window facility when we are accessing it from .NET form using Onform load and Onform Unload?
In the broader perspective, I am trying to replace MapXtream and SSA with MapInfo. Will there be any API which we can embed the MapInfo with above functionality? (Pls mind my ignorance :D)
Expecting some suggestions from the knowledgeable people. Cheers :)