Public clrCheckBG As Color = Color.FromArgb(255, 206, 237, 250) Public clrMenuBorder As Color = Color.FromArgb(255, 160, 160, 160) Public clrSelectedBG_Drop_Border As Color = Color.FromArgb(255, 48, 127, 177) Public clrSelectedBG_Drop_Blue As Color = Color.FromArgb(255, 139, 195, 225) Public clrSelectedBG_Border As Color = Color.FromArgb(255, 150, 217, 249) Public clrSelectedBG_White As Color = Color.FromArgb(255, 241, 248, 251) Public clrSelectedBG_Header_Blue As Color = Color.FromArgb(255, 146, 202, 230) Public clrSelectedBG_Blue As Color = Color.FromArgb(255, 186, 228, 246) Public clrImageMarginLine As Color = Color.FromArgb(255, 160, 160, 180) Public clrImageMarginWhite As Color = Color.FromArgb(255, 244, 247, 252) Public clrImageMarginBlue As Color = Color.FromArgb(255, 212, 216, 230) Public clrSubmenuBG As Color = Color.FromArgb(255, 240, 240, 240) Public clrHorBG_White As Color = Color.FromArgb(255, 244, 247, 252) Public clrHorBG_GrayBlue As Color = Color.FromArgb(255, 233, 236, 250) This module hosts all the different color constants and a 'DrawRoundedRectangle' function (not mine). ![]() If you want your ToolStrip in a ToolStripContainer, add that too and add your MenuStrip and ToolStrip controls to the ToolStripContainer instead of the form.Īdd a new 'Module' and call it "clsColors.vb". You can rightclick them and choose "Insert Standard Items" to insert the standard items if you wish. If you haven't already got a MenuStrip and/or ToolStrip control, add them now. To make this work, all you need is the following code! No custom controls, just the usual MenuStrip and ToolStrip (not MainMenu and ToolBar!) controls. I don't know if I can change this since that is simply the size of a MenuStrip. The blue selection rectangles for example and the image margins. The arrow after a nested submenu is still white, should be black. Here is a screenshot, with a shot of the VS2008 IDE menu for comparison:ġ. If(WindowState = FormWindowState.I have just finished creating my first ever custom ToolStripRenderer, and I managed to create one that looks very similar to the VisualStudio 2008 IDE. Protected override void WndProc(ref Message m) Public static extern int RegisterWindowMessage(string message) Public static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam) Public static readonly int WM_SHOWME = RegisterWindowMessage("WM_SHOWME") Public const int HWND_BROADCAST = 0xffff this class just wraps some Win32 stuff that we're going to use send our Win32 message to make the currently running instance Static Mutex mutex = new Mutex(true, "") Īpplication.SetCompatibleTextRenderingDefault(false) In the class of my application main I created a static named Mutex: static class Program Knowing that I could use a mutex for this (but never having done itīefore) I set out to cut down my code and simplify my life. While this works, itīrings on a lot of overhead, and I wanted something cleaner. Instance of my myapp.exe in the process list. Today I wanted to refactor some code that prohibited my applicationįrom running multiple instances of itself. The words belong solely to the blog owner at Sanity Free Coding. I'm reproducing the content of the article here for posterity. ![]() ![]() That makes me worry that eventually it might disappear, and with it, the advocated solution. UPDATEĪs of, the article I linked to above is still active, but the blog hasn't been updated in a while. That's a very nice touch that the other Mutex solutions described here do not address. Second, the article shows how to bring the existing instance of the application to the foreground when the user tries to start another instance. But as it is, I do not use the Microsoft.VisualBasic assembly, and I'd rather not add an unnecessary dependency to my project. If my project already had a dependency on that assembly, I would probably advocate using the approach shown in another answer. The approach described by the article is advantageous for two reasons.įirst, it does not require a dependency on the Microsoft.VisualBasic assembly. Here is a very good article regarding the Mutex solution.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |