亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? splitter.html

?? windows系統編程 一本很好的書!值得看哦!
?? HTML
?? 第 1 頁 / 共 2 頁
字號:
The mouse cursor, <b>IDC_SIZEWE</b>, that we associate with the splitter class is the standard Size-West-East double arrow. We also set the background brush to <b>COLOR_3DFACE</b>.
<p>The splitter's window procedure deals with splitter's creation/destruction, painting and mouse dragging.
<hr>
         <!--Yellow background-->
        <table cellpadding=10 cellspacing=0 width="100%">
                <tr>
                      <td width=20>&nbsp;</td>
                      <td bgcolor="#e0e080"><font color="#000000">
<pre>LRESULT CALLBACK WndProcSplitter (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    SplitController * pCtrl = GetWinLong&lt;SplitController *&gt; (hwnd);
    switch (message)
    {
    case WM_CREATE:
        try
        {
            pCtrl = new SplitController (hwnd, reinterpret_cast&lt;CREATESTRUCT *&gt;(lParam));
            SetWinLong&lt;SplitController *&gt; (hwnd, pCtrl);
        }
        catch (char const * msg)
        {
            MessageBox (hwnd, msg, "Initialization", 
                MB_ICONEXCLAMATION | MB_OK);
            return -1;
        }
        catch (...)
        {
            MessageBox (hwnd, "Unknown Error", "Initialization", 
                MB_ICONEXCLAMATION | MB_OK);
            return -1;
        }
        return 0;
    case WM_SIZE:
        pCtrl-&gt;Size (LOWORD(lParam), HIWORD(lParam));
        return 0;
    case WM_PAINT:
        pCtrl-&gt;Paint ();
        return 0;
    case WM_LBUTTONDOWN:
        pCtrl-&gt;LButtonDown (MAKEPOINTS (lParam));
        return 0;
    case WM_LBUTTONUP:
        pCtrl-&gt;LButtonUp (MAKEPOINTS (lParam));
        return 0;
    case WM_MOUSEMOVE:
        if (wParam &amp; MK_LBUTTON)
            pCtrl-&gt;LButtonDrag (MAKEPOINTS (lParam));
        return 0;
    case WM_CAPTURECHANGED:
        pCtrl-&gt;CaptureChanged ();
        return 0;
    case WM_DESTROY:
        SetWinLong&lt;SplitController *&gt; (hwnd, 0);
        delete pCtrl;
        return 0;
    }
    return ::DefWindowProc (hwnd, message, wParam, lParam);
}</pre>
<!--End Code--></font>
                       </td>
                       <td width=20>&nbsp;</td>
        </tr>
        </table>
        <!--End of yellow background-->
<hr>
This is all pretty much standard code. The details, as usual, are in the controller's methods. The constructor is very simple.
<hr>
         <!--Yellow background-->
        <table cellpadding=10 cellspacing=0 width="100%">
                <tr>
                      <td width=20>&nbsp;</td>
                      <td bgcolor="#e0e080"><font color="#000000">
<pre>SplitController::SplitController (HWND hwnd, CREATESTRUCT * pCreat)
    : _hwnd (hwnd), 
      _hwndParent (pCreat-&gt;hwndParent)
{}</pre>
<!--End Code--></font>
                       </td>
                       <td width=20>&nbsp;</td>
        </tr>
        </table>
        <!--End of yellow background-->
<hr>
Painting is more interesting. We have to imitate Windows 2.5-dimensional effects. We do it with a carfuly chosen selection of pens.
<hr>
         <!--Yellow background-->
        <table cellpadding=10 cellspacing=0 width="100%">
                <tr>
                      <td width=20>&nbsp;</td>
                      <td bgcolor="#e0e080"><font color="#000000">
<pre>class Pens3d
{
public:
    Pens3d ();
    Pen &amp; Hilight () { return _penHilight; }
    Pen &amp; Light () { return _penLight; }
    Pen &amp; Shadow () { return _penShadow; }
    Pen &amp; DkShadow () { return _penDkShadow; }
private:
    Pen        _penHilight;
    Pen        _penLight;
    Pen        _penShadow;
    Pen        _penDkShadow;
};

