/// <inheritdoc /> /// <summary>Raises the <see cref="M:System.Windows.Forms.Control.CreateControl" /> method.</summary> protected override void OnCreateControl() { // remove border BorderStyle = BorderStyle.None; if (!DesignMode) { // set native look for list view items UxTheme.SetWindowTheme(Handle, "explorer", null); // remove focus cues User32.SendMessage(Handle, (uint)User32.WindowMessage.WM_CHANGEUISTATE, new IntPtr(BitHelper.MakeLong((int)User32.UIStateFlags.UIS_SET, (int)User32.UIStateFlags.UISF_HIDEFOCUS)), IntPtr.Zero); // enable double buffer to reduce flicker and display a traslucent selection box User32.SendMessage(Handle, (uint)User32.WindowMessage.LVM_SETEXTENDEDLISTVIEWSTYLE, new IntPtr((int)User32.WindowStylesEx.LVS_EX_DOUBLEBUFFER), new IntPtr((int)User32.WindowStylesEx.LVS_EX_DOUBLEBUFFER)); // reset hot cursor User32.SendMessage(Handle, (uint)User32.WindowMessage.LVM_SETHOTCURSOR, IntPtr.Zero, Cursors.Arrow.Handle); } base.OnCreateControl(); }
protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); SetDoubleBuffer(); SetExpandoesStyle(); SendMessage(this.Handle, TVM_SETEXTENDEDSTYLE, (IntPtr)TVS_EX_AUTOHSCROLL, (IntPtr)TVS_EX_AUTOHSCROLL); UxTheme.SetWindowTheme(this.Handle, "Explorer", 0); }
protected override void OnHandleCreated(EventArgs e) { if (!IsDesignMode) { UxTheme.SetWindowTheme(this.Handle, string.Empty, string.Empty); User32.DisableProcessWindowsGhosting(); } base.OnHandleCreated(e); }
internal static void SetWindowTheme(Control window, String SubAppName, String SubIdList) { if (!Application.RenderWithVisualStyles) { return; } int result; if ((result = UxTheme.SetWindowTheme(window.Handle, SubAppName, SubIdList)) < 0) { throw new InvalidOperationException("SetWindowTheme failed with error " + result.ToString()); } }
public ArchiveDetailView(string pathIconLibrary, string pathArchive) { InitializeComponent(); //_iconReader = new IconReader(); //archiveTree.ImageList = new ImageList(); //_iconReader.ReadIcons(pathIconLibrary).ForEach(o => archiveTree.ImageList.Images.Add(o.Icon)); UxTheme.SetWindowTheme(lvArchiveDetails.Handle, "Explorer", 0); SysImageListHelper.SetListViewImageList(lvArchiveDetails, lst, false); SevenZipExtractor.SetLibraryPath(IntPtr.Size == 8 ? "7z64.dll" : "7z32.dll"); _pathArchive = pathArchive; Shown += ShowArchiveContent; }
public TaskbarButton(VisibleWindow window) { if (window == null) { throw new ArgumentNullException("window", "window is null."); } Window = window; Icon = window.Icon; Image = Icon.ToBitmap(); Text = window.Title; Margin = Padding.Empty; //TODO: find a way to do this managed... // it just doesnt work to call this and use // a managed VisualStyleRenderer instead =/ UxTheme.SetWindowTheme(base.Handle, "Taskband", null); }
protected override void OnHandleCreated(EventArgs e) { try { UxTheme.SetWindowTheme(Handle, string.Empty, string.Empty); User32.DisableProcessWindowsGhosting(); ScaleFactor = DpiHelper.GetScaleFactorForCurrentWindow(Handle); } catch { } base.OnHandleCreated(e); CheckResetDPIAutoScale(true); ResumeLayout(); }
/// <summary> /// Constructs a Craftplacer.ClassicSuite.Wizards.Forms.WizardForm and places the required pages for an SCT installation in it. /// </summary> /// <returns></returns> public static WizardForm CreateWizard() { List <WizardPage> pages = new List <WizardPage>() { new WelcomePage(), new LicensePage(), new InstallOptionsPage(), new InstallPathPage(), new InstallationPage(), new FinishedPage() }; WizardForm form = WizardForm.FromList(pages); form.Text = "Simple Classic Theme Setup Wizard"; form.Icon = Properties.Resources.sct_logo; form.Shown += delegate { UxTheme.SetWindowTheme(form.Handle, " ", " "); }; return(form); }
public UpdateWizard(Updater updater) { this.UpdateLocalPaths = new List <string>(); this.StartPosition = FormStartPosition.CenterParent; this.CurrentUpdater = updater; InitializeComponent(); UxTheme.SetWindowTheme(this.lvAvailableUpdates.Handle, "Explorer", 0); foreach (var item in this.CurrentUpdater.AvailableUpdates) { ListViewItem lvi = new ListViewItem(item.Name); switch (item.Type) { case UpdateTypes.Nightly: lvi.ForeColor = Color.Red; break; case UpdateTypes.Alpha: lvi.ForeColor = Color.DarkOrange; break; case UpdateTypes.Beta: lvi.ForeColor = Color.Blue; break; case UpdateTypes.ReleaseCandidate: lvi.ForeColor = Color.Brown; break; case UpdateTypes.Release: lvi.ForeColor = Color.Black; break; } lvi.SubItems.Add(item.Version); lvi.SubItems.Add(item.Type.ToString()); lvi.SubItems.Add(item.RequiredVersion); lvi.SubItems.Add(item.UpdaterFilePath); lvi.SubItems.Add(item.UpdaterFilePath64); this.lvAvailableUpdates.Items.Add(lvi); } }
public IconView() { InitializeComponent(); UxTheme.SetWindowTheme(lvIcons.Handle, "explorer", 0); }
/// <summary>Sets the window theme.</summary> /// <param name="window">The window on which to apply the theme.</param> /// <param name="subAppName">Name of the sub application. This is the theme name (e.g. "Explorer").</param> /// <param name="subIdList">The sub identifier list. This can be left <c>null</c>.</param> public static void SetWindowTheme(this IWin32Window window, string subAppName, string[] subIdList = null) { var idl = subIdList == null ? null : string.Join(";", subIdList); try { UxTheme.SetWindowTheme(window.Handle, subAppName, idl); } catch { } }
public MoreColumns() { InitializeComponent(); UxTheme.SetWindowTheme(lvColumns.Handle, "explorer", 0); }
protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); System.Windows.Forms.ImageList il = new System.Windows.Forms.ImageList(); il.ImageSize = new System.Drawing.Size(48, 48); System.Windows.Forms.ImageList ils = new System.Windows.Forms.ImageList(); ils.ImageSize = new System.Drawing.Size(16, 16); this.IconSize = 48; ComCtl32.INITCOMMONCONTROLSEX icc = new ComCtl32.INITCOMMONCONTROLSEX(); icc.dwSize = Marshal.SizeOf(typeof(ComCtl32.INITCOMMONCONTROLSEX)); icc.dwICC = 1; var res = ComCtl32.InitCommonControlsEx(ref icc); this.LVHandle = User32.CreateWindowEx(0, "SysListView32", "", User32.WindowStyles.WS_CHILD | User32.WindowStyles.WS_CLIPCHILDREN | User32.WindowStyles.WS_CLIPSIBLINGS | (User32.WindowStyles)User32.LVS_EDITLABELS | (User32.WindowStyles)User32.LVS_OWNERDATA, 0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height, this.Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); User32.ShowWindow(this.LVHandle, User32.ShowWindowCommands.Show); LVCOLUMN column = new LVCOLUMN(); column.mask = LVCF.LVCF_FMT | LVCF.LVCF_TEXT | LVCF.LVCF_WIDTH | LVCF.LVCF_SUBITEM; column.cx = 100; column.iSubItem = 0; column.pszText = "Name"; column.fmt = LVCFMT.LEFT; User32.SendMessage(this.LVHandle, MSG.LVM_INSERTCOLUMN, 0, ref column); LVCOLUMN column2 = new LVCOLUMN(); column2.mask = LVCF.LVCF_FMT | LVCF.LVCF_TEXT | LVCF.LVCF_WIDTH | LVCF.LVCF_SUBITEM; column2.cx = 100; column2.iSubItem = 1; column2.pszText = "Type"; column2.fmt = LVCFMT.LEFT; User32.SendMessage(this.LVHandle, MSG.LVM_INSERTCOLUMN, 1, ref column2); LVCOLUMN column3 = new LVCOLUMN(); column3.mask = LVCF.LVCF_FMT | LVCF.LVCF_TEXT | LVCF.LVCF_WIDTH | LVCF.LVCF_SUBITEM; column3.cx = 100; column3.iSubItem = 2; column3.pszText = "Size"; column3.fmt = LVCFMT.LEFT; User32.SendMessage(this.LVHandle, MSG.LVM_INSERTCOLUMN, 2, ref column3); LVCOLUMN column4 = new LVCOLUMN(); column4.mask = LVCF.LVCF_FMT | LVCF.LVCF_TEXT | LVCF.LVCF_WIDTH | LVCF.LVCF_SUBITEM; column4.cx = 100; column4.iSubItem = 3; column4.pszText = "Date Modified"; column4.fmt = LVCFMT.LEFT; User32.SendMessage(this.LVHandle, MSG.LVM_INSERTCOLUMN, 3, ref column4); User32.SendMessage(this.LVHandle, MSG.LVM_SETIMAGELIST, 0, il.Handle); User32.SendMessage(this.LVHandle, MSG.LVM_SETIMAGELIST, 1, ils.Handle); UxTheme.SetWindowTheme(this.LVHandle, "Explorer", 0); Navigate((ShellItem)KnownFolders.Desktop); User32.SendMessage(this.LVHandle, MSG.LVM_SetExtendedStyle, (int)ListViewExtendedStyles.HeaderInAllViews, (int)ListViewExtendedStyles.HeaderInAllViews); //WinAPI.SendMessage(handle, WinAPI.LVM.LVM_SetExtendedStyle, (int)WinAPI.ListViewExtendedStyles.LVS_EX_AUTOAUTOARRANGE, (int)WinAPI.ListViewExtendedStyles.LVS_EX_AUTOAUTOARRANGE); User32.SendMessage(this.LVHandle, MSG.LVM_SetExtendedStyle, (int)ListViewExtendedStyles.LVS_EX_DOUBLEBUFFER, (int)ListViewExtendedStyles.LVS_EX_DOUBLEBUFFER); }