想做一个时钟程序,程序介面上只有时间的几个数字的笔画,没有窗口。
要是能在拖动时没有窗口的“边框”显示出来的话,可以另开贴子给分。
谢谢了。

解决方案 »

  1.   


    这是一个不规则窗体的实例,希望能对你有所帮助
    http://www.vckbase.com/document/viewdoc.asp?id=541
      

  2.   

    谢谢,我也从VC知识库找到了拖动无标题窗口的方法,只是响应ON_WM_NCHITTEST()的方法好象会生成一个窗口的框框,我不想要那个框框呀。
      

  3.   

    这是我写的一个椭圆形按钮,资源是有一个按钮的普通对话框。
    希望对你有帮助。class CRoundDlg : public CDialog
    {
    // Construction
    public:
    CRoundDlg(CWnd* pParent = NULL); // standard constructor// Dialog Data
    //{{AFX_DATA(CRoundDlg)
    enum { IDD = IDD_ROUND_DIALOG };
    // NOTE: the ClassWizard will add data members here
    //}}AFX_DATA // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CRoundDlg)
    protected:
    virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
    //}}AFX_VIRTUAL// Implementation
    protected:
    HICON m_hIcon; // Generated message map functions
    //{{AFX_MSG(CRoundDlg)
    virtual BOOL OnInitDialog();
    afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
    afx_msg void OnPaint();
    afx_msg HCURSOR OnQueryDragIcon();
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    };
    CRoundDlg::CRoundDlg(CWnd* pParent /*=NULL*/)
    : CDialog(CRoundDlg::IDD, pParent)
    {
    //{{AFX_DATA_INIT(CRoundDlg)
    // NOTE: the ClassWizard will add member initialization here
    //}}AFX_DATA_INIT
    // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
    m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
    }void CRoundDlg::DoDataExchange(CDataExchange* pDX)
    {
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CRoundDlg)
    // NOTE: the ClassWizard will add DDX and DDV calls here
    //}}AFX_DATA_MAP
    }BEGIN_MESSAGE_MAP(CRoundDlg, CDialog)
    //{{AFX_MSG_MAP(CRoundDlg)
    ON_WM_SYSCOMMAND()
    ON_WM_PAINT()
    ON_WM_QUERYDRAGICON()
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
    // CRoundDlg message handlersBOOL CRoundDlg::OnInitDialog()
    {
    CDialog::OnInitDialog();
    CRect rcDialog;
    GetClientRect(&rcDialog);
    CRgn rgn;
    rgn.CreateEllipticRgn(0,0,rcDialog.Width(),rcDialog.Height());
    SetWindowRgn((HRGN)rgn,TRUE);

    return TRUE;  // return TRUE  unless you set the focus to a control
    }void CRoundDlg::OnSysCommand(UINT nID, LPARAM lParam)
    {
    if ((nID & 0xFFF0) == IDM_ABOUTBOX)
    {
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
    }
    else
    {
    CDialog::OnSysCommand(nID, lParam);
    }
    }// If you add a minimize button to your dialog, you will need the code below
    //  to draw the icon.  For MFC applications using the document/view model,
    //  this is automatically done for you by the framework.void CRoundDlg::OnPaint() 
    {
    if (IsIconic())
    {
    CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
    }
    else
    {
    CDialog::OnPaint();
    }
    }// The system calls this to obtain the cursor to display while the user drags
    //  the minimized window.
    HCURSOR CRoundDlg::OnQueryDragIcon()
    {
    return (HCURSOR) m_hIcon;
    }
      

  4.   

    BeginPath(HDC)
    然后TextOut()你要的字
    GetPath取得相关点路径,
    然后根据取得的点路径CreatePolygonRgn创建区域
    最后SetWindowRgn设置窗体的样子,就是只是字的笔画了.
    记得EndPath
      

  5.   

    http://www.yesky.com/SoftChannel/72342371928702976/20031121/1746826_1.shtml
      

  6.   

    http://expert.csdn.net/Expert/topic/2673/2673177.xml?temp=.5031092
    http://expert.csdn.net/Expert/topic/2673/2673176.xml?temp=.8355982