This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HwndSource hd = PresentationSource.FromVisual(this) as HwndSource; | |
| Rect r = CRootGUI.Common.Helpers.ViewHelper.GetWorkingArea(hd); | |
| [System.Diagnostics.DebuggerStepThrough] | |
| public static Rect GetWorkingArea(HwndSource vis) | |
| { | |
| System.Windows.Forms.Screen scrn = System.Windows.Forms.Screen.PrimaryScreen; | |
| if (vis != null && System.Windows.Forms.Screen.AllScreens.Length > 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //文件存在情况; | |
| //尝试去创建一个一下名称的Mutex | |
| string mutexName = "MyCompany.MyApplication"; | |
| bool createdNew; | |
| mutex = new Mutex(true, mutexName, out createdNew); | |
| //如果创建失败,说明已经创建,因此关闭当前实例 | |
| if (!createdNew) | |
| { | |
| try |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Diagnostics; | |
| using Microsoft.Win32; | |
| using System.Management; | |
| using System.IO; | |
| using System.Reflection; | |
| using System.Threading; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static bool LockApp(bool isLock, string appPath) | |
| { | |
| Shell shell = new Shell(); | |
| Folder folder = shell.NameSpace(Path.GetDirectoryName(appPath)); | |
| FolderItem app = folder.ParseName(Path.GetFileName(appPath)); | |
| string sVerb = isLock ? "锁定到任务栏(&K)" : "从任务栏脱离(&K)"; | |
| foreach (FolderItemVerb item in app.Verbs()) | |
| { | |
| if (item.Name == sVerb) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.ServiceProcess; | |
| using System.Configuration.Install; | |
| static class Program | |
| { | |
| /// <summary> | |
| /// 应用程序的主入口点。 | |
| /// </summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- ItemContainerStyle with the Trigger for Selected --> | |
| <Style x:Key="RedGlowItemContainer" TargetType="{x:Type ListBoxItem}"> | |
| <Setter Property="Template"> | |
| <Setter.Value> | |
| <ControlTemplate TargetType="{x:Type ListBoxItem}"> | |
| <Border BorderThickness="1" | |
| x:Name="IconBorder" HorizontalAlignment="Left" BorderBrush="#00000000"> | |
| <Border.Background> | |
| <SolidColorBrush Color="{DynamicResource DefaultBorderBrushDarkColor}"/> | |
| </Border.Background> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.WindowsAPICodePack.Shell; | |
| ShellFile file = ShellFile.FromFilePath(this.Location); | |
| image.Source = file.Thumbnail.BitmapSource; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //xaml代码 | |
| <Button x:Name="bt_public" Grid.Column="8" Style="{DynamicResource ButtonStylePlay}" Command="{Binding EditCommand}" CommandParameter="4" IsEnabled="False" VerticalAlignment="Center" d:LayoutOverrides="GridBox" HorizontalAlignment="Center" Margin="3,0" | |
| ToolTip="发布" | |
| > | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void UserControl_PreviewMouseWheel(object sender, MouseWheelEventArgs e) | |
| { | |
| e.Handled = true; | |
| // Create a new event and raise it on the desired UserControl. | |
| var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta); | |
| eventArg.RoutedEvent = UIElement.MouseWheelEvent; | |
| eventArg.Source = sender; | |
| var controlToScroll = ScrollContainer; | |
| controlToScroll.RaiseEvent(eventArg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| m_list.InsertColumn(0, "Ux",LVCFMT_CENTER, 200); | |
| m_list.InsertColumn( 1, "different", LVCFMT_CENTER, 200 ); | |
| for(i=0; i<m_ad.size(); i++) | |
| { | |
| str.Format("%lf", m_ad[i].index); | |
| int iRow = m_list.InsertItem(i, str); | |
| str.Format("%lf", m_ad[i].diff*100000); | |
| m_list.SetItemText(iRow, 1, str); | |
| //m_list.InsertItem(0, str); |