home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / leadtools / ocx32.lt / Fxdlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-03  |  22.0 KB  |  595 lines

  1. // FxDlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "FxDemo.h"
  6. #include "FxDlg.h"
  7.  
  8. char *szFileName[] =
  9. {
  10.    "..\\images\\sample1.cmp",
  11.    "..\\images\\sample2.cmp",
  12.    "..\\images\\sample3.cmp",
  13.    "..\\images\\sample4.cmp",
  14.    "..\\images\\sample5.cmp",
  15. };
  16.  
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CFxDemoDlg dialog
  19.  
  20. CFxDemoDlg::CFxDemoDlg(CWnd* pParent /*=NULL*/)
  21.     : CDialog(CFxDemoDlg::IDD, pParent)
  22. {
  23.     //{{AFX_DATA_INIT(CFxDemoDlg)
  24.     //}}AFX_DATA_INIT
  25.     // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  26.     m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  27. }
  28.  
  29. void CFxDemoDlg::DoDataExchange(CDataExchange* pDX)
  30. {
  31.     CDialog::DoDataExchange(pDX);
  32.     //{{AFX_DATA_MAP(CFxDemoDlg)
  33.     DDX_Control(pDX, IDC_SHOW_TRANSITION, m_ShowTransition);
  34.     DDX_Control(pDX, IDC_SHOW_TEXT, m_ShowText);
  35.     DDX_Control(pDX, IDC_SHOW_SHAPE, m_ShowShape);
  36.     DDX_Control(pDX, IDC_LEAD, m_Lead);
  37.     DDX_Control(pDX, IDC_LEADDLG, m_LeadDlg);
  38.     DDX_Control(pDX, IDC_LEADSHAPE, m_LeadShape);
  39.     DDX_Control(pDX, IDC_LEADTEXT, m_LeadText);
  40.     //}}AFX_DATA_MAP
  41. }
  42.  
  43. BEGIN_MESSAGE_MAP(CFxDemoDlg, CDialog)
  44.     //{{AFX_MSG_MAP(CFxDemoDlg)
  45.     ON_BN_CLICKED(IDC_SHAPE, OnShape)
  46.     ON_BN_CLICKED(IDC_TEXT, OnText)
  47.     ON_BN_CLICKED(IDC_TRANSITION, OnTransition)
  48.     ON_BN_CLICKED(IDC_EFFECT, OnEffect)
  49.     ON_BN_CLICKED(IDC_SHOW, OnShow)
  50.     ON_WM_PAINT()
  51.     //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53.  
  54. /////////////////////////////////////////////////////////////////////////////
  55. // CFxDemoDlg message handlers
  56.  
  57. BOOL CFxDemoDlg::OnInitDialog()
  58. {
  59.     CDialog::OnInitDialog();
  60.  
  61.     // Set the icon for this dialog.  The framework does this automatically
  62.     //  when the application's main window is not a dialog
  63.     SetIcon(m_hIcon, TRUE);            // Set big icon
  64.     SetIcon(m_hIcon, FALSE);        // Set small icon
  65.     
  66.    m_nEffectStyle            = EFX_EFFECT_ELLIPSE_C_OUT;
  67.    m_nEffectGrain            = 10;
  68.    m_nEffectDelay            = 0;
  69.     m_nEffectMaxPass          = 1;
  70.    m_nEffectTransparent      = 0;
  71.    m_nEffectTransparentColor = RGB(0, 0, 0);
  72.    m_nEffectWandWidth        = 0;
  73.    m_nEffectWandColor        = RGB(255, 0, 0);
  74.  
  75.    m_nTransitionStyle                  = EFX_GRADIENT_CONE_FROM_B;  
  76.    m_nTransitionBackColor              = RGB(255, 0, 0);       
  77.    m_nTransitionForeColor              = RGB(0, 0, 255);       
  78.    m_nTransitionSteps                  = 100;       
  79.    m_nTransitionEffectStyle            = EFX_EFFECT_ELLIPSE_C_IN;      
  80.    m_nTransitionEffectGrain            = 10;       
  81.    m_nTransitionEffectDelay            = 0;       
  82.    m_nTransitionEffectMaxPass          = 1;     
  83.    m_nTransitionEffectTransparent      = 0; 
  84.    m_nTransitionEffectTransparentColor = RGB(128, 128, 128);
  85.    m_nTransitionEffectWandWidth        = 0;   
  86.    m_nTransitionEffectWandColor        = RGB(0, 128, 0);       
  87.  
  88.     m_nShapeStyle            = EFX_SHAPE_STAR5;
  89.     m_nShapeBackStyle        = EFX_BACKSTYLE_TRANSPARENT;
  90.     m_nShapeFillStyle        = DRAWFILLSTYLE_UPWARD_DIAGONAL;
  91.     m_nShapeBorderColor      = RGB(192, 192, 192);
  92.     m_nShapeBorderStyle      = EFX_BORDERSTYLE_SOLID;
  93.     m_nShapeBorderWidth      = 3;
  94.     m_nShapeInnerStyle       = EFX_INNERSTYLE_INSET;
  95.     m_nShapeInnerWidth       = 3;
  96.     m_nShapeInnerHiliteColor = RGB(255, 255, 255);
  97.     m_nShapeInnerShadowColor = RGB(128, 128, 128);
  98.     m_nShapeOuterStyle       = EFX_OUTERSTYLE_RAISED;
  99.     m_nShapeOuterWidth       = 3;
  100.     m_nShapeOuterHiliteColor = RGB(255, 255, 255);
  101.     m_nShapeOuterShadowColor = RGB(128, 128, 128);
  102.     m_nShapeShadowXDepth     = 5;
  103.     m_nShapeShadowYDepth     = 5;
  104.     m_nShapeShadowColor      = RGB(0, 0, 0);
  105.     m_nShapeForeColor        = RGB(255, 0, 0);
  106.     m_nShapeBackColor        = RGB(0, 0, 255);
  107.  
  108.    m_strTextSample           = CString("LEAD Tools");
  109.    m_nTextAngle              = 0;        
  110.    m_nTextStyle              = EFX_TEXTSTYLE_OUTLINEBLOCK;        
  111.    m_nTextAlign              = EFX_TEXTALIGN_HCENTER_VCENTER;        
  112.    m_nTextWordWrap           = 1;     
  113.    m_nTextColor              = RGB(255, 0, 0);
  114.    m_nTextHiliteColor        = RGB(255, 255, 255);
  115.    m_nTextShadowColor        = RGB(0, 0, 0);
  116.    m_nTextShadowXDepth       = 5;
  117.    m_nTextShadowYDepth       = 5;
  118.    m_nTextUseForegroundImage = 0;
  119.    m_oleTextFont             = m_LeadDlg.GetFont();
  120.  
  121.    CY cySize;
  122.    cySize = m_oleTextFont.GetSize();
  123.    cySize.Lo *= 5;
  124.    m_oleTextFont.SetSize(cySize);
  125.  
  126.    UNLOCKSUPPORT(m_Lead);
  127.    UNLOCKSUPPORT(m_LeadShape);
  128.    UNLOCKSUPPORT(m_LeadText);
  129.  
  130.    m_nFileIndex  = 0;
  131.  
  132.    m_Lead.SetEnableMethodErrors(FALSE);
  133.    m_Lead.SetAutoRepaint(FALSE);
  134.    m_Lead.SetAutoScroll(TRUE);
  135.    m_Lead.SetBackErase(FALSE);
  136.    m_Lead.SetEnableProgressEvent(FALSE);
  137.    m_Lead.SetPaintSizeMode(PAINTSIZEMODE_STRETCH);
  138.    m_Lead.SetScaleMode(3);
  139.  
  140.    m_LeadShape.SetEnableMethodErrors(FALSE);
  141.    m_LeadShape.SetAutoRepaint(FALSE);
  142.    m_LeadShape.SetAutoScroll(TRUE);
  143.    m_LeadShape.SetBackErase(FALSE);
  144.    m_LeadShape.SetEnableProgressEvent(FALSE);
  145.    m_LeadShape.SetPaintSizeMode(PAINTSIZEMODE_NORMAL);
  146.    m_LeadShape.SetScaleMode(3);
  147.    m_LeadShape.ShowWindow(SW_HIDE);
  148.  
  149.    m_LeadText.SetEnableMethodErrors(FALSE);
  150.    m_LeadText.SetAutoRepaint(FALSE);
  151.    m_LeadText.SetAutoScroll(TRUE);
  152.    m_LeadText.SetBackErase(FALSE);
  153.    m_LeadText.SetEnableProgressEvent(FALSE);
  154.    m_LeadText.SetPaintSizeMode(PAINTSIZEMODE_NORMAL);
  155.    m_LeadText.SetScaleMode(3);
  156.    m_LeadText.ShowWindow(SW_HIDE);
  157.  
  158.    m_LeadDlg.SetEnableMethodErrors(FALSE);
  159.  
  160.     return TRUE;  // return TRUE  unless you set the focus to a control
  161. }
  162.  
  163. void CFxDemoDlg::OnEffect() 
  164. {
  165.    int   nResult;
  166.    CRect rcRect;
  167.  
  168.    m_LeadDlg.SetEffect(m_nEffectStyle);
  169.    m_LeadDlg.SetGrain(m_nEffectGrain);
  170.     m_LeadDlg.SetDelay(m_nEffectDelay);
  171.     m_LeadDlg.SetMaxPass(m_nEffectMaxPass);
  172.     m_LeadDlg.SetTransparent(m_nEffectTransparent);
  173.     m_LeadDlg.SetTransparentColor(m_nEffectTransparentColor);
  174.     m_LeadDlg.SetWandWidth(m_nEffectWandWidth);
  175.     m_LeadDlg.SetWandColor(m_nEffectWandColor);
  176.  
  177.    m_LeadDlg.SetUIFlags(DLG_EFX_SHOWPREVIEW |
  178.                         DLG_EFX_DELAY |
  179.                         DLG_EFX_GRAIN |
  180.                         DLG_EFX_PASSES |
  181.                         DLG_EFX_TRANSPARENT |
  182.                         DLG_EFX_WAND |
  183.                         DLG_EFX_CLASS_NONE |
  184.                         DLG_EFX_CLASS_WIPE |
  185.                         DLG_EFX_CLASS_WIPERECT |
  186.                         DLG_EFX_CLASS_WIPECIRCLE |
  187.                         DLG_EFX_CLASS_PUSH |
  188.                         DLG_EFX_CLASS_SLIDE |
  189.                         DLG_EFX_CLASS_ROLL |
  190.                         DLG_EFX_CLASS_ROTATE |
  191.                         DLG_EFX_CLASS_ZOOM |
  192.                         DLG_EFX_CLASS_DRIP |
  193.                         DLG_EFX_CLASS_BLIND |
  194.                         DLG_EFX_CLASS_RANDOM |
  195.                         DLG_EFX_CLASS_CHECK |
  196.                         DLG_EFX_CLASS_BLOCKS |
  197.                         DLG_EFX_CLASS_CIRCLE |
  198.                         DLG_EFX_CLASS_ELLIPSE);
  199.  
  200.    m_LeadDlg.SetBitmap(m_Lead.GetBitmap());
  201.  
  202.    nResult = m_LeadDlg.GetEffect((long)this->m_hWnd);
  203.    if (nResult == 0)
  204.    {
  205.        m_nEffectStyle            = m_LeadDlg.GetEffect();
  206.        m_nEffectGrain            = m_LeadDlg.GetGrain();
  207.        m_nEffectDelay            = m_LeadDlg.GetDelay();
  208.        m_nEffectMaxPass          = m_LeadDlg.GetMaxPass();
  209.        m_nEffectTransparent      = m_LeadDlg.GetTransparent();
  210.        m_nEffectTransparentColor = m_LeadDlg.GetTransparentColor();
  211.        m_nEffectWandWidth        = m_LeadDlg.GetWandWidth();
  212.        m_nEffectWandColor        = m_LeadDlg.GetWandColor();
  213.  
  214.       GetWindowRect(rcRect);
  215.       InvalidateRect(rcRect, FALSE);
  216.    }
  217. }
  218.  
  219. void CFxDemoDlg::OnTransition() 
  220. {
  221.    int   nResult;
  222.    CRect rcRect;
  223.  
  224.    m_LeadDlg.SetTransition(m_nTransitionStyle);
  225.    m_LeadDlg.SetForeColor(m_nTransitionForeColor);
  226.    m_LeadDlg.SetBackColor(m_nTransitionBackColor);
  227.    m_LeadDlg.SetGradientSteps(m_nTransitionSteps);
  228.    m_LeadDlg.SetEffect(m_nTransitionEffectStyle);
  229.     m_LeadDlg.SetGrain(m_nTransitionEffectGrain);
  230.     m_LeadDlg.SetDelay(m_nTransitionEffectDelay);
  231.     m_LeadDlg.SetMaxPass(m_nTransitionEffectMaxPass);
  232.     m_LeadDlg.SetTransparent(m_nTransitionEffectTransparent);
  233.     m_LeadDlg.SetTransparentColor(m_nTransitionEffectTransparentColor);
  234.     m_LeadDlg.SetWandWidth(m_nTransitionEffectWandWidth);
  235.     m_LeadDlg.SetWandColor(m_nTransitionEffectWandColor);
  236.  
  237.    m_LeadDlg.SetUIFlags(DLG_TRANS_SHOWPREVIEW |
  238.                         DLG_TRANS_FORECOLOR |
  239.                         DLG_TRANS_BACKCOLOR |
  240.                         DLG_TRANS_DELAY |
  241.                         DLG_TRANS_GRAIN |
  242.                         DLG_TRANS_EFFECT |
  243.                         DLG_TRANS_PASSES |
  244.                         DLG_TRANS_WAND |
  245.                         DLG_TRANS_TRANSPARENT |
  246.                         DLG_TRANS_GRADIENT);
  247.  
  248.    m_LeadDlg.SetBitmap(m_Lead.GetBitmap());
  249.    
  250.    nResult = m_LeadDlg.GetTransition((long)this->m_hWnd);
  251.    if (nResult == 0)
  252.    {
  253.        m_nTransitionStyle                  = m_LeadDlg.GetTransition();
  254.       m_nTransitionForeColor              = m_LeadDlg.GetForeColor();
  255.       m_nTransitionBackColor              = m_LeadDlg.GetBackColor();
  256.       m_nTransitionSteps                  = m_LeadDlg.GetGradientSteps();
  257.        m_nTransitionEffectStyle            = m_LeadDlg.GetEffect();
  258.        m_nTransitionEffectGrain            = m_LeadDlg.GetGrain();
  259.        m_nTransitionEffectDelay            = m_LeadDlg.GetDelay();
  260.        m_nTransitionEffectMaxPass          = m_LeadDlg.GetMaxPass();
  261.        m_nTransitionEffectTransparent      = m_LeadDlg.GetTransparent();
  262.        m_nTransitionEffectTransparentColor = m_LeadDlg.GetTransparentColor();
  263.        m_nTransitionEffectWandWidth        = m_LeadDlg.GetWandWidth();
  264.        m_nTransitionEffectWandColor        = m_LeadDlg.GetWandColor();
  265.  
  266.       m_ShowTransition.SetCheck(TRUE);
  267.  
  268.       GetWindowRect(rcRect);
  269.       InvalidateRect(rcRect, FALSE);
  270.    }
  271. }
  272.  
  273. void CFxDemoDlg::OnShape() 
  274. {
  275.    int   nResult;
  276.    CRect rcRect;
  277.  
  278.    m_LeadDlg.SetShape(m_nShapeStyle);
  279.     m_LeadDlg.SetShapeBackStyle(m_nShapeBackStyle);
  280.     m_LeadDlg.SetShapeFillStyle(m_nShapeFillStyle);
  281.     m_LeadDlg.SetShapeBorderColor(m_nShapeBorderColor);
  282.     m_LeadDlg.SetShapeBorderStyle(m_nShapeBorderStyle);
  283.     m_LeadDlg.SetShapeBorderWidth(m_nShapeBorderWidth);
  284.     m_LeadDlg.SetShapeInnerStyle(m_nShapeInnerStyle);
  285.     m_LeadDlg.SetShapeInnerWidth(m_nShapeInnerWidth);
  286.     m_LeadDlg.SetShapeInnerHiliteColor(m_nShapeInnerHiliteColor);
  287.     m_LeadDlg.SetShapeInnerShadowColor(m_nShapeInnerShadowColor);
  288.     m_LeadDlg.SetShapeOuterStyle(m_nShapeOuterStyle);
  289.     m_LeadDlg.SetShapeOuterWidth(m_nShapeOuterWidth);
  290.     m_LeadDlg.SetShapeOuterHiliteColor(m_nShapeOuterHiliteColor);
  291.     m_LeadDlg.SetShapeOuterShadowColor(m_nShapeOuterShadowColor);
  292.     m_LeadDlg.SetShadowXDepth(m_nShapeShadowXDepth);
  293.     m_LeadDlg.SetShadowYDepth(m_nShapeShadowYDepth);
  294.     m_LeadDlg.SetShadowColor(m_nShapeShadowColor);
  295.     m_LeadDlg.SetForeColor(m_nShapeForeColor);
  296.     m_LeadDlg.SetBackColor(m_nShapeBackColor);
  297.  
  298.    m_LeadDlg.SetUIFlags(DLG_SHAPE_SHOWPREVIEW |
  299.                         DLG_SHAPE_BACKSTYLE |
  300.                         DLG_SHAPE_FILLSTYLE |
  301.                         DLG_SHAPE_FORE_BACK_COLOR |
  302.                         DLG_SHAPE_BORDERSTYLE |
  303.                         DLG_SHAPE_BORDERWIDTH |
  304.                         DLG_SHAPE_BORDERCOLOR |
  305.                         DLG_SHAPE_INNERSTYLE |
  306.                         DLG_SHAPE_INNERWIDTH |
  307.                         DLG_SHAPE_INNER_HILITE_SHADOW |
  308.                         DLG_SHAPE_OUTERSTYLE |
  309.                         DLG_SHAPE_OUTERWIDTH |
  310.                         DLG_SHAPE_OUTER_HILITE_SHADOW |
  311.                         DLG_SHAPE_SHADOWCOLOR |
  312.                         DLG_SHAPE_SHADOW_X_Y |
  313.                         DLG_SHAPE_BROWSEIMAGE |
  314.                         DLG_SHAPE_CLASS_SQUARE |
  315.                         DLG_SHAPE_CLASS_RECTANGLE |
  316.                         DLG_SHAPE_CLASS_PARALLELOGRAM |
  317.                         DLG_SHAPE_CLASS_TRAPEZOID |
  318.                         DLG_SHAPE_CLASS_TRIANGLE |
  319.                         DLG_SHAPE_CLASS_OTHER |
  320.                         DLG_SHAPE_CLASS_CIRCLE |
  321.                         DLG_SHAPE_CLASS_ELLIPSE |
  322.                         DLG_SHAPE_CLASS_STAR |
  323.                         DLG_SHAPE_CLASS_CROSS |
  324.                         DLG_SHAPE_CLASS_ARROW);
  325.  
  326.    m_LeadDlg.SetBitmap(m_Lead.GetBitmap());
  327.     m_LeadDlg.SetShapeBackgroundBitmap(m_LeadShape.GetBitmap());
  328.  
  329.    nResult = m_LeadDlg.Get3dShape((long)this->m_hWnd);
  330.    if (nResult == 0)
  331.    {
  332.        m_nShapeStyle              = m_LeadDlg.GetShape();
  333.        m_nShapeBackStyle          = m_LeadDlg.GetShapeBackStyle();
  334.        m_nShapeFillStyle          = m_LeadDlg.GetShapeFillStyle();
  335.        m_nShapeBorderColor        = m_LeadDlg.GetShapeBorderColor();
  336.        m_nShapeBorderStyle        = m_LeadDlg.GetShapeBorderStyle();
  337.        m_nShapeBorderWidth        = m_LeadDlg.GetShapeBorderWidth();
  338.        m_nShapeInnerStyle         = m_LeadDlg.GetShapeInnerStyle();
  339.        m_nShapeInnerWidth         = m_LeadDlg.GetShapeInnerWidth();
  340.        m_nShapeInnerHiliteColor   = m_LeadDlg.GetShapeInnerHiliteColor();
  341.        m_nShapeInnerShadowColor   = m_LeadDlg.GetShapeInnerShadowColor();
  342.        m_nShapeOuterStyle         = m_LeadDlg.GetShapeOuterStyle();
  343.        m_nShapeOuterWidth         = m_LeadDlg.GetShapeOuterWidth();
  344.        m_nShapeOuterHiliteColor   = m_LeadDlg.GetShapeOuterHiliteColor();
  345.        m_nShapeOuterShadowColor   = m_LeadDlg.GetShapeOuterShadowColor();
  346.        m_nShapeShadowXDepth       = m_LeadDlg.GetShadowXDepth();
  347.        m_nShapeShadowYDepth       = m_LeadDlg.GetShadowYDepth();
  348.        m_nShapeShadowColor        = m_LeadDlg.GetShadowColor();
  349.        m_nShapeForeColor          = m_LeadDlg.GetForeColor();
  350.        m_nShapeBackColor          = m_LeadDlg.GetBackColor();
  351.        m_LeadShape.SetBitmap(m_LeadDlg.GetShapeBackgroundBitmap());
  352.       m_LeadShape.Size(m_Lead.GetScaleWidth(), m_Lead.GetScaleHeight(), RESIZE_NORMAL);
  353.  
  354.       m_ShowShape.SetCheck(TRUE);
  355.  
  356.       GetWindowRect(rcRect);
  357.       InvalidateRect(rcRect, FALSE);
  358.    }
  359. }
  360.  
  361. void CFxDemoDlg::OnText() 
  362. {
  363.    int   nResult;
  364.    CRect rcRect;
  365.  
  366.    m_LeadDlg.SetSampleText((LPCTSTR)m_strTextSample);
  367.     m_LeadDlg.SetTextStyle(m_nTextStyle);
  368.     m_LeadDlg.SetTextAlign(m_nTextAlign);
  369.     m_LeadDlg.SetTextWordWrap(m_nTextWordWrap);
  370.     m_LeadDlg.SetTextColor(m_nTextColor);
  371.     m_LeadDlg.SetTextHiliteColor(m_nTextHiliteColor);
  372.     m_LeadDlg.SetTextUseForegroundImage(m_nTextUseForegroundImage);
  373.     m_LeadDlg.SetShadowXDepth(m_nTextShadowXDepth);
  374.     m_LeadDlg.SetShadowYDepth(m_nTextShadowYDepth);
  375.     m_LeadDlg.SetShadowColor(m_nTextShadowColor);
  376.     m_LeadDlg.SetAngle(m_nTextAngle);
  377.    m_LeadDlg.SetFont(m_oleTextFont);
  378.  
  379.    m_LeadDlg.SetUIFlags(DLG_TEXT_SHOWPREVIEW |
  380.                         DLG_TEXT_SAMPLETEXT |
  381.                         DLG_TEXT_STYLE |
  382.                         DLG_TEXT_COLOR |
  383.                         DLG_TEXT_BORDERCOLOR |
  384.                         DLG_TEXT_ALIGN |
  385.                         DLG_TEXT_ANGLE |
  386.                         DLG_TEXT_WORDWRAP |
  387.                         DLG_TEXT_FONT |
  388.                         DLG_TEXT_FOREIMAGE |
  389.                         DLG_TEXT_BROWSEIMAGE |
  390.                         DLG_TEXT_SHADOWCOLOR |
  391.                         DLG_TEXT_SHADOW_X_Y);
  392.  
  393.    m_LeadDlg.SetBitmap(m_Lead.GetBitmap());
  394.     m_LeadDlg.SetTextForegroundBitmap(m_LeadText.GetBitmap());
  395.    
  396.    nResult = m_LeadDlg.Get3dText((long)this->m_hWnd);
  397.    if (nResult == 0)
  398.    {
  399.        m_strTextSample             = m_LeadDlg.GetSampleText();
  400.        m_nTextStyle                = m_LeadDlg.GetTextStyle();
  401.        m_nTextAlign                = m_LeadDlg.GetTextAlign();
  402.        m_nTextWordWrap             = m_LeadDlg.GetTextWordWrap();
  403.        m_nTextColor                = m_LeadDlg.GetTextColor();
  404.        m_nTextHiliteColor          = m_LeadDlg.GetTextHiliteColor();
  405.        m_nTextUseForegroundImage   = m_LeadDlg.GetTextUseForegroundImage();
  406.        m_nTextShadowXDepth         = m_LeadDlg.GetShadowXDepth();
  407.        m_nTextShadowYDepth         = m_LeadDlg.GetShadowYDepth();
  408.        m_nTextShadowColor          = m_LeadDlg.GetShadowColor();
  409.        m_nTextAngle                = m_LeadDlg.GetAngle();
  410.       m_oleTextFont               = m_LeadDlg.GetFont();
  411.        m_LeadText.SetBitmap(m_LeadDlg.GetTextForegroundBitmap());
  412.       m_LeadText.Size(m_Lead.GetScaleWidth(), m_Lead.GetScaleHeight(), RESIZE_NORMAL);
  413.  
  414.       m_ShowText.SetCheck(TRUE);
  415.  
  416.       GetWindowRect(rcRect);
  417.       InvalidateRect(rcRect, FALSE);
  418.    }
  419. }
  420.  
  421. void CFxDemoDlg::OnShow() 
  422. {
  423.    int   nResult;
  424.  
  425.    //-----Begin Transition------------------------------------------------------
  426.  
  427.    if (m_ShowTransition.GetCheck())
  428.    {
  429.       if (m_nTransitionStyle <= EFX_PATTERN_MAX)
  430.       {
  431.          m_Lead.SetTransitionStyle(EFX_TRANSITION_PATTERN);
  432.  
  433.          if (m_nTransitionStyle == EFX_PATTERN_SOLID)
  434.          {
  435.              m_Lead.SetPatternStyle(m_nTransitionStyle);
  436.          }
  437.          else
  438.          {
  439.               m_Lead.SetPatternStyle(m_nTransitionStyle+1);
  440.          }
  441.           m_Lead.SetPatternForeColor(m_nTransitionForeColor);
  442.           m_Lead.SetPatternBackColor(m_nTransitionBackColor);
  443.       }
  444.       else
  445.       {
  446.          m_Lead.SetTransitionStyle(EFX_TRANSITION_GRADIENT);
  447.           m_Lead.SetGradientStyle(m_nTransitionStyle);
  448.           m_Lead.SetGradientStartColor(m_nTransitionForeColor);
  449.           m_Lead.SetGradientEndColor(m_nTransitionBackColor);
  450.           m_Lead.SetGradientSteps(m_nTransitionSteps);
  451.       }
  452.       
  453.       m_Lead.SetTransitionEffect(m_nTransitionEffectStyle);
  454.        m_Lead.SetEffectGrain(m_nTransitionEffectGrain);
  455.         m_Lead.SetEffectDelay(m_nTransitionEffectDelay);
  456.         m_Lead.SetPaintMaxPasses(m_nTransitionEffectMaxPass);
  457.         m_Lead.SetUseTransparentColor(m_nTransitionEffectTransparent);
  458.         m_Lead.SetTransparentColor(m_nTransitionEffectTransparentColor);
  459.         m_Lead.SetWandSize(m_nTransitionEffectWandWidth);
  460.         m_Lead.SetWandColor(m_nTransitionEffectWandColor);
  461.    }
  462.    else
  463.    {
  464.        m_Lead.SetTransitionEffect(EFX_EFFECT_NONE);
  465.       m_Lead.SetTransitionStyle(EFX_TRANSITION_NONE);
  466.    }
  467.  
  468.    //-----End Transition--------------------------------------------------------
  469.  
  470.    //-----Begin Effect----------------------------------------------------------
  471.  
  472.    if (m_nFileIndex >= sizeof(szFileName) / sizeof(szFileName[0]))
  473.    {
  474.       m_nFileIndex = 0;
  475.    }
  476.  
  477.    nResult = m_Lead.Load(szFileName[m_nFileIndex], 0, 0, 1);
  478.    if (nResult != 0)
  479.    {
  480.       AfxMessageBox("Please change the filenames.");
  481.       return;
  482.    }
  483.  
  484.    m_nFileIndex++;
  485.  
  486.    m_Lead.SetPaintEffect(m_nEffectStyle);
  487.      m_Lead.SetEffectGrain(m_nEffectGrain);
  488.     m_Lead.SetEffectDelay(m_nEffectDelay);
  489.     m_Lead.SetPaintMaxPasses(m_nEffectMaxPass);
  490.     m_Lead.SetUseTransparentColor(m_nEffectTransparent);
  491.     m_Lead.SetTransparentColor(m_nEffectTransparentColor);
  492.     m_Lead.SetWandSize(m_nEffectWandWidth);
  493.     m_Lead.SetWandColor(m_nEffectWandColor);
  494.  
  495.    m_Lead.ForceRepaint();
  496.  
  497.    //-----End Effect------------------------------------------------------------
  498.  
  499.    //-----Begin Shape-----------------------------------------------------------
  500.  
  501.    if (m_ShowShape.GetCheck())
  502.    {
  503.       m_Lead.SetShapeLeft(0.0f);
  504.        m_Lead.SetShapeTop(0.0f);
  505.        m_Lead.SetShapeWidth((float)m_Lead.GetScaleWidth());
  506.        m_Lead.SetShapeHeight((float)m_Lead.GetScaleHeight());
  507.  
  508.        m_Lead.SetShapeBorderThickness(m_nShapeBorderWidth);
  509.        m_Lead.SetShapeBorderColor(m_nShapeBorderColor);
  510.  
  511.        m_Lead.SetShapeInnerBandStyle(m_nShapeInnerStyle);
  512.        m_Lead.SetShapeInnerBandThickness(m_nShapeInnerWidth);
  513.        m_Lead.SetShapeInnerBandHiliteColor(m_nShapeInnerHiliteColor);
  514.        m_Lead.SetShapeInnerBandShadowColor(m_nShapeInnerShadowColor);
  515.  
  516.        m_Lead.SetShapeOuterBandStyle(m_nShapeOuterStyle);
  517.        m_Lead.SetShapeOuterBandThickness(m_nShapeOuterWidth);
  518.        m_Lead.SetShapeOuterBandHiliteColor(m_nShapeOuterHiliteColor);
  519.        m_Lead.SetShapeOuterBandShadowColor(m_nShapeOuterShadowColor);
  520.  
  521.        m_Lead.SetShapeBackgroundStyle(m_nShapeBackStyle);
  522.  
  523.        m_Lead.SetShapeBorderStyle(m_nShapeBorderStyle);
  524.  
  525.        m_Lead.SetShadowXDepth(m_nShapeShadowXDepth);
  526.        m_Lead.SetShadowYDepth(m_nShapeShadowYDepth);
  527.        m_Lead.SetShadowColor(m_nShapeShadowColor);
  528.  
  529.       m_Lead.SetBackgroundImageLeft(0.0f);
  530.       m_Lead.SetBackgroundImageTop(0.0f);
  531.       m_Lead.SetBackgroundImageWidth((float)m_Lead.GetScaleWidth());
  532.       m_Lead.SetBackgroundImageHeight((float)m_Lead.GetScaleHeight());
  533.  
  534.       if (m_nShapeFillStyle < EFX_PATTERN_MAX)
  535.       {
  536.          m_Lead.SetTransitionStyle(EFX_TRANSITION_PATTERN);
  537.          m_Lead.SetPatternStyle(m_nShapeFillStyle);
  538.          m_Lead.SetPatternForeColor(m_nShapeForeColor);
  539.           m_Lead.SetPatternBackColor(m_nShapeBackColor);
  540.       }
  541.       else
  542.       {
  543.          m_Lead.SetTransitionStyle(EFX_TRANSITION_GRADIENT);
  544.           m_Lead.SetGradientStyle(m_nShapeFillStyle);
  545.           m_Lead.SetGradientStartColor(m_nShapeForeColor);
  546.           m_Lead.SetGradientEndColor(m_nShapeBackColor);
  547.       }
  548.  
  549.       m_Lead.DrawShape(m_nShapeStyle, m_LeadShape.GetBitmap());
  550.    }
  551.  
  552.    //-----End Shape-------------------------------------------------------------
  553.  
  554.    //-----Begin Text------------------------------------------------------------
  555.  
  556.    if (m_ShowText.GetCheck())
  557.    {
  558.       m_Lead.SetFont(m_oleTextFont);
  559.  
  560.       m_Lead.SetTextLeft(m_Lead.GetScaleWidth() * 0.1f);
  561.        m_Lead.SetTextTop(m_Lead.GetScaleHeight() * 0.1f);
  562.        m_Lead.SetTextWidth(m_Lead.GetScaleWidth() * 0.8f);
  563.        m_Lead.SetTextHeight(m_Lead.GetScaleHeight() * 0.8f);
  564.        m_Lead.SetTextAngle((short)m_nTextAngle);
  565.        m_Lead.SetTextStyle(m_nTextStyle);
  566.        m_Lead.SetTextAlign(m_nTextAlign);
  567.        m_Lead.SetTextWordWrap(m_nTextWordWrap);
  568.        m_Lead.SetTextHiliteColor(m_nTextHiliteColor);
  569.    
  570.       m_Lead.SetDrawFontColor(m_nTextColor);
  571.  
  572.       m_Lead.SetShadowXDepth(m_nTextShadowXDepth);
  573.        m_Lead.SetShadowYDepth(m_nTextShadowYDepth);
  574.        m_Lead.SetShadowColor(m_nTextShadowColor);
  575.  
  576.        if (m_nTextUseForegroundImage)
  577.       {
  578.          m_Lead.DrawText((LPCTSTR)m_strTextSample, m_LeadText.GetBitmap());
  579.       }
  580.       else
  581.       {
  582.          m_Lead.DrawText((LPCTSTR)m_strTextSample, 0);
  583.       }
  584.    }
  585.  
  586.    //-----End Text--------------------------------------------------------------
  587. }
  588.  
  589. void CFxDemoDlg::OnPaint() 
  590. {
  591.     CPaintDC dc(this); // device context for painting
  592.     
  593.    OnShow();
  594. }
  595.