C#--工作笔记(直方图单个UserControls)
2013-12-25 10:13
375 查看
<UserControl x:Class="Health365IIProjectView.Cylinder3DControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="100" d:DesignWidth="30"> <StackPanel x:Name="sp" Loaded="StackPanel_Loaded"> </StackPanel> </UserControl>
=============================================================================================================
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace Health365IIProjectView { /// <summary> /// Plume3DControl.xaml 的交互逻辑 /// </summary> public partial class Cylinder3DControl : UserControl { private Rectangle _rectLeft; private Rectangle _rectTop; private Rectangle _rectRight; public Cylinder3DControl() { InitializeComponent(); sp.Orientation = Orientation.Horizontal; _rectLeft = new Rectangle() { VerticalAlignment = VerticalAlignment.Bottom }; sp.Children.Add(_rectLeft); _rectTop = new Rectangle() { VerticalAlignment = VerticalAlignment.Top, RenderTransform = new SkewTransform(-45, 0, 0, 0) }; sp.Children.Add(_rectTop); _rectRight = new Rectangle() { VerticalAlignment = VerticalAlignment.Bottom, RenderTransform = new SkewTransform(0, -45, 0, 0) }; sp.Children.Add(_rectRight); } private void StackPanel_Loaded(object sender, RoutedEventArgs e) { } /// <summary> /// 初始化直方图 /// </summary> /// <param name="width"></param> /// <param name="height"></param> /// <param name="colorList"></param> public void InitSettingCylinder3DControl(double width, double height, Color[] colorList) { SettingPlume3DSize(width, height); SettingPlume3DColors(colorList); } /// <summary> /// 设置直方图颜色 /// </summary> /// <param name="colorList"></param> public void SettingPlume3DColors(Color[] colorList) { _rectLeft.Fill = new SolidColorBrush(colorList[0]); _rectTop.Fill = new SolidColorBrush(colorList[1]); _rectRight.Fill = new SolidColorBrush(colorList[2]); } /// <summary> /// 设置直方图尺寸 /// </summary> /// <param name="width"></param> /// <param name="height"></param> public void SettingPlume3DSize(double width, double height) { _rectLeft.Width = width; _rectLeft.Height = height; _rectTop.Width = width; _rectTop.Height = width / 3; _rectTop.Margin = new Thickness(-width / 3 * 2, 0, 0, 0); _rectRight.Width = width / 3; _rectRight.Height = height; _rectRight.Margin = new Thickness(-width / 3, 0, 0, 0); } } }
相关文章推荐
- C#--工作笔记(直方图整体UserControls)
- C#--工作笔记(时间单个控件UserControls和使用)
- C#--工作笔记(直方图Page页)
- Javascript学习笔记之 函数篇(二) : this 的工作机制
- 【工作笔记】互斥锁
- Extjs4开发笔记(一)——准备工作
- 【工作笔记】CCD和CMOS图像传感器的不同之处
- HTTP 的报文格式和工作流程 学习笔记
- tornado 学习笔记10 Web应用中模板(Template)的工作流程分析
- 2016年10月10号工作笔记:NVR 实现ONVIF客户端异步事件机制
- 工作笔记2012-3-8
- 工作笔记(16-04-28)
- git bash笔记-配置/修改git的user.name/email
- Node.js+Koa开发微信公众号个人笔记(一)准备工作
- 工作笔记
- 工作笔记_使用EasyUI Tree异步加载JSON数据 生成树
- ssh 远程关机工作笔记20130608
- struts2系列学习笔记(0)---------------准备工作
- ElasticSearch中局部更新操作(工作笔记)
- extjs6.2 学习笔记1-准备工作