配置文件:
HelloWorld.xml
<bean id="helloApi"
class="cn.javass.spring.chapter2.helloworld.HelloImpl"
lazy-init="true"/>
②depends-on是指指定Bean初始化及销毁时的顺序,使用depends-on属性指定的Bean要先初始化完毕后才初始化当前Bean,由于只有"singleton"Bean才能被Spring管理销毁,所以当指定的Bean都是"singleton"时,使用depends-on属性指定的Bean要在指定的Bean之后销毁。
配置代码:
<bean id="helloApi" class="com.feng.spring.chapter2.helloworld.HelloApi">
</bean>
<bean id="decorator"
class="cn.javass.spring.chapter3.bean.HelloApiDecorator"
depends-on="helloApi">
<property name="helloApi"><ref bean="helloApi"/></property>
</bean>
本系列主要讲解Windows界面编程,目前列出五篇,欢迎大家交流讨论。
1. 《Windows界面编程第一篇 位图背景与位图画刷》
2. 《Windows界面编程第二篇 半透明窗体》
3. 《Windows界面编程第三篇 异形窗体 普通版》
4. 《Windows界面编程第四篇 异形窗体 高富帅版》
5. 《Windows界面编程第五篇静态控件背景透明化》
Windows界面编程第一篇 位图背景与位图画刷
可以通过WM_CTLCOLORDLG消息来设置对话框的背景,MSDN上对这个消息的说明如下:
The WM_CTLCOLORDLG message is sent to a dialog box before the system draws the dialog box. By responding to this message, the dialog box can set its text and background colors using the specified display device context handle.
当窗口消息响应函数接收这个消息时,wParam表示对话框的设备上下方即HDC,lParam表示对话框的句柄。如果程序处理了这个消息,应返回一个画刷。系统将会用这个画刷来重绘对话框背景。
因此我们在这个WM_CTLCOLORDLG消息中得到对话框的大小,并通过StretchBlt函数将位图缩放后贴到对话框的HDC中就完成了对话框背景的设置,然后返回一个空画刷给系统,这样系统就不会将位图背景给覆盖了。
代码非常简单,要注意的是在使用StretchBlt函数缩放位图时,最好先使用
SetStretchBltMode函数来设置下位图内容伸展模式,这样可以避免缩放后位图失真严重。SetStretchBltMode函数原型如下:
int SetStretchBltMode(
HDChdc, // handle to DC
int iStretchMode // bitmap stretching mode
);
第一个参数就是设备上下方即HDC。
第二个参数有四种设置:
1. BLACKONWHITE or STRETCH_ANDSCANS
如果两个或多个像素得合并成一个像素,那么StretchBlt会对像素执行一个逻辑AND运算。这样的结果是只有全部的原始像素是白色时该像素才为白色,其实际意义是黑色像素控制了白色像素。这适用于白色背景中主要是黑色的单色点阵图。
2. WHITEONBLACK or STRETCH_ORSCANS
如果两个或多个像素得合并成一个像素,那么StretchBlt会对像素执行逻辑OR运算。这样的结果是只有全部的原始像素都是黑色时该像素才为黑色,也就是说由白色像素决定颜色。这适用于黑色背景中主要是白色的单色点阵图。
3. COLORONCOLOR or STRETCH_DELETESCANS
简单地消除图素行或列,而没有任何逻辑组合。这是通常是处理彩色点阵图的最佳方法。
4. HALFTONE or STRETCH_HALFTONE
根据组合起来的来源颜色来计算目的的平均颜色。
其它技术细节可以见代码中的注释,完整代码如下(也可以下载,下载地址为:http://download.csdn.net/download/morewindows/4947377):
// 对话框位图背景 - WM_CTLCOLORDLG中使用StretchBlt贴图 //By MoreWindows-(http://blog.csdn.net/MoreWindows) #include <windows.h> #include "resource.h" const char szDlgTitle[] = "位图背景 使用StretchBlt贴图 MoreWindows-(http://blog.csdn.net/MoreWindows)"; // 对话框消息处理函数 BOOL CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DlgProc); return 0; } BOOL CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { RECT rcDialog; HBITMAP hBitmap; static BITMAP s_bm; static HDC s_hdcMem; switch (message) { case WM_INITDIALOG: // 设置对话框标题 SetWindowText(hDlg, szDlgTitle); // 设置对话框大小可调节 SetWindowLong(hDlg, GWL_STYLE, GetWindowLong(hDlg, GWL_STYLE) | WS_SIZEBOX); // 加载背影图片 hBitmap = (HBITMAP)LoadImage(NULL, "005.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION); if (hBitmap == NULL) { MessageBox(hDlg, "LoadImage failed", "Error", MB_ICONERROR); exit(0); } else { // 将背影图片放入HDC - s_hdcMem HDC hdc; hdc = GetDC(hDlg); s_hdcMem = CreateCompatibleDC(hdc); SelectObject(s_hdcMem, hBitmap); ReleaseDC(hDlg, hdc); // 得到位图信息 GetObject(hBitmap, sizeof(s_bm), &s_bm); } return 0; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: DeleteDC(s_hdcMem); EndDialog(hDlg, LOWORD(wParam)); return TRUE; } break; case WM_SIZE: InvalidateRect(hDlg, NULL, TRUE); return TRUE; case WM_CTLCOLORDLG: GetClientRect(hDlg, &rcDialog); //通
Hi guys, I want toshare things what I know about SCVMM, thank very much!
---This is an article about Microsoft PrivateCloud- System Center Virtual Machine Manager's knowledge sharing, thanks.
System Center VMM : Virtual Machine Manager
1. VMsand ServicesGettingStarted with System Center 2012 - Virtual Machine Manager
a. Tenants
i. You can create/modify/delete User Role in Tenants, a user role contains Name,Description, Profile(Fabric Administrator(Delegated Administrator)/Read-OnlyAdministrator/Tenant Administrator/Application Administrator(Self-ServiceUser)), Members, Scope(Clouds and Hosts),
1. For Fabric Administrator and Read-Only Administrator, Library servers, Run Asaccounts,
2. For Tenant Administrator and Application Administrator : Qutas for the clouds,Networking, Rescources, Actions.
b. Clouds
i. You can create/modify/delete Cloud in Clouds, a Cloud contains Name, Description,Resources(Hosts/VMware resource pools), Logical Networks, Load Balancers, VIPTemplates, Port Classifications(SR-IOV/Host management/Network loadbalancing/Live migration workload/Medium bandwidth/Host Cluster Workload/Lowbandwidth/High bandwidth/iSCSI workload), Storage, Library(Stored VM path andRead-only library shares),Capacity(Virtual CPUs/Memory (GB)/Storage (GB)/Customquota (points)/Virtual machines),CapabilityProfiles(Hyper-V/XenServer/ESXServer/customCapabilityProfile)
ii. You can create a new Service or create a Service using an existing servicetemplate, modify/delete the Service in Clouds, a Service contains Name,Release, Description, Cost center, Owner(a Owner and a User Role),Priority(Normal/Low/High), Status, Type, Service Settings/Servocomg Windows,Dependencies(Patterns), Custom Properties, Access(Self-Service owner and Sharedwith these Self-Service users or roles)
iii. You can create a new Virtual Machine using an existing VM/VM template/ virtual harddisk or create a new VM with a blank virtual hard disk, a virtual machinecontains Name, Description,Configure Hardware(select a Hardware profile),Select Destination(
1. Deploythe virtual machine to a private cloud
a. SelectCloud
b. AddProperties
2. Placethe virtual machine on a host
a. SelectHost
b. ConfigureSettings(Locations/Networking/Machine Resources)
c. SelectNetworks(Virtual Network Adapter/VM Network/Virtual Switch/VLAN)
d. AddProperties
i. Automationactions: 1. Action to take when the virtualization server starts: Neverautomatically turn on the virtual machine/Always automatically turn on thevirtual machine/Automatically turn on the virtual machine if it was runningwhen physical server stopped. 2. Save State/Turn off virtual machine/Shut downguest OS
ii. Operationsystem
3. Storethe virtual machine in the library
a. SelectLibrary Server
b. Selectvirtual machine Path
)
iv. Youcan Clone/Create VM Template/Shut down/Power On/Power Off/Pause/Resume/Reset/SaveState/Discard Saved State/Migrate Storage/Migrate Virtual Machine/Store inLibrary/Create Checkpoint/Manage Checkpoints/Refresh/Repair/Install VirtualGuest Services/Modify/Delete the virtual machine. Connect or View the virtualmachine via Console/RDP, view the Networking.
1. AVirtual Machine can modify its Cost center/Tag/HardwareConfiguration/Checkpoints/Custom Properties/Self-Service Quotapoints/PRO(Performance an dResource Optimization)/Servicing Windows/Accessafter created.
2. InHardware Configuration, you can modify VM’s CloudCompatiblity/Processor/Memory/Floppy Drive/COM 1/COM 2/Video Adapter/IDEDevices/SCSI Adapter 0/Network Adapter 1/IntegrationServices/Availability/BIOS/CPU Priority.
v. Youcan Assign existing user roles or a new user role to current cloud.
c. VMNetworks
i. Youcan Create/Modify/Delete VM Network in VM Networks. It contains Name,Description, Logical network, Isolation(Isolate using Hyper-V networkvirtualization/No isolation), View Dependent Resources of the VM Networks.
d. Storage
i. Youcan see physical drives for each VM, including its Disk information, Capacityinformation and Capacity.
e. AllHosts
i. Youcan Create/Modify/Move/Delete Host Group/Add Hypeer-V Hosts and Clusters/AddCitrix XenServer Hosts and Clusters/Add VMware ESX Hosts and Clusters/ViewNetworking in All Hosts.
ii. HostGroup contains Name, Location, Description, Allow unencrypted file transfers(offers improved performance but is less secure): check/uncheck,
PlacementRules, Host Reserves, Dynamic Optimization, Network, Storage and CustomPropertie