CBox command target

#if !defined(AFX_BOX_H__D6DF5F90_7675_4BD4_A764_EC8DBBD8DC46__INCLUDED_)
#define AFX_BOX_H__D6DF5F90_7675_4BD4_A764_EC8DBBD8DC46__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Box.h : header file
//

/
// CBox command target

class CBox : public CCmdTarget
{
    DECLARE_SERIAL(CBox)

    CBox();           // protected constructor used by dynamic creation

// Attributes
public:

// Operations
public:

// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CBox)
    public:
    virtual void OnFinalRelease();
    virtual void Serialize(CArchive& ar);
    //}}AFX_VIRTUAL

// Implementation
protected:

    // Generated message map functions
    //{{AFX_MSG(CBox)
        // NOTE - the ClassWizard will add and remove member functions here.
    //}}AFX_MSG
public:
    virtual ~CBox();
    CBox(CRect rt) : m_rtBox( rt) {}

private:    

    BOOL    m_bIsSeleced;
    CRect    m_rtBox;

public:

    
    virtual CRect GetBox() const{return  m_rtBox ;}    
    virtual void  SetBox(CRect & rtBox) {m_rtBox = rtBox ;}    
    
    virtual BOOL IsSeleced() const    {return m_bIsSeleced ;}
    
    virtual BOOL SelectTest(const CPoint & ptHit) const
    {
        
        CRect rtBox(m_rtBox);
        //调整坐标
        rtBox.NormalizeRect();
        
        return rtBox.PtInRect(ptHit);        
        
    }
    
//     virtual BOOL SelectTest(const CRect & rtHit) const
//     {
//         
//         CRect rtBox(m_rtBox);
//         //调整坐标
//         rtBox.NormalizeRect();
//         
//         CRect rtTest(rtHit);
//         //调整坐标
//         rtTest.NormalizeRect();
//         
//         
//         CRect rtRet(0,0,0,0);
//         
//         //IntersectRect此函数使CRect等于两个现有矩形的交集。交集是同时包含在两个现有矩形中的最大矩形。
//         
//         return rtRet.IntersectRect(&rtBox,&rtTest);        
//         
//     }
    
    virtual void SetSeleced(){    m_bIsSeleced = TRUE ;}    
    virtual void UnSeleced() {    m_bIsSeleced = FALSE ;}

    virtual void OnDraw(CDC* pDC);
    //声明为内联函数要放在类的外面
    friend bool operator == (const CBox & , const CBox &) ;

protected:
    
//     //调整坐标
//     void ReviseRect(int iMapMode) 
//     {
//         if(MM_TEXT == iMapMode)
//         {
//             m_rtBox.bottom    =  - abs(m_rtBox.bottom)  ;
//             m_rtBox.top        =  - abs(m_rtBox.top)  ;            
//         }
//         else
//         {            
//             m_rtBox.bottom    =   abs(m_rtBox.bottom)  ;
//             m_rtBox.top        =   abs(m_rtBox.top)  ;
//         }        
//     }

    virtual void DrawSelecedBox(CDC* pDC)    {    }

    DECLARE_MESSAGE_MAP()
    // Generated OLE dispatch map functions
    //{{AFX_DISPATCH(CBox)
        // NOTE - the ClassWizard will add and remove member functions here.
    //}}AFX_DISPATCH
    DECLARE_DISPATCH_MAP()
    DECLARE_INTERFACE_MAP()
};

//这个内联定义要放在类的外面
    inline bool operator == (const CBox & a , const CBox & b ) 
    {return  a.m_rtBox == b.m_rtBox ;}
/

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_BOX_H__D6DF5F90_7675_4BD4_A764_EC8DBBD8DC46__INCLUDED_)
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Python中调用Combobox的值,你可以使用get()方法来获取用户选择的值。根据你提供的代码片段,你可以在绑定选择事件的函数中使用box.get()来获取当前选择的值。然而,你提到这种方法不起作用,可能是因为你没有正确地绑定选择事件或者没有正确地调用该函数。 你可以尝试以下步骤来解决这个问题: 1. 确保你正确地导入了tkinter和ttk模块,并正确地创建了Combobox部件。 2. 确保你正确地绑定了选择事件。你可以使用bind方法来绑定事件,例如:box.bind("<<ComboboxSelected>>", your_function)。在your_function中,你可以使用box.get()来获取当前选择的值。 3. 确保你正确地调用了你绑定的函数。你可以在程序启动时手动调用该函数,以确保它能够正确地获取当前选择的值。 希望这些步骤能够帮助你解决问题。如果问题仍然存在,请提供更多的代码和错误信息,以便我们能够更好地帮助你。\[2\] #### 引用[.reference_title] - *1* [python – 从Tkinter中的combobox中获取所选值](https://blog.csdn.net/weixin_39664585/article/details/111438531)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [关于python-tkinter-ttk-Combobox详解](https://blog.csdn.net/Z_love_u/article/details/109292907)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [从零开始编写一个上位机(串口助手)QT Creator + Python](https://blog.csdn.net/believe666/article/details/128425211)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值