赞
踩
//(梯度刷)
LinearGradientBrush lbrush1 = new LinearGradientBrush(rect1,
Color.DarkOrange, Color.Aquamarine,
LinearGradientMode.BackwardDiagonal);
//(阴影刷)
HatchBrush hbrush1 = new HatchBrush(HatchStyle.DiagonalCross,
Color.DarkOrange, Color.Aquamarine);
HatchBrush hbrush2 = new HatchBrush(HatchStyle.DarkVertical,
Color.DarkOrange, Color.Aquamarine);
HatchBrush hbrush3 = new HatchBrush(HatchStyle.LargeConfetti,
Color.DarkOrange, Color.Aquamarine);
//(纹理刷)
textureBrush = new TextureBrush(new Bitmap(@"e:\123.jpg"));
//e.Graphics.FillRectangle(hbrush1, rect1);
//e.Graphics.FillRectangle(sbrush1, rect1);
//e.Graphics.FillRectangle(textureBrush, rect1);
e.Graphics.FillRectangle(lbrush1, rect1);
------------------------------------
using System.Windows.Media;
1、String转换成Color
Color color = (Color)ColorConverter.ConvertFromString(string);
2、String转换成Brush
BrushConverter brushConverter = new BrushConverter();
Brush brush = (Brush)brushConverter.ConvertFromString(string);
3、Color转换成Brush
Brush brush = new SolidColorBrush(color));
4、Brush转换成Color有两种方法:
(1)先将Brush转成string,再转成Color。
Color color= (Color)ColorConverter.ConvertFromString(brush.ToString());
(2)将Brush转成SolidColorBrush,再取Color。
Color color= ((SolidColorBrush)CadColor.Background).Color;
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head id="Head1" runat="server">
- <title></title>
- <script src="../../../JS/jquerycj/jquery-1.7.2.min.js" type="text/javascript"></script>
- <style>
-
- </style>
- <script>
- var s;
- var studata = [
- { id: 1, name: '张三', selected: true },
- { id: 2, name: '深蓝色', selected: true },
- { id: 3, name: '肖西林', selected: true },
- { id: 4, name: '田伟', selected: true },
- { id: 5, name: '李四', selected: true },
- { id: 6, name: '彭平', selected: false },
- { id: 7, name: '张三丰', selected: false },
- { id: 8, name: '肖西林', selected: false },
- { id: 9, name: '肖西林', selected: false },
- { id: 32, name: '肖西林', selected: false },
- { id: 22, name: '肖西林', selected: false },
- { id: 65, name: '肖西林', selected: false },
- ];
- $(function() {
- s = new SelectStu('select_stubox',studata);
- });
- //取值
- function tt() {
- alert(s.val());
- }
- </script>
- <link href="http://localhost:12580/SOA/common/SelectStu/selectStu.css" rel="stylesheet" type="text/css" />
- <script src="http://localhost:12580/SOA/common/SelectStu/selectStu.js" type="text/javascript"></script>
- </head>
- <body>
-
- <form id="form1" runat="server">
-
- <div id = "select_stubox" style="width:600px;">
- </div>
- <input type="button" value="tt" οnclick="tt();" />
- </form>
- </body>
- </html>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。