版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、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.
2、Navigation;using System.Windows.Shapes;using System.IO;public partial class Qr code set / <exclude/>class ColorBox: Label private bool mouseEnter;public ColorBox()this.BackColor = Color.White;this.AutoSize = false;this.Size = new Size(41, 23);this.BorderStyle = BorderStyle.Fixed3D; this.MouseE
3、nter += new EventHandler(ColorBox_MouseEnter); this.MouseLeave += new EventHandler(ColorBox_MouseLeave); this.Click += new EventHandler(ColorBox_Click); this.MouseMove += new MouseEventHandler(ColorBox_MouseMove); void ColorBox_MouseMove(object sender, MouseEventArgs e) if (Cursor.Current != Cursors
4、.Hand) Cursor.Current = Cursors.Hand; void ColorBox_MouseLeave(object sender, EventArgs e) mouseEnter = false; Cursor.Current = Cursors.Default; this.Invalidate(); void ColorBox_MouseEnter(object sender, EventArgs e) mouseEnter = true; Cursor.Current = Cursors.Hand; this.Invalidate(企业管理); / Fires wh
5、en the selected color changespublic event ColorChangedEventHandler ColorChanged; public event ColorDialogCreatedEventHandler ColorDialogCreated;void ColorBox_Click(object sender, EventArgs e) Cursor.Current = Cursors.Hand; IRadColorDialog dialogForm = RadColorEditor.CreateColorDialogInstance(); if (
6、this.ColorDialogCreated != null) ColorDialogEventArgs args = new ColorDialogEventArgs(dialogForm); this.ColorDialogCreated(this, args); UserControl colorSelector = RadColorEditor.CreateColorSelectorInstance() as UserControl;(IColorSelector)dialogForm.RadColorSelector).SelectedColor = this.BackColor;
7、(IColorSelector)dialogForm.RadColorSelector).OldColor = this.BackColor;(IColorSelector)colorSelector).OkButtonClicked += delegate(object sender1, ColorChangedEventArgs args) (Form)dialogForm).DialogResult = DialogResult.OK; (Form)dialogForm).Close(); ;(IColorSelector)colorSelector).CancelButtonClick
8、ed += delegate(object sender1, ColorChangedEventArgs args) (Form)dialogForm).DialogResult = DialogResult.Cancel; (Form)dialogForm).Close(); ;colorSelector.Dock = DockStyle.Fill;(Form)dialogForm).Controls.Add(colorSelector);if (Form)dialogForm).ShowDialog() = DialogResult.OK)this.BackColor = (IColorS
9、elector)dialogForm.RadColorSelector).SelectedColor;if (ColorChanged != null)ColorChanged(this, new ColorChangedEventArgs(this.BackColor); this.Invalidate(); protected override void OnPaint(PaintEventArgs e) Cursor.Current = Cursors.Hand; if( mouseEnter ) using (Pen pen = new Pen(this.ForeColor) e.Gr
10、aphics.DrawRectangle(pen, new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1); base.OnPaint(e); public class ColorDialogEventArgs : EventArgs private IRadColorDialog dialog; public ColorDialogEventArgs(IRadColorDialog dialog) this.dialog = dialo
11、g; public IRadColorDialog Dialog get return dialog; public delegate void ColorDialogCreatedEventHandler(object sender, ColorDialogEventArgs args);using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.
12、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;using System.IO;public partial class System Settings / Form codepublic partial class Form1 : TreeExamplesControl Bi
13、tmap bottomRightBitmap = Resources.TV_email; private string clickedNode; public Form1()InitializeComponent();this.radLblSelectedNode.Text = "" this.radLblSelectedItem.Text = ""this.Load += new EventHandler(Form1_Load);this.SelectedControl = this.radTreeViewDemo; this.radTreeViewD
14、emo.AllowEdit = true; this.radContextMenu1.DropDownOpening += new System.ComponentModel.CancelEventHandler(radContextMenu1_DropDownOpening); public override RadTreeView TreeControl get return this.radTreeViewDemo; public override Bitmap BottomRightImage get return bottomRightBitmap; public override
15、string HeaderText get return "Mail" private void Form1_Load(object sender, EventArgs e)this.radMenuItem1.Click += new EventHandler(radMenuItem1_Click);this.radMenuItem2.Click +=new EventHandler(radMenuItem2_Click);this.radMenuItem4.Click +=new EventHandler(radMenuItem4_Click);this.radMenuI
16、tem5.Click +=new EventHandler(radMenuItem5_Click);this.radTreeViewDemo.NodeMouseDown += new Telerik.WinControls.UI.RadTreeView.TreeViewMouseEventHandler(node_MouseDown);private void node_MouseDown(object sender, RadTreeViewEventArgs e)if (Control.MouseButtons = MouseButtons.Right)clickedNode = e.Nod
17、e.Text; private void SetLabel(object sender) RadMenuItem item = sender as RadMenuItem; if (item != null) radLblSelectedNode.Text = this.clickedNode; radLblSelectedItem.Text = item.Text; void radContextMenu1_DropDownOpening(object sender, System.ComponentModel.CancelEventArgs e) RadTreeNode node = th
18、is.radTreeViewDemo.SelectedNode; if (node != null) this.radMenuItem1.Enabled = node.Enabled; this.radMenuItem4.Enabled = node.Enabled; this.radMenuItem5.Enabled = node.Enabled; if (node.Enabled) this.radMenuItem2.Text = "Disable" else this.radMenuItem2.Text = "Enable" private voi
19、d radMenuItem1_Click(object sender, EventArgs e) SetLabel(sender); if (this.radTreeViewDemo.SelectedNode != null) this.radTreeViewDemo.BeginEdit(); private void radMenuItem2_Click(object sender, EventArgs e) SetLabel(sender); if (this.radTreeViewDemo.SelectedNode != null) this.radTreeViewDemo.Select
20、edNode.Enabled = !this.radTreeViewDemo.SelectedNode.Enabled; private void radMenuItem4_Click(object sender, EventArgs e) SetLabel(sender); if (this.radTreeViewDemo.SelectedNode != null) this.radTreeViewDemo.SelectedNode.Remove(信息录入); private void radMenuItem5_Click(object sender, EventArgs e) SetLab
21、el(sender); if (this.radTreeViewDemo.SelectedNode != null) this.radTreeViewDemo.SelectedNode.Expand(); RadTreeNode newNode = this.radTreeViewDemo.SelectedNode.Nodes.Add("New Folder"); if (newNode != null) this.radTreeViewDemo.SelectedNode = newNode; this.radTreeViewDemo.BeginEdit(); using
22、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.Naviga
23、tion;using System.Windows.Shapes;using System.IO;public partial class Trace Settings / RadMediaItem allows a user to populate RadMediaPlayer with media items. / RadMediaItem is identified by the following properties:/ Source - the Uri of the media file;/ ImageSource - the Uri of the image file that
24、will represent RadMediaItem in RadmediaPlayer's playlist;/ Header - Content that is displayed in the Playlist area of RadMediaPlayer.TelerikToolboxCategory("Containers")TemplateVisualState(Name = RadMediaItem.NormalStateName, GroupName = RadMediaItem.CommonStatesGroupName)TemplateVisua
25、lState(Name = RadMediaItem.DisabledStateName, GroupName = RadMediaItem.CommonStatesGroupName)TemplateVisualState(Name = RadMediaItem.MouseOverStateName, GroupName = RadMediaItem.CommonStatesGroupName)TemplateVisualState(Name = RadMediaItem.SelectedStateName, GroupName = RadMediaItem.SelectionStatesG
26、roupName)TemplateVisualState(Name = RadMediaItem.NotSelectedStateName, GroupName = RadMediaItem.SelectionStatesGroupName)public partial class RadMediaItem : HeaderedSelector, ISelectableprivate Grid layoutRoot;private ItemsPresenter itemsPresenter;private bool isMouseOver;private bool chapterScrubbe
27、d;private RadMediaPlayer parentPlayer;/ Initializes a new instance of the <see cref="RadMediaItem"/> class.public RadMediaItem()DefaultStyleKey = typeof(RadMediaItem);this.MouseEnter += this.RadMediaItem_MouseEnter;this.MouseLeave += this.RadMediaItem_MouseLeave;this.IsEnabledChanged
28、 += this.RadMediaItem_IsEnabledChanged;this.MouseLeftButtonDown += this.RadMediaItem_MouseLeftButtonDown;/ When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call <see cref="M:System.Windows.Controls.Control.Apply
29、Template"/>.public override void OnApplyTemplate()base.OnApplyTemplate();this.layoutRoot = GetTemplateChild("LayoutRoot") as Grid;this.itemsPresenter = GetTemplateChild("itemsPresenter") as ItemsPresenter;if (this.ParentPlayer != null && this.IsSelected)this.Selec
30、tInternal();this.UpdateStates();/ Called when the RadMediaItem is selected in a RadMediaPlayer./ <param name="e">The event data.</param>/ <remarks>/ This method is called when the IsSelected property changes to true./ </remarks>public void OnSelected(RadRoutedEventA
31、rgs e)this.SelectInternal();this.UpdateStates();this.RaiseEvent(e);/ Called when the RadMediaItem is unselected in a RadMediaPlayer./ <param name="e">The event data.</param>/ <remarks>/ This method is called when the IsSelected property changes to true./ </remarks>p
32、ublic void OnUnselected(RadRoutedEventArgs e)if (this.ParentPlayer != null && this.ParentPlayer.SelectedIndex < 0)this.ParentPlayer.SetValue(RadMediaPlayer.SelectedMediaItemKey, null);if (this.IsStreamingSource)this.DetachStream();if (this.ParentPlayer != null && this.ParentPlayer
33、.TimerMediaSliderSync != null)this.ParentPlayer.TimerMediaSliderSync.Stop();this.HideChapters();this.UpdateStates();this.RaiseEvent(e);internal RadMediaChapter GetContainer(object item)return (this.IsItemItsOwnContainerOverride(item) ? item : this.ItemContainerGenerator.ContainerFromItem(item) as Ra
34、dMediaChapter;internal ItemsPresenter ExtractChapters(数据统计)if (this.layoutRoot != null && this.layoutRoot.Children.Contains(this.itemsPresenter)this.layoutRoot.Children.Remove(this.itemsPresenter);if (this.itemsPresenter != null)this.itemsPresenter.Opacity = 1;this.itemsPresenter.IsHitTestVi
35、sible = true;return this.itemsPresenter;internal void HideChapters()if (this.ParentPlayer = null)return;this.ParentPlayer.RemoveTickMarksOnTimeSlider();this.ParentPlayer.IsChaptersPanelVisible = false;this.ParentPlayer.ClearChapters();if (this.layoutRoot != null && !this.layoutRoot.Children.
36、Contains(this.itemsPresenter)this.layoutRoot.Children.Add(this.itemsPresenter);if (this.itemsPresenter != null)this.itemsPresenter.Opacity = 0;this.itemsPresenter.IsHitTestVisible = false;internal void HandleChapterReached()this.chapterScrubbed = true;RadMediaChapter item = this.GetContainers<Rad
37、MediaChapter>().Where(ch => ch != null && ch.Position.TotalSeconds <= this.Position).OrderBy(ch => ch.Position.TotalSeconds).LastOrDefault();this.SelectedIndex = item != null ? this.ItemContainerGenerator.IndexFromContainer(item) : -1;this.chapterScrubbed = false;internal void At
38、tachStream()if (this.StreamAttached != null)this.StreamAttached(this, EventArgs.Empty);internal void DetachStream()if (this.StreamDetached != null)this.StreamDetached(this, EventArgs.Empty);/ Raises the SelectionChanged event./ <param name="e"></param>protected override void On
39、SelectionChanged(System.Windows.Controls.SelectionChangedEventArgs e)base.OnSelectionChanged(e);if (e.AddedItems != null && e.AddedItems.Count = 1)RadMediaChapter selectedChapter = this.GetContainer(e.AddedItems0);if (selectedChapter != null)if (!this.chapterScrubbed)this.Position = selected
40、Chapter.Position.TotalSeconds + .3;if (this.parentPlayer != null)this.parentPlayer.Position = selectedChapter.Position.TotalSeconds + .3;if (this.ParentPlayer != null)this.ParentPlayer.RaiseEvent(new RadRoutedEventArgs(RadMediaPlayer.ChapterReachedEvent, this);CommandManager.InvalidateRequerySuggest
41、ed();/ Creates or identifies the element that is used to display the given item./ <returns></returns>protected override DependencyObject GetContainerForItemOverride()return new RadMediaChapter();/ Determines if the specified item is (or is eligible to be) its own item container. / <pa
42、ram name="item"></param>/ <returns></returns>protected override bool IsItemItsOwnContainerOverride(object item)return item is RadMediaChapter;private static void OnPositionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)RadMediaItem mediaItem =
43、 d as RadMediaItem;if (mediaItem != null)mediaItem.HandleChapterReached();private static void OnSourcePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)RadMediaItem mediaItem = sender as RadMediaItem;if (mediaItem != null && mediaItem.ParentPlayer != null &&am
44、p; mediaItem.ParentPlayer.MediaElement != null)/SelectInternal will handle this and set the Sourceif (mediaItem.IsSelected)if (mediaItem.IsStreamingSource)mediaItem.AttachStream();elsemediaItem.Position = 0.0;mediaItem.ParentPlayer.MediaElement.BufferingTime = mediaItem.BufferingTime;mediaItem.Paren
45、tPlayer.MediaElement.Source = mediaItem.Source;private static void OnTitlePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)RadMediaItem mediaItem = sender as RadMediaItem;if (mediaItem != null)mediaItem.Header = (string)e.NewValue;private static void OnIsSelectedChanged(
46、DependencyObject sender, DependencyPropertyChangedEventArgs e)HeaderedSelector.SetIsSelected(sender, (bool)e.NewValue);private void SelectInternal()if (Design.Designer.IsInDesignMode)return;if (this.ParentPlayer != null)this.ParentPlayer.SetValue(RadMediaPlayer.SelectedMediaItemKey, this);if (this.P
47、arentPlayer.MediaElement != null)if (this.IsStreamingSource)this.AttachStream();elseif (this.ParentPlayer.AutoPlay)this.ParentPlayer.MediaElement.BufferingTime = this.BufferingTime;this.ParentPlayer.MediaElement.Source = this.Source;elsethis.ParentPlayer.MediaElement.Source = null;private void RadMe
48、diaItem_MouseEnter(object sender, MouseEventArgs e)this.isMouseOver = true;this.UpdateStates();private void RadMediaItem_MouseLeave(object sender, MouseEventArgs e)this.isMouseOver = false;this.UpdateStates();private void RadMediaItem_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)this.Is
49、Selected = true;private void RadMediaItem_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)this.UpdateStates();private void UpdateStates()if (this.IsEnabled)if (this.isMouseOver)VisualStateManager.GoToState(this, RadMediaItem.MouseOverStateName, false);elseVisualStateManager.GoToState(this, RadMediaItem.NormalStateName, false);elseVisualStateMa
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
评论
0/150
提交评论