Using the interface library of BCG, some toolbar usage is different from that of MFC. The cframewnd of MFC directly has a function that can be called to set the position of the floating toolbar, while BCG does not, the underlying implementation of toolbar is totally different from that of MFC.
The code of the BCG library sets the location of the floating toolbar, and it took me a few hours to debug the function by reading its source code, adding, modifying, and calling the function, and finally came out. I personally feel that this method is not very beautiful. If you have any standard usage, please kindly advise. Thank you for that.
The Code is as follows:
Void
Cmainframe: repostexttoolbar (cpoint
&
Ptscreen)
{
Csize SZ
=
M_wndtextbar.calcsize (false );
Crect rtbound (ptscreen. X, ptscreen. Y
-
SZ. Cy
*
, Ptscreen. X, ptscreen. y );
Bool bisdocked
=
M_wndtextbar.isdocked ();
Bool bistabbed
=
M_wndtextbar.istabbed ();
If
(
!
Bisdocked
&&
!
Bistabbed)
{
Cbcgpminiframewnd
*
Pminiwnd
=
M_wndtextbar.getparentminiframe (true );
Pminiwnd
->
Setwindowpos (null, rtbound. Left,
Rtbound. Top,
Rtbound. Width (),
Rtbound. Height (),
Swp_nozorder
|
Swp_noactivate
|
Swp_nosize );
M_wndtextbar.adjustsize ();
M_wndtextbar.showwindow (sw_show );
Pminiwnd
->
Showwindow (sw_show );
}
Else
{
M_wndtextbar.showcontrolbar (true, false, false );
M_wndtextbar.floatcontrolbar (rtbound, bcgp_dm_standard );
}
}