Pens3d::Pens3d ()
:
    _penLight (<font color="#000099"><b>GetSysColor</b></font> (<font color="#009966">COLOR_3DLIGHT</font>)),
    _penHilight (<font color="#000099"><b>GetSysColor</b></font> (<font color="#009966">COLOR_3DHILIGHT</font>)),
    _penShadow (<font color="#000099"><b>GetSysColor</b></font> (<font color="#009966">COLOR_3DSHADOW</font>)),
    _penDkShadow (<font color="#000099"><b>GetSysColor</b></font> (<font color="#009966">COLOR_3DDKSHADOW</font>))
{}

void SplitController::Paint ()
{
    PaintCanvas canvas (_hwnd);
    {
        PenHolder pen (canvas, _pens.Light ());
        canvas.Line (0, 0, 0, _cy - 1);
    }
    {
        PenHolder pen (canvas, _pens.Hilight ());
        canvas.Line (1, 0, 1, _cy - 1);
    }
    {
        PenHolder pen (canvas, _pens.Shadow ());
        canvas.Line (_cx - 2, 0, _cx - 2, _cy - 1);
    }
    {
        PenHolder pen (canvas, _pens.DkShadow ());
        canvas.Line (_cx - 1, 0, _cx - 1, _cy - 1);
    }
}</pre>
<!--End Code--></font>
                       </td>
                       <td width=20>&nbsp;</td>
        </tr>
        </table>
        <!--End of yellow background-->
<hr>
The tricky part is the processing of mouse messages, although most of this code is pretty standard. We have to be able to deal with button-down, mouse drag and button-up.
<hr>

         <!--Yellow background-->
        <table cellpadding=10 cellspacing=0 width="100%">
                <tr>
                      <td width=20>&nbsp;</td>
                      <td bgcolor="#e0e080"><font color="#000000">
<pre>void <font color="#cc0066"><b>SplitController::LButtonDown</b></font> (POINTS pt)
{
    _hwnd.CaptureMouse ();
    // Find x offset of splitter
    // with respect to parent client area
    POINT ptOrg = {0, 0 };
    _hwndParent.ClientToScreen (ptOrg);
    int xParent = ptOrg.x;
    ptOrg.x = 0;
    _hwnd.ClientToScreen (ptOrg);
    int xChild = ptOrg.x;

    _dragStart = xChild - xParent + _cx / 2 - pt.x;

    _dragX = _dragStart + pt.x;

    // Draw a divider using XOR mode
    UpdateCanvas canvas (_hwndParent);
    ModeSetter mode (canvas, R2_NOTXORPEN);
    canvas.Line (_dragX, 0, _dragX, _cy - 1);

}</pre>
<!--End Code--></font>
                       </td>
                       <td width=20>&nbsp;</td>
        </tr>
        </table>
        <!--End of yellow background-->
<hr>
When the left mouse button is clicked over the client area of the splitter, we perform the following tasks. First, we capture the mouse. The user might, and probably will, drag the mouse cursor outside of the splitter bar. Capturing the mouse will ensure that all mouse messages will now be directed to us, even though the mouse cursor may wander all over the screen. 
<p>Next, we convert the local splitter-bar coordinates to the parent window coordinates. We do it by converting the parent's origin to screen coordinates and converting our (splitter's) origin to screen coordinates. The difference gives us our origin with respect to parent's client area. We do some more arithmetics in order to find the x coordinate of the center of the splitter, because that's what we'll be dragging.
<p>To give the user dragging feedback, we draw a single vertical line that will be dragged across the client area of the parent window. Notice two important details. The canvas that we are creating are associated with the parent--we are using the parent's window handle. The drawing mode is logical <b>xor</b> (exclusive or). That means that the pixels we are drawing are xor'd with the original pixels. Logical xor has this useful property that if you apply it twice, you restore the original. It's the oldest trick in computer graphics--the poor man's animation technique. You draw something using the xor mode and erase it simply by drawing it again in the xor mode. Just look at the dragging code below.
<hr>
         <!--Yellow background-->
        <table cellpadding=10 cellspacing=0 width="100%">
                <tr>
                      <td width=20>&nbsp;</td>
                      <td bgcolor="#e0e080"><font color="#000000">
<pre>void <font color="#cc0066"><b>SplitController::LButtonDrag</b></font> (POINTS pt)
{
	if (_hwnd.HasCapture ())
	{
        // Erase previous divider and draw new one
        UpdateCanvas canvas (_hwndParent);
        ModeSetter mode (canvas, R2_NOTXORPEN);
        canvas.Line (_dragX, 0, _dragX, _cy - 1);
        _dragX = _dragStart + pt.x;
        canvas.Line (_dragX, 0, _dragX, _cy - 1);
    }
}</pre>
<!--End Code--></font>
                       </td>
                       <td width=20>&nbsp;</td>
        </tr>
        </table>
        <!--End of yellow background-->
<hr>
We draw the vertical line in the xor mode using the previous remembered position. Since this is the second time we draw this line in the same place, the net result will be the restoration of the original pixels from under the line. Then we draw the new line in the new position, still in the xor mode. We remember this position, so that next time <b>LButtonDrag</b> is called we'll erase it too. And so on, until finally the user releases the mouse button. 
<hr>
         <!--Yellow background-->
        <table cellpadding=10 cellspacing=0 width="100%">
                <tr>
                      <td width=20>&nbsp;</td>
                      <td bgcolor="#e0e080"><font color="#000000">
<pre>void <font color="#cc0066"><b>SplitController::LButtonUp</b></font> (POINTS pt)
{
    // Calling ReleaseCapture will send us the WM_CAPTURECHANGED
    _hwnd.ReleaseMouse ();
    _hwndParent.SendMessage (MSG_MOVESPLITTER, _dragStart + pt.x);
}</pre>
<!--End Code--></font>
                       </td>
                       <td width=20>&nbsp;</td>
        </tr>
        </table>
        <!--End of yellow background-->
<hr>
At this point we should erase the vertical line for the last time. However, we don't do it directly--we use a little trick here. We release the mouse capture. As a side effect, Windows sends us the <b>WM_CAPTURECHANGED</b> message. It's during the processing of that message that we actually erase the vertical line.
<hr>

         <!--Yellow background-->
        <table cellpadding=10 cellspacing=0 width="100%">
                <tr>
                      <td width=20>&nbsp;</td>
                      <td bgcolor="#e0e080"><font color="#000000">
<pre>void <font color="#cc0066"><b>SplitController::CaptureChanged</b></font> ()
{
    // We are losing capture
    // End drag selection -- for whatever reason
    // Erase previous divider
    UpdateCanvas canvas (_hwndParent);
    ModeSetter mode (canvas, R2_NOTXORPEN);
    canvas.Line (_dragX, 0, _dragX, _cy - 1);
}</pre>
<!--End Code--></font>
                       </td>
                       <td width=20>&nbsp;</td>
        </tr>
        </table>
        <!--End of yellow background-->
<hr>
Why do we do that? It's because Windows can force us to release the mouse capture before the user releases the mouse button. It might happen, for instance, when another application suddenly decides to pop up its window while the user is in the middle of dragging. In such a case our window would never get the button-up message and, if we weren't clever, wouldn't be able to cleanly finish the drag. Fortunately, before taking away the mouse capture, Windows manages to send us the <b>WM_CAPTURECHANGED</b> message, and we take it as a clue to do our cleanup.
<p>Going back to <b>LButtonUp</b>--once the user finishes dragging, we send the parent our special message <b>MSG_MOVESPLITTER</b>, passing it the new position of the center of the splitter bar measured in parent's client area coordinates. You've already seen the client code response to this message.

<p>This is how one might define a client message.
<hr>
         <!--Yellow background-->
        <table cellpadding=10 cellspacing=0 width="100%">
                <tr>
                      <td width=20>&nbsp;</td>
                      <td bgcolor="#e0e080"><font color="#000000">
<pre>// Reserved by Reliable Software Library
const UINT MSG_RS_LIBRARY        = WM_USER + 0x4000;

// wParam = new position wrt parent's left edge
const UINT MSG_MOVESPLITTER        = MSG_RS_LIBRARY + 1;
</pre>
<!--End Code--></font>
                       </td>
                       <td width=20>&nbsp;</td>
        </tr>
        </table>
        <!--End of yellow background-->
<hr>
Finally, here's an excerpt from a very useful class <font color="#cc0066"><b>HWnd</b></font> that encapsulates a lot of basic Windows APIs that deal with windows. In particular, look at the methods <font color="#cc0066"><b>MoveDelayPaint</b></font> and <font color="#cc0066"><b>ForceRepaint</b></font> that we used in repainting the splitter bar.

<hr>
         <!--Yellow background-->
        <table cellpadding=10 cellspacing=0 width="100%">
                <tr>
                      <td width=20>&nbsp;</td>
                      <td bgcolor="#e0e080"><font color="#000000">
<pre>class <font color="#cc0066"><b>HWnd</b></font>
{
public:
    void <font color="#cc0066"><b>Update</b></font> ()
    { 
        ::<font color="#000099"><b>UpdateWindow</b></font> (_hwnd); 
    }
    // Moving
    void <font color="#cc0066"><b>Move</b></font> (int x, int y, int width, int height)
    {
        ::<font color="#000099"><b>MoveWindow</b></font> (_hwnd, x, y, width, height, TRUE);
    }
    void <font color="#cc0066"><b>MoveDelayPaint</b></font> (int x, int y, int width, int height)
    {
        ::<font color="#000099"><b>MoveWindow</b></font> (_hwnd, x, y, width, height, FALSE);
    }
    // Repainting
    void <font color="#cc0066"><b>Invalidate</b></font> ()
    {
        ::<font color="#000099"><b>InvalidateRect</b></font> (_hwnd, 0, TRUE);
    }
    void <font color="#cc0066"><b>ForceRepaint</b></font> ()
    {
        Invalidate ();
        Update ();
    }
private:
    <font color="#009966">HWND</font>    _hwnd;
};</pre>
<!--End Code--></font>
                       </td>
                       <td width=20>&nbsp;</td>
        </tr>
        </table>
        <!--End of yellow background-->
<hr>
<img src="images/brace.gif" width=16 height=16 border=0 alt="">As usual, you can <a href="source/splitter.zip">download</a> the complete source code of the application that was used in this example. Next tutorial talks about <a href="bitmap.html">bitmaps</a>.
<hr>
   <!-- end main box -->
   </td></tr>
   </table>
   </td>
   <td width=10><!-- Right margin -->&nbsp;</td>
   </tr>
</table> <!-- End main table -->



<layer src="http://www.spidersoft.com/ads/bwz468_60.htm" visibility=hidden id=a1 width=600 onload="moveToAbsolute(ad1.pageX,ad1.pageY); a1.clip.height=60;visibility='show';"></layer>
</body>
</html>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线播放国产精品二区一二区四区 | 91精品国产麻豆国产自产在线| 国产成a人亚洲精| 蜜臀av在线播放一区二区三区| 香蕉乱码成人久久天堂爱免费| 亚洲三级在线免费| 中文字幕在线一区| 中文字幕日韩av资源站| 综合在线观看色| 国产精品免费看片| 亚洲天天做日日做天天谢日日欢 | 暴力调教一区二区三区| 成人综合激情网| 成人在线视频一区| 色综合久久88色综合天天6| 99麻豆久久久国产精品免费| 成人av电影免费观看| 91麻豆高清视频| 欧美影片第一页| 欧美日本一区二区在线观看| 欧美男人的天堂一二区| 日韩一区二区三区电影| 久久综合久久综合久久综合| 久久影视一区二区| 国产精品久久久久7777按摩| 亚洲黄色在线视频| 日本大胆欧美人术艺术动态| 国产美女精品在线| 91激情在线视频| 欧美不卡视频一区| 中文字幕中文字幕在线一区| 亚洲成在人线免费| 国产传媒日韩欧美成人| av电影在线不卡| 欧美精品久久久久久久久老牛影院| 日韩欧美国产综合| 国产精品高潮呻吟| 青草国产精品久久久久久| 国产剧情一区二区三区| 91啦中文在线观看| 欧美大白屁股肥臀xxxxxx| 日本一区二区视频在线观看| 亚洲国产欧美在线人成| 日本成人在线不卡视频| 成人国产视频在线观看| 91精品中文字幕一区二区三区| 欧美精品一区二区久久婷婷 | 亚洲成av人片在www色猫咪| 国内成人精品2018免费看| 97精品电影院| 精品国产99国产精品| 亚洲欧美成人一区二区三区| 国内精品第一页| 欧美日韩五月天| 最新国产精品久久精品| 蜜桃视频一区二区三区在线观看| av亚洲精华国产精华精| 精品日韩一区二区| 手机精品视频在线观看| 9色porny自拍视频一区二区| 日韩欧美一级二级三级久久久| 一区二区三区四区精品在线视频 | av中文字幕在线不卡| 欧美成人综合网站| 日本在线不卡视频| 欧美影院一区二区| 亚洲乱码国产乱码精品精小说| 国产精品系列在线播放| 日韩一卡二卡三卡四卡| 一区二区三区av电影 | 在线观看精品一区| 久久久国产一区二区三区四区小说| 亚洲国产裸拍裸体视频在线观看乱了| 成人av午夜电影| 国产欧美日韩精品a在线观看| 蜜臀av性久久久久蜜臀aⅴ| 欧美伦理视频网站| 丝袜国产日韩另类美女| 欧美日韩精品一区二区三区四区| 中文字幕一区二区三区乱码在线 | 国产精品狼人久久影院观看方式| 午夜精品福利久久久| 亚洲欧洲国产专区| 伊人夜夜躁av伊人久久| 日韩限制级电影在线观看| 北条麻妃一区二区三区| 美女视频黄免费的久久| 亚洲欧美日韩小说| 国产日韩av一区| 日韩亚洲欧美综合| 欧美色图第一页| 成人免费av资源| 激情亚洲综合在线| 天天综合天天做天天综合| 亚洲国产成人午夜在线一区| 欧美日本在线观看| 91蝌蚪国产九色| 国产成人午夜电影网| 蜜桃久久av一区| 亚洲第一精品在线| 亚洲男人天堂一区| 国产精品久久久久久久久动漫 | 99精品桃花视频在线观看| 久久成人久久爱| 日韩精品色哟哟| 一区二区三区 在线观看视频| 国产女同性恋一区二区| 精品国产一区二区亚洲人成毛片| 欧美日韩一区二区电影| 91美女视频网站| 99国产精品99久久久久久| 国产精品夜夜嗨| 国产精品一线二线三线精华| 蜜桃免费网站一区二区三区| 日本亚洲视频在线| 午夜精品久久久久久久99水蜜桃 | 亚洲色图视频网站| 国产精品另类一区| 久久久精品天堂| 欧美大片一区二区三区| 日韩一区二区三| 日韩欧美国产午夜精品| 欧美一二三在线| 日韩免费看的电影| 欧美成人性福生活免费看| 日韩精品中文字幕在线不卡尤物 | 伊人夜夜躁av伊人久久| 亚洲一区中文日韩| 日韩国产一二三区| 美女性感视频久久| 国产成人小视频| 99re这里都是精品| 欧美四级电影在线观看| 欧美老女人第四色| 欧美v亚洲v综合ⅴ国产v| 久久蜜桃一区二区| 国产精品久久久久久久久免费相片 | 极品少妇一区二区三区精品视频 | 久久久久久久综合| 中文乱码免费一区二区| 国产精品不卡在线| 亚洲国产日韩a在线播放性色| 日韩福利电影在线观看| 久久99国产精品麻豆| 成人精品gif动图一区| 97精品超碰一区二区三区| 精品视频1区2区| 精品国偷自产国产一区| |精品福利一区二区三区| 亚洲国产欧美另类丝袜| 国内精品久久久久影院色 | 国产精品一区二区无线| 99精品国产视频| 欧美理论在线播放| 中文在线一区二区| 日韩影院在线观看| 国产精品白丝jk白祙喷水网站| 99久久精品99国产精品| 91精品国产入口在线| 国产欧美va欧美不卡在线| 午夜精品福利久久久| 国产夫妻精品视频| 欧美日本一道本| 国产亚洲综合av| 亚洲电影激情视频网站| 国产精品综合视频| 日本二三区不卡| 久久视频一区二区| 亚洲3atv精品一区二区三区| 国产+成+人+亚洲欧洲自线| 欧美日韩久久不卡| 亚洲视频综合在线| 国产在线播精品第三| 欧美性欧美巨大黑白大战| 国产欧美一区二区三区沐欲| 五月天久久比比资源色| 99久久99久久精品免费看蜜桃| 精品国产一区二区三区av性色| 亚洲激情图片一区| thepron国产精品| 精品欧美久久久| 亚洲bdsm女犯bdsm网站| 91免费版pro下载短视频| 久久精品人人做人人综合| 午夜成人免费视频| 在线观看亚洲专区| 亚洲精品五月天| av在线一区二区| 日本一区二区三区国色天香| 狠狠色丁香九九婷婷综合五月| 欧美高清一级片在线| 亚洲精品欧美专区| av电影在线观看一区| 亚洲国产精品成人久久综合一区| 蜜桃免费网站一区二区三区| 51精品久久久久久久蜜臀| 亚洲成av人片在线观看无码| 91久久久免费一区二区| 亚洲天堂中文字幕| 91原创在线视频|