?? scrgeniusdlg.cpp
字號:
/ ScrGeniusDlg.cpp : implementation file
//
//Modify by 徐景周 2000.10
//功能:退出對話框?qū)崿F(xiàn)
#include "stdafx.h"
#include "ScrGenius.h"
#include "ScrGeniusDlg.h"
//#include <afxpriv.h>
#include "TransparentWnd.h"
#include "AnimEffect.h" //對話框動(dòng)畫效果顯示
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CTransparentWnd *pTextDescription; //用于得到用戶自定制文字信息
/////////////////////////////////////////////////////////////////////////////
// ScrGenius dialog
CScrGeniusDlg::CScrGeniusDlg(CWnd* pParent /*=NULL*/)
: CDialog(CScrGeniusDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(ScrGenius)
// 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 CScrGeniusDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(ScrGenius)
DDX_Control(pDX, IDOK, m_Button1);
DDX_Control(pDX, IDCANCEL, m_Button2);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CScrGeniusDlg, CDialog)
//{{AFX_MSG_MAP(ScrGenius)
ON_WM_PAINT()
// ON_MESSAGE(WM_KICKIDLE, OnKickIdle)
ON_WM_SHOWWINDOW()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*
LRESULT CScrGeniusDlg::OnKickIdle(WPARAM wparam, LPARAM lparam)
{
UpdateDialogControls(this, false);
return 0;
}
*/
/////////////////////////////////////////////////////////////////////////////
// ScrGenius message handlers
BOOL CScrGeniusDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
//在此將兩按鈕設(shè)為不平面狀顯示,顏色和自定義窗體色相同
m_Button1.SubclassDlgItem(IDC_DIRBROWSER, this);
m_Button1.SetActiveBgColor(RGB(240,200,90));
m_Button1.SetInactiveBgColor(RGB(240,200,90));
m_Button1.SetInactiveFgColor(RGB(0,0,255));
m_Button1.SetActiveFgColor(RGB(0,255,0));
m_Button1.SetTrickButton(true); //設(shè)此按鈕為隨鼠標(biāo)自移動(dòng)郊果,不讓鼠標(biāo)碰上
// m_Button1.SetIcon(IDI_CANCEL);
m_Button1.SetFlat(false); //不扁平顯示
m_Button2.SubclassDlgItem(IDC_FILEBROWSER, this);
m_Button2.SetActiveBgColor(RGB(240,200,90));
m_Button2.SetInactiveBgColor(RGB(240,200,90));
m_Button2.SetInactiveFgColor(RGB(0,0,255));
m_Button2.SetActiveFgColor(RGB(0,255,0));
// m_Button2.SetIcon(IDI_OK);
m_Button2.SetTooltipText(IDS_TOOLTIP_EXIT);
m_Button2.SetFlat(false); //不扁平顯示
m_Button2.SetBtnCursor(IDC_HAND);
SetLogoFont("宋體", 17); //初始化設(shè)置顯示3D字體名稱和大小
// 下面代碼為建立特殊窗體顯示(橢圓)
// CRect cRect;
// CRgn wndRgn, rgnTemp;
// GetWindowRect(&cRect);
// wndRgn.CreateEllipticRgn(0, 0,cRect.Width(),cRect.Height());
// SetWindowRgn((HRGN)wndRgn, TRUE);
return TRUE; // return TRUE unless you set the focus to a control
}
//設(shè)置字體屬性
void CScrGeniusDlg::SetLogoFont(CString Name, int nHeight, int nWeight, BYTE bItalic, BYTE bUnderline)
{
if(m_fontLogo.m_hObject) m_fontLogo.Detach();
m_fontLogo.CreateFont(nHeight, 0, 0, 0, nWeight, bItalic, bUnderline,0,0,0,0,0,0, Name);
} // End of SetLogoFont
// 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 CScrGeniusDlg::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
{ //在此顯示3D文字
CRect rectDlg;
GetWindowRect(rectDlg);
ScreenToClient(rectDlg);
CPaintDC dc(this);
CString ShowText="有緣,所以認(rèn)識你!投緣,所以愛上你!";
//在此設(shè)置用戶自定制顯示的情話文字信息
if(pTextDescription->GetTextDescription ()!="")
ShowText=pTextDescription->GetTextDescription ();
CFont* OldFont = dc.SelectObject(&m_fontLogo);
CSize sizeText = dc.GetTextExtent(ShowText, strlen(ShowText));
dc.DrawState(CPoint((rectDlg.Width()-sizeText.cx)/2, 2),
rectDlg.Size(),
ShowText,
DSS_DISABLED, TRUE, 0, (CBrush*)NULL);
dc.SelectObject(OldFont);
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CScrGeniusDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
BOOL CScrGeniusDlg::DestroyWindow()
{
CRect rc1; //對話框動(dòng)畫顯示效果
AnimEffect anim1;
//在此加入對話框動(dòng)畫關(guān)閉效果
GetWindowRect( rc1 );
rc1.DeflateRect(2,2);//動(dòng)態(tài)方框顯示
anim1.DrawWireRects(rc1, CRect(rc1.CenterPoint().x-10,rc1.CenterPoint().y-10,rc1.CenterPoint().x+10,rc1.CenterPoint().y+10 ), 10);
// anim1.Close(rc1); ////對話框動(dòng)畫效果顯示關(guān)閉
// Sleep(100); //延緩100毫秒后關(guān)閉
return CDialog::DestroyWindow();
}
void CScrGeniusDlg::OnCancel()
{
// CScrGeniusDlg::ShowWindow (SW_HIDE);
CDialog::OnCancel();
}
void CScrGeniusDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
CRect rc1; //對話框動(dòng)畫顯示效果
AnimEffect anim1;
//在此加入對話框動(dòng)畫打開效果
GetWindowRect( rc1 );
anim1.Open( rc1 ); //對話框動(dòng)畫效果顯示打開
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -