⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 a.htm

📁 实现椭圆对话框
💻 HTM
📖 第 1 页 / 共 3 页
字号:
            cellPadding=0 cellSpacing=0 width="100%">
              <TBODY>
              <TR bgColor=#666666>
                <TD height=19>
                  <DIV align=center><SPAN class=lianjie2><A class=top3 
                  href="http://www.vcroad.com/BigClass.asp?BigClassID=9&amp;BigClassName=代码中心&amp;BigClassType=1">代码中心</A></SPAN></DIV></TD></TR></TBODY></TABLE></TD>
          <TD align=middle bgColor=#000033 height=18>
            <TABLE border=1 borderColorDark=#ffffff borderColorLight=#cccccc 
            cellPadding=0 cellSpacing=0 width="100%">
              <TBODY>
              <TR bgColor=#666666>
                <TD height=19>
                  <DIV align=center><SPAN class=lianjie2><A class=top3 
                  href="http://www.vcroad.com/BigClass.asp?BigClassID=10&amp;BigClassName=资源中心&amp;BigClassType=1">资源中心</A></SPAN></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="98%">
  <TBODY>
  <TR>
    <TD bgColor=#ffffff width=1></TD>
    <TD align=left bgColor=#ffffff class=top4 height=20 
    style="BORDER-BOTTOM: #000000 1px double">
      <TABLE border=1 borderColorDark=#ffffff borderColorLight=#cccccc 
      cellPadding=0 cellSpacing=0 width="100%">
        <TBODY>
        <TR bgColor=#e4e4e4>
          <TD height=19>
            <DIV align=left></DIV>
          <TD align=left bgColor=#ffffff class=top4 height=20 
          style="BORDER-BOTTOM: #000000 1px double">
            <TABLE border=1 borderColorDark=#ffffff borderColorLight=#cccccc 
            cellPadding=0 cellSpacing=0 width="100%">
              <TBODY>
              <TR bgColor=#e4e4e4>
                <TD height=19>
                  <DIV align=left><IMG border=0 
                  src="A.files/where.gif">&nbsp;当前位置:<A class=top4 
                  href="http://www.vcroad.com/default.asp">首 页</A> &gt; 阅读文章 
                  </DIV></TD></TR></TBODY></TABLE></TD>
          <TD align=middle bgColor=#ffffff class=top4 height=20 
          style="BORDER-BOTTOM: #000000 1px double">
            <TABLE border=1 borderColorDark=#ffffff borderColorLight=#cccccc 
            cellPadding=0 cellSpacing=0 width="100%">
              <TBODY>
              <TR bgColor=#e4e4e4>
                <TD height=19>
                  <DIV align=center><A href="javascript:window.print()"><IMG 
                  alt=打印本页 border=0 height=14 src="A.files/printer.gif" 
                  width=16></A></DIV></TD></TR></TBODY></TABLE></TD>
          <TD bgColor=#ffffff width=1></TD></TR></TBODY></TABLE>
      <TABLE align=center border=0 cellPadding=0 cellSpacing=0 width="99%">
        <TBODY>
        <TR>
          <TD width="79%">&nbsp; </TD>
          <TD width="21%">
            <TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
              <TBODY>
              <TR>
                <TD width=0%>&nbsp;</TD>
                <TD bgColor=#ffffff width="20%">
                  <DIV align=center><IMG height=19 
                  src="A.files/title_new_left.gif" width=39></DIV></TD>
                <TD bgColor=#666666 width="80%">
                  <TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
                    <TBODY>
                    <TR>
                      <TD bgColor=#666666 height=10 width="23%">
                        <DIV align=center></DIV></TD>
                      <TD bgColor=#666666 height=10 width="38%">
                        <DIV align=right></DIV></TD>
                      <TD bgColor=#666666 height=10 width="39%">
                        <DIV align=right><IMG height=19 
                        src="A.files/title_right_2.jpeg" 
                    width=60></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
      <TABLE align=center bgColor=#666666 border=0 cellPadding=0 cellSpacing=0 
      width="99%">
        <TBODY>
        <TR>
          <TD height=6></TD></TR></TBODY></TABLE>
      <TABLE align=center border=0 cellPadding=0 cellSpacing=0 width="99%">
        <TBODY>
        <TR>
          <TD height=178 width="79%">
            <TABLE align=center border=0 cellPadding=0 cellSpacing=0 
            style="TABLE-LAYOUT: fixed" width="100%">
              <TBODY>
              <TR></TR>
              <TR>
                <TD align=middle class=NEWSREADME colSpan=2>
                  <TABLE bgColor=#009933 border=1 borderColorDark=#ffffff 
                  borderColorLight=#cccccc cellPadding=0 cellSpacing=0 
                  width="100%">
                    <TBODY>
                    <TR bgColor=#e4e4e4>
                      <TD height=4>
                        <DIV align=center><IMG height=16 src="A.files/note.jpeg" 
                        width=16> 
<B>如何创建一个不规则形状的窗口</B></DIV></TD></TR></TBODY></TABLE>
                  <P>时间:2002-10-13 11:50:02&nbsp;阅读 <FONT 
                  color=#ff0000>1065</FONT> 次</P></TD></TR>
              <TR>
                <TD align=middle colSpan=2>
                  <TABLE align=center border=0 cellPadding=0 cellSpacing=0 
                  style="TABLE-LAYOUT: fixed" width="98%">
                    <TBODY>
                    <TR>
                      <TD class=news style="WORD-WRAP: break-word">
                        <P align=center><FONT face=system size=-1>&nbsp;</P>
                        <P>可以使用新的SDK函数SetWindowRgn。该函数将绘画和鼠标消息限定在窗口的一个指定的区域,实际上使窗口成为指定的不规则形状。 
                        </P>
                        <P>使用AppWizard创建一个基于对话框的应用程序并使用资源编辑器从主对话资源中删除有的缺省控件、标题以及边界。 
                        </P>
                        <P>给对话类增加一个CRgn数据成员,以后要使用该数据成员建立窗口区域。 <BR>Class 
                        CRoundDlg : public CDialog <BR>{ … <BR>private : 
                        <BR>Crgn m_rgn : // window region <BR>…} 
                        <BR>修改OnInitDialog函数建立一个椭圆区域并调用SetWindowRgn将该区域分配给窗口: 
                        <BR>BOOL CRoundDlg : : OnInitDialog ( ) <BR>{ </P>
                        <P>CDialog : : OnInitDialog ( ) </P>
                        <P>//Get size of dialog . </P>
                        <P>CRect rcDialog ; </P>
                        <P>GetClientRect (rcDialog ) </P>
                        <P>// Create region and assign to window . </P>
                        <P>m_rgn . CreateEllipticRgn (0 , 0 , rcDialog.Width( ), 
                        </P>
                        <P>rcDialog.Height ( ) ) </P>
                        <P>SetWindowRgn (GetSafeHwnd ( ) , (HRGN) m_ rgn ,TRUE 
                        ); </P>
                        <P>return TRUE <BR>} 
                        <BR>通过建立区域和调用SetWindowRgn,已经建立一个不规则形状的窗口,下面的例子程序是修改OnPaint函数使窗口形状看起来象一个球形体。 
                        <BR>voik CRoundDlg : : OnPaint ( ) <BR>{ <BR>CPaintDC de 
                        (this) // device context for painting. <BR>//draw 
                        ellipse with out any border <BR>dc. SelecStockObject 
                        (NULL_PEN) <BR>//get the RGB colour components of the 
                        sphere color <BR>COLORREF color= RGB( 0 , 0 , 255) 
                        <BR>BYTE byRed =GetRValue (color) <BR>BYTE byGreen = 
                        GetGValue (color) <BR>BYTE byBlue = GetBValue (color) 
                        <BR>// get the size of the view window Crect <BR>rect 
                        GetClientRect (rect) <BR>// get minimun number of units 
                        <BR>int nUnits =min (rect.right , rect.bottom ) 
                        <BR>//calculate he horiaontal and vertical step size 
                        <BR>float fltStepHorz = (float) rect.right /nUnits 
                        <BR>float fltStepVert = (float) rect.bottom /nUnits 
                        <BR>int nEllipse = nUnits/3 // calculate how many todraw 
                        int nIndex <BR>// current ellipse that is being draw 
                        <BR>CBrush brush <BR>// bursh used for ellipse fill 
                        color <BR>CBrush *pBrushOld // previous brush that was 
                        selected into dc <BR>//draw ellipse , gradually moving 
                        towards upper-rightcorner <BR>for (nIndex = 0 nIndes 
                        &lt; + nEllipse nIndes++) <BR>{ //creat solid brush 
                        brush . <BR>CreatSolidBrush (RGB ( ( (nIndex*byRed ) 
                        /nEllipse ). </P>
                        <P>( ( nIndex * byGreen ) /nEllipse ), ( 
                        (nIndex*byBlue)/nEllipse ) ) ) <BR>//select brush into 
                        dc <BR>pBrushOld= dc .SelectObject (&amp;brhsh) 
                        <BR>//draw ellipse <BR>dc .Ellipse ( (int) fltStepHorz * 
                        2, (int)fltStepVert * nIndex , <BR>rect. right -( 
                        (int)fltStepHorz * nIndex )+ 1, rect . bottom -( (int) 
                        <BR>fltStepVert * (nIndex *2) ) +1) <BR>//delete the 
                        brush <BR>brush.DelecteObject ( ) <BR>} } 
                        <BR>最后,处理WM_NCHITTEST消息,使当击打窗口的任何位置时能移动窗口。 <BR>UINT 
                        CRoundDlg : : OnNchitTest (Cpoint point ) <BR>{ 
                        <BR>//Let user move window by clickign anywhere on 
                        thewindow . <BR>UINT nHitTest = CDialog : : OnNcHitTest 
                        (point) <BR>rerurn (nHitTest = = HTCLIENT)? HTCAPTION: 
                        nHitTest <BR>} </FONT></P></TD></TR></TBODY></TABLE></TD></TR>
              <TR align=right>
                <TD colSpan=2>责任编辑:VCRoad(朱彦力)&nbsp;(共计 743 篇) </TD></TR>
              <TR>
                <TD colSpan=2></TD></TR>
              <TR>
                <TD colSpan=2>&nbsp; </TD></TR></TBODY></TABLE>
            <TABLE align=center border=0 cellPadding=0 cellSpacing=0 
width="98%">
              <TBODY>
              <TR>
                <TD><LINK href="A.files/style.css" rel=stylesheet 
                  type=text/css>
                  <FIELDSET> 
                  <LEGEND align=left>╣ 如何创建一个不规则形状的窗口 <FONT 
                  color=#ff0000><B>[回复数: 2]</B></FONT> ╠</LEGEND>
                  <TABLE bgColor=#ffffff border=0 borderColorLight=#ffffff 
                  cellSpacing=0 class=TableLine style="TABLE-LAYOUT: fixed" 
                  width="100%">
                    <TBODY>
                    <TR>
                      <TD class=MainContentS style="WORD-WRAP: break-word">
                        <DIV align=right>
                        <TABLE border=1 borderColorDark=#ffffff 
                        borderColorLight=#cccccc cellPadding=0 cellSpacing=0 
                        width="100%">
                          <TBODY>
                          <TR bgColor=#e4e4e4>
                            <TD height=12 width="14%">
                              <DIV align=left><IMG src="A.files/gbook.gif"><FONT 
                              color=#666666>zg</FONT></DIV></TD>
                            <TD height=12 width="54%">&nbsp;</TD>
                            <TD height=12 width="32%">
                              <DIV align=right><FONT color=#666666 
                              size=2>[2002-11-6发表] </FONT><FONT 
                              size=2></FONT></DIV></TD></TR></TBODY></TABLE><BR></DIV>太厉害了 
                        <BR></TD></TR>
                    <TR>
                      <TD class=MainContentS style="WORD-WRAP: break-word">
                        <DIV align=right>
                        <TABLE border=1 borderColorDark=#ffffff 
                        borderColorLight=#cccccc cellPadding=0 cellSpacing=0 
                        width="100%">
                          <TBODY>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -