The following will demonstrate how to implement DataGrid as a stereo table, and how to implement a three-dimensional effect on the Image button. In order to complete the above content, we must first understand the CSS custom style, then some simple JS code.
In order to achieve three-dimensional DataGrid, we need to create a project, there is a DataGrid and the data binding on it, the code is as follows:
ask: DataGrid>
One place in the above code is very important, that is, set the style of the style, remember to be written. After this data grid, we need to write a CSS style that can achieve three-dimensional effects, and the CSS style is as follows:
.SoliddataGrid {
CoolsolidDataGrid: ExplySolidTable (this));
Border-color: #fffff;
Border-bottom-width: 0px;
Border-left-width: 0px;
Border-right-width: 0px;
Border-top-width: 0px;
}
. SolidDataGridItem {
CoolsoliddataGridrow: ExplySolidtr (this));
}
style>
From the code we can see the use of custom styles, which use JS to implement, so we have the following JS code to support the above CSS style. The JS code is as follows:
Function ApplySolidTable (OBJ) {
Obj.cellpadding = "0px";
Obj.cellspacing = "0px";
Obj.border = "1px";
Obj.width = "100%";
}
Function ApplySolidtr (OBJ) {
For (var i = 0; i <= obj.cells.Length-1; i ) {
ApplySolidtd (Obj.cells (i));
}
}
Function ApplySolidtd (Currenttd) {
Currenttd.bgcolor = "# e1e2e2";
Currenttd.Bordercolorlight = "# 929292";
Currenttd.BordercoloRDark = "#ffffff";
}
script>
I will not express the details of the code, and finally, as long as the above CSS application can achieve stereo DataGrid effects in our DataGrid. The final DataGrid is as follows:
ask: DataGrid>
The next is how to implement an Image button with stereoscopic effects. It is actually a simple effect of implementing the general Windows button. Open Word After moving the mouse to the toolbar, you can see the effect of this method. The operation is as follows: You can put an imagebutton or by the browser to finally explain the image control, in order to achieve this effect, we need the following JS script, but because we want to reuse this script, I will write it to an HTC file, the file content as follows:
Function buttonOnMouseOver () {
ShowMouseOver (this.style);
}
Function button -Mousedown () {
ShowMouseDown (this.style);
}
Function buttonnmousenormal () {
Shownormal (this.style);
}
Function ShowMouseOver (Elstyle) {
Elstyle.BorderLeft = "1px solid buttonhlight";
Elstyle.BorderRight = "1px solid buttonhadow";
Elstyle.Bordertop = "1px solid buttonhight";
Elstyle.Borderbottom = "1px solid buttonhadow";
Elstyle.paddingtop = "1px";
Elstyle.paddingleft = "2px";
Elstyle.paddingBottom = "1px";
Elstyle.paddingRight = "0px";
}
Function ShowMousedown (Elstyle) {
Elstyle.BorderLeft = "1px solid buttonhadow";
Elstyle.Borderright = "1px solid buttonhight"; Elstyle.Bordertop = "1px solid buttonshadow";
Elstyle.Borderbottom = "1px solid buttonhlight";
Elstyle.paddingtop = "1px";
Elstyle.paddingleft = "2px";
Elstyle.paddingBottom = "1px";
Elstyle.paddingRight = "0px";
}
Function Shownormal (Elstyle) {
Elstyle.Border = "1px solid buttonface";
ElStyle.paddingtop = "0px";
Elstyle.paddingleft = "1px";
Elstyle.paddingBottom = "2px";
Elstyle.paddingRight = "1px";
}
Script>
Public: Component>
We can use the following method to attach this behavior to the specified control:
YourControl CTL = (YourControl) Button;
CTL.Style.Add ("Behavior", "URL (PowerButton.htc)");
Hey! It's all tips, there is no need to advise you. Thank you! The above three-dimensional DataGrid is implemented with reference to the "realistic stereo form" of the bean baby.