Skip to content

Commit

Permalink
完善优化duidemo
Browse files Browse the repository at this point in the history
1、增加窗口阴影演示
2、优化界面布局
3、添加浏览器EventHandler使用演示
4、添加多窗口实例
  • Loading branch information
Troy committed Jul 29, 2015
1 parent cb646bf commit 5801f67
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 63 deletions.
Empty file.
4 changes: 2 additions & 2 deletions Demos/duidemo/MainWnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ class CDemoFrame : public WindowImplBase, public CWebBrowserEventHandler, public
pBrowser1->SetWebBrowserEventHandler(this);
CWebBrowserUI* pBrowser2 = static_cast<CWebBrowserUI*>(m_PaintManager.FindControl(_T("oneclick_browser2")));
pBrowser2->SetWebBrowserEventHandler(this);
pBrowser1->NavigateUrl(_T("http://www.winradar.com/?f=duidemo"));
pBrowser1->NavigateUrl(_T("http://blog.csdn.net/duisharp"));
pBrowser2->NavigateUrl(_T("http://www.2345.com/?kms656067418"));

CComboUI* pFontSize = static_cast<CComboUI*>(m_PaintManager.FindControl(_T("font_size")));
if(pFontSize)
{
CListLabelElementUI * pElement = new CListLabelElementUI();
pElement->SetText(_T("aklsdjfajsdlkf"));
pElement->SetText(_T("测试长文字"));
pElement->SetFixedHeight(30);
pElement->SetFixedWidth(120);
pFontSize->Add(pElement);
Expand Down
44 changes: 6 additions & 38 deletions DuiLib/Utils/UIShadow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,9 @@ LRESULT CALLBACK CShadowUI::ParentProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPAR
{
RECT WndRect;
GetWindowRect(hwnd, &WndRect);
if (pThis->m_bIsImageMode)
{
SetWindowPos(pThis->m_hWnd, 0,
WndRect.left - pThis->m_rcShadowCorner.left, WndRect.top - pThis->m_rcShadowCorner.top,
0, 0, SWP_NOSIZE | SWP_NOACTIVATE);
}
else
{
SetWindowPos(pThis->m_hWnd, 0,
SetWindowPos(pThis->m_hWnd, 0,
WndRect.left + pThis->m_nxOffset - pThis->m_nSize, WndRect.top + pThis->m_nyOffset - pThis->m_nSize,
0, 0, SWP_NOSIZE | SWP_NOACTIVATE);
}
}
break;

Expand Down Expand Up @@ -227,19 +218,8 @@ void CShadowUI::Update(HWND hParent)
GetWindowRect(hParent, &WndRect);
int nShadWndWid;
int nShadWndHei;
if (m_bIsImageMode)
{
if(m_sShadowImage.IsEmpty())
return;

nShadWndWid = WndRect.right - WndRect.left + m_rcShadowCorner.left + m_rcShadowCorner.right;
nShadWndHei = WndRect.bottom - WndRect.top + m_rcShadowCorner.top + m_rcShadowCorner.bottom;
}
else
{
nShadWndWid = WndRect.right - WndRect.left + m_nSize * 2;
nShadWndHei = WndRect.bottom - WndRect.top + m_nSize * 2;
}
nShadWndWid = WndRect.right - WndRect.left + m_nSize * 2;
nShadWndHei = WndRect.bottom - WndRect.top + m_nSize * 2;

// Create the alpha blending bitmap
BITMAPINFO bmi; // bitmap header
Expand All @@ -263,16 +243,12 @@ void CShadowUI::Update(HWND hParent)
RECT rcPaint = {0, 0, nShadWndWid, nShadWndHei};

const TImageInfo* data = m_pManager->GetImageEx((LPCTSTR)m_sShadowImage, NULL, 0);

if( !data )
return;
if( !data ) return;

RECT rcBmpPart = {0};
rcBmpPart.right = data->nX;
rcBmpPart.bottom = data->nY;

CRenderEngine::DrawImage(hMemDC, data->hBitmap, rcPaint, rcPaint, rcBmpPart, m_rcShadowCorner, data->alphaChannel, 0xFF, true, false, false);

}
else
{
Expand All @@ -281,16 +257,8 @@ void CShadowUI::Update(HWND hParent)
}

POINT ptDst;
if (m_bIsImageMode)
{
ptDst.x = WndRect.left - m_rcShadowCorner.left;
ptDst.y = WndRect.top - m_rcShadowCorner.top;
}
else
{
ptDst.x = WndRect.left + m_nxOffset - m_nSize;
ptDst.y = WndRect.top + m_nyOffset - m_nSize;
}
ptDst.x = WndRect.left + m_nxOffset - m_nSize;
ptDst.y = WndRect.top + m_nyOffset - m_nSize;

POINT ptSrc = {0, 0};
SIZE WndSize = {nShadWndWid, nShadWndHei};
Expand Down
Binary file added DuiLib_Ultimate.zip
Binary file not shown.
33 changes: 10 additions & 23 deletions bin/skin/duidemo/main.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Window size="800,572" sizebox="4,4,6,6" roundcorner="5,5" caption="0,0,0,64" mininfo="400,300">
<Window size="800,572" sizebox="4,4,6,6" roundcorner="0,0" caption="0,0,0,64" mininfo="400,300" showshadow="true" shadowimage="main/shadow.png" shadowsize="6,6" shadowcorner="8,8,8,8">
<Font name="宋体" size="13" bold="true" />
<Font name="宋体" size="12" bold="true" underline="true"/>
<Font name="宋体" size="12" />
Expand Down Expand Up @@ -51,18 +51,17 @@
<Control />
</VerticalLayout>
</HorizontalLayout>

<Label height="1" bkimage="hor_line.bmp"/>

<HorizontalLayout height="60">
<HorizontalLayout height="60" >
<Label text="输入控件" textcolor="#FF555555" glowsize="0" font="font13" width="80"/>
<VerticalLayout >
<Control />
<HorizontalLayout height="36" childpadding="12">
<Edit name="button1" hinttext="普通" textpadding="10,2,10,2" textcolor="#FFFFFFFF" bkcolor="#00000000" nativebkcolor="#FF000000" bkimage="res='edit.png' corner='6,6,6,6'" />
<Edit name="button1" hinttext="只读" text="只读控件" bkimage="res='edit_bk.png' corner='6,6,6,6'" readonly="true"/>
<Edit name="button1" hinttext="数字" bkimage="res='edit_bk.png' corner='6,6,6,6'" numberonly="true"/>
<Edit name="button1" hinttext="密码" bkimage="res='edit_bk.png' corner='6,6,6,6'" password="true"/>
<HorizontalLayout height="24" childpadding="12">
<Edit name="button1" hinttext="普通" bkcolor="#00000000" bkimage="res='edit.png' corner='6,6,6,6'" />
<Edit name="button1" hinttext="只读" text="只读控件" bkimage="res='button_pushed.png' corner='6,6,6,6'" readonly="true"/>
<Edit name="button1" hinttext="数字" bkimage="res='button_pushed.png' corner='6,6,6,6'" numberonly="true"/>
<Edit name="button1" hinttext="密码" bkimage="res='button_pushed.png' corner='6,6,6,6'" password="true"/>

</HorizontalLayout>
<Control />
Expand All @@ -82,7 +81,7 @@
<ListLabelElement text="幼圆" height="23" />
<ListLabelElement text="楷体" height="23" />
</Combo>
<Combo name="font_size" droptype="droplist" width="50" height="22" textpadding="4,1,1,1" normalimage="file='combo.png' source='0,0,100,22' corner='2,2,20,2'" hotimage="file='combo.png' source='0,22,100,44' corner='2,2,22,2'" pushedimage="file='combo.png' source='0,44,100,66' corner='2,2,22,2'">
<Combo name="font_size" droptype="droplist" width="50" height="22" textpadding="4,1,22,1" normalimage="file='combo.png' source='0,0,100,22' corner='2,2,20,2'" hotimage="file='combo.png' source='0,22,100,44' corner='2,2,22,2'" pushedimage="file='combo.png' source='0,44,100,66' corner='2,2,22,2'">
<ListLabelElement text="9" selected="true" height="23" />
<ListLabelElement text="10" height="23" />
<ListLabelElement text="11" height="23" />
Expand All @@ -106,16 +105,7 @@
</VerticalLayout>
</HorizontalLayout>
<Label height="1" bkimage="hor_line.bmp"/>
<HorizontalLayout height="60" bordercolor="#FF00FF00" bordersize="1">
<Label text="窗口演示" textcolor="#FF555555" glowsize="0" font="font13" width="80"/>
<VerticalLayout >
<Control />
<HorizontalLayout height="30" childpadding="12">
<Button name="popwnd_btn" text="弹出透明窗口" textcolor="#FF555555" normalimage="res='button_normal.png' corner='4,4,4,4'" hotimage="res='button_hover.png' corner='4,4,4,4'" pushedimage="res='button_pushed.png' corner='4,4,4,4'" width="100"/>
</HorizontalLayout>
<Control />
</VerticalLayout>
</HorizontalLayout>

</VerticalLayout>
<VerticalLayout name="rich_tab_panel" inset="2,2,2,2" vscrollbar="true">
<Label height="1" bkimage="hor_line.bmp"/>
Expand All @@ -136,9 +126,7 @@
<HorizontalLayout height="120" bkcolor="#FFFFFFFF" inset="0,6,0,6">
<Label text="RichEdit控件" textcolor="#FF555555" glowsize="0" font="font13" width="80"/>
<VerticalLayout bordersize="1" bordercolor="#FF666666" inset="2,2,2,2">
<RichEdit name="wordedit" readonly="false" vscrollbar="true" autovscroll="true" text="割肉还是死扛,这是被套股民面临的一个艰难选择题。自6月12日以来,沪指下跌28.63%,创业板指数更是暴跌了33.2%。同花顺iFinD统计显示,最近15个交易日,已经有427只个股的股价被腰斩,还有954只股票跌幅为40%~50%。短短的三周时间,按照中登公司(截至6月26日)的期末持仓人数(5076.6万)计算,人均亏损近41.30万元。按照2014年全国人均年平均工资49969元计算,每人近三周约亏掉8年工资。
  对于很多自有资金的股民来说,紧握股票,等待援军或许是一种策略。但对于融资融券或场外配资客户来说,在账户被强平压力下,被迫割肉离场是最无奈的选择。
  “终于卖掉全信股份了,一年半的利润全亏光了。”昨天网友“无心逢春”趁着全信股份下午翻红,把手上的全信股份一股脑全割光了,收盘全信股份又牢牢封住跌停。“无心逢春”是5月25日,全信股份第一次打开涨停板时追进去的,成本在151元以上,后来全信股份一度涨到208.99元的历史高点。6月2日,公司停牌。6月17日,公司宣布终止收购赛治信息股权,复牌后股价连续三个无量跌停,6月25日到29日,又是连续三个跌停,7月1日到3日,再度三个跌停。股价昨天收报60.59元,比最高点的208.99元跌了71%。6月12日以来,该股股价暴跌了65.25%,成为本轮调整以来,股价跌得最惨的股票之一。" />
<RichEdit name="wordedit" text="duilib地址:https://github.com/duisharp/DuiLib_Ultimateduilib 开源项目交流圈(261675375),请各位积极贡献自己在开发中遇到的各种问题解决方案和开发经验,互帮互助,一起完善duilib。入群要求:接收Q龄高于3年等级一个太阳及以上的非企业QQ入群。" readonly="false" hscrollbar="true" autohscroll="true"/>
</VerticalLayout>
</HorizontalLayout>
<Label height="1" bkimage="hor_line.bmp"/>
Expand Down Expand Up @@ -192,7 +180,6 @@
<VerticalLayout inset="0,0,0,6" sepimm="true" sepheight="6" height="200" minheight="200" maxheight="300">
<WebBrowser name="oneclick_browser1" homepage="about:blank" autonavi="true" delaycreate="false" />
</VerticalLayout>
<RichEdit />
<WebBrowser name="oneclick_browser2" homepage="about:blank" autonavi="true" delaycreate="false"/>
</VerticalLayout>
</TabLayout>
Expand Down
Binary file added bin/skin/duidemo/main/shadow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions bin/skin/duidemo/popup.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<<<<<<< HEAD
<Window caption="0,0,0,415" size="600,384" mininfo="600,384" sizebox="6,6,6,6" bktrans="false">
<Font name="宋体" size="12" default="true"/>

<VerticalLayout bkimage="res='bg.png' corner='6,97,6,29' fade='200'">
=======
<Window caption="0,0,0,415" size="600,384" mininfo="600,384" sizebox="6,6,6,6" bktrans="true">
<Font name="宋体" size="12" default="true"/>

<VerticalLayout bkimage="res='bg.png' corner='6,97,6,29' fade='255'">
>>>>>>> origin/master
<HorizontalLayout name="appbar" height="64" inset="0,-1">
<HorizontalLayout name="apptitle" childpadding="6">
<Container padding="2,3,0,0" width="64" height="64" bkimage="logo.jpg" />
Expand All @@ -13,8 +20,13 @@
</HorizontalLayout>

<Button name="minbtn" width="28" height="20" tooltip="最小化" normalimage="file='sysbtn/btn_mini_normal.png'" hotimage="file='sysbtn/btn_mini_highlight.png'" pushedimage="file='sysbtn/btn_mini_down.png' "/>
<<<<<<< HEAD
<Button name="maxbtn" width="28" height="20" tooltip="最大化" normalimage="file='sysbtn/btn_max_normal.png'" hotimage="file='sysbtn/btn_max_highlight.png'" pushedimage="file='sysbtn/btn_max_down.png' "/>
<Button name="restorebtn" width="28" height="20" tooltip="还原" visible="false" normalimage="file='sysbtn/btn_restore_normal.png'" hotimage="file='sysbtn/btn_restore_highlight.png'" pushedimage="file='sysbtn/btn_restore_down.png' "/>
=======
<!--<Button name="maxbtn" width="28" height="20" tooltip="最大化" normalimage="file='sysbtn/btn_max_normal.png'" hotimage="file='sysbtn/btn_max_highlight.png'" pushedimage="file='sysbtn/btn_max_down.png' "/>-->
<!--<Button name="restorebtn" width="28" height="20" tooltip="还原" visible="false" normalimage="file='sysbtn/btn_restore_normal.png'" hotimage="file='sysbtn/btn_restore_highlight.png'" pushedimage="file='sysbtn/btn_restore_down.png' "/>-->
>>>>>>> origin/master
<Button name="closebtn" width="39" height="20" tooltip="关闭" normalimage="file='sysbtn/btn_close_normal.png'" hotimage="file='sysbtn/btn_close_highlight.png'" pushedimage="file='sysbtn/btn_close_down.png' "/>
</HorizontalLayout>

Expand Down
3 changes: 3 additions & 0 deletions bin/skin/transwnd/skin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
<Button name="closebtn" width="39" height="20" tooltip="关闭" normalimage="file='sysbtn/btn_close_normal.png'" hotimage="file='sysbtn/btn_close_highlight.png'" pushedimage="file='sysbtn/btn_close_down.png' "/>
</HorizontalLayout>

<VerticalLayout>

</VerticalLayout>
</VerticalLayout>
</Window>

0 comments on commit 5801f67

Please sign in to comment.