ribbon介面狀態列顯示滑鼠座標

2021-05-26 12:13:23 字數 1093 閱讀 7016

實現功能:在ribbon介面下,開啟影象,滑鼠在影象上移動時,狀態列上實時顯示滑鼠所在位置的座標。

方法:在mainframe類中新增如下函式:

void cmainframe::updatestatusbar(int nid, cstring str)

m_wndstatusbar.invalidate();

m_wndstatusbar.updatewindow();

}

void cmainframe::updateui(cfancyview* pcurrview, cstring point)

在oncreate函式裡改把相應的語句改為:

m_wndstatusbar.adddynamicelement(new cmfcribbonstatusbarpane(id_statusbar_pane1, strtitlepane1, true,null,_t("x=0000,y=0000")));
在view類中,用classwizard新增wm_mousemove訊息,然後在view中出現了void cfancyview::onmousemove(uint nflags, cpoint point)

在裡面新增如下**:

cfancydoc* pdoc = getdocument();

assert_valid(pdoc);

int offsetx = getscrollpos(sb_horz);

int offsety = getscrollpos(sb_vert);

point.x = point.x + offsetx; // 處理zoom和滾動條的位置

point.y = point.y + offsety;

strmouse.format("x=%d,y=%d",point.x,point.y);

((cmainframe*)afxgetmainwnd())->updateui(this,strmouse);

cscrollview::onmousemove(nflags, point);

這樣就可以了。

電池欄 隱藏 顯示(狀態列)

隱藏 顯示 電池欄狀態列現在ios7已經更改為透明,並且不占用螢幕高度。其中隱藏及顯示的方法如下 在uiviewcontroller的子類下,呼叫 bool prefersstatusbarhidden 在檢視切換,比如addsubview,present,pushin等,也需要注意及修改該狀態列。...

在狀態列顯示時間

單文件 在導向程式的第四步中選中 initial status bar resourceview stringtable 中新增乙個新的字串ids clock caption 0000 00 00 00 00 00 static uint indicators 在cmainframe 類 wm cr...

在狀態列顯示資訊

狀態列中缺省會顯示按鍵狀態和我們當前選擇的選單 工具條的描述資訊。我們也可以朝狀態列中顯示自己的資訊。本文介紹如何在狀態列中顯示當前滑鼠位置和滑鼠所在位置的顏色。為了顯示乙個定製訊息,我們需要為程式建立乙個可以關聯更新訊息的元素 字串資源 然後再在狀態列中給它建立對應的pane,最後,通過wm up...