public void Update(Icon icon, bool inQueue) { _controls.Run.IsEnabled = !inQueue; _controls.Path.Content = _test.GetPath().Locator; _controls.Status.Content = inQueue ? "Queued" : _test.GetStatus(); _controls.Icon.SetIcon(icon); }
protected void assertCurrentNode(ITestPart part, Icon icon, string text) { OutlineNode outlineNode = treeBuilder.LastNode; outlineNode.Part.ShouldBeTheSameAs(part); outlineNode.Icon.ShouldEqual(icon); outlineNode.HeaderText().ShouldEqual(text); }
internal Input(BootstrapHelper helper, FormInputType inputType) : base(helper, "input", Css.FormControl) { OutputEndTag = false; Icon = Icon.None; MergeAttribute("type", inputType.GetDescription()); }
public CommandButton(Icon icon, string text, ICommand command) : this() { image.SetIcon(icon); label.Content = text; button.Command = command; }
private Virtualtray() { _virtualbox = (IVirtualBox) new VirtualBox.VirtualBox(); /* the generated VirtualBox.dll COM library doesn't work with the C# event * system, so we handle events by registering callbacks */ _virtualbox.RegisterCallback(this); _icon = GetIcon("icon/icon-16.ico"); _idleIcon = GetIcon("icon/icon-gray-16.ico"); _notifyIcon = new NotifyIcon(); _notifyIcon.Icon = _idleIcon; _notifyIcon.Text = "Virtualtray"; _notifyIcon.Visible = true; _vms = new Hashtable(); ContextMenu menu = new ContextMenu(); foreach (IMachine machine in _virtualbox.Machines) { MachineMenu mm = new MachineMenu(machine, menu); mm.StateChange += new EventHandler(MachineStateChangeEventHandler); _vms.Add(machine.Id, mm); } menu.MenuItems.Add(new MenuItem("-") {Name = "-"}); menu.MenuItems.Add(new MenuItem("Open VirtualBox...", new EventHandler( MenuLaunchVirtualBoxEventHandler))); menu.MenuItems.Add(new MenuItem("Exit", new EventHandler(MenuExitEventHandler))); _notifyIcon.ContextMenu = menu; ToggleIcon(); _notifyIcon.MouseClick += new MouseEventHandler(IconClickEventHandler); Application.ApplicationExit += new EventHandler(ApplicationExitEventHandler); }
public CommandButton(Icon desiredIcon, string text, ICommand command) : this() { icon.SetIcon(desiredIcon); label.Content = text; button.Command = command; }
public IconStyle(float scale, float heading, Icon icon, vec2 hotSpot) { this.scale = scale; this.heading = heading; this.icon = icon; this.hotSpot = hotSpot; }
static int Main (string [] args) { string icoFile = Path.Combine (AppDomain.CurrentDomain.BaseDirectory, "earth.ico"); Icon ico1 = new Icon (icoFile); if (ico1.Size != new Size (32, 32)) return 1; #if NET_2_0 Icon ico2 = new Icon (icoFile, 20, 40); if (ico2.Size != new Size (32, 32)) return 2; Icon ico3 = new Icon (icoFile, new Size (20, 40)); if (ico3.Size != new Size (32, 32)) return 3; #endif string curFile = Path.Combine (AppDomain.CurrentDomain.BaseDirectory, "text.cur"); Cursor cursor = new Cursor (curFile); if (cursor.Size != new Size (32, 32)) return 4; return 0; }
public OutlineNode(ITestPart part, Icon icon) { Focusable = true; Part = part; IsExpanded = true; Holder = part as IPartHolder; Header = new StackPanel().Horizontal().Configure(x => { _textBlock = x.Add<TextBlock>(); }); Icon = icon; this.BindControlAnd(Key.M).To(() => { if (ContextMenu != null) { ContextMenu.PlacementTarget = this; ContextMenu.VerticalOffset = 5; ContextMenu.HorizontalOffset = 20; ContextMenu.Placement = PlacementMode.RelativePoint; ContextMenu.IsOpen = true; } }); }
public bool SetIcon(int IconIndex, Icon NewIcon) { if (IconIndex >= 0 && IconIndex < IconsList.Count) { IconsList[IconIndex] = NewIcon; return true; } return false; }
public Form1() { InitializeComponent(); sprites = new Sprites(); icon = new Icon(); mainBackground = new MainBackground(); combatBackground = new CombatBackground(); }
public IconStyle(Color color, colorModeEnum colorMode, float scale, Icon icon, vec2 hotSpot) { this.color = color; this.colorMode = colorMode; this.scale = scale; this.icon = icon; this.hotSpot = hotSpot; }
/// <summary> /// Copy constructor /// </summary> /// <param name="other"></param> public Icon(Icon other) : base(other) { if (other.Value != null) Value = (System.Drawing.Icon)other.Value.Clone(); else Value = null; }
void Awake() { GameEvents.onGUIEditorToolbarReady.Add (onGUIEditorToolbarReady); if (texture == null) { texture = GameDatabase.Instance.GetTexture ("ExtraplanetaryLaunchpads/Textures/icon_button", false); icon = new Icon ("EL icon", texture, texture); } }
/* sub_76504 */ internal static void draw_combat_icon(int iconIndex, Icon iconState, int direction, int tileY, int tileX) { DaxBlock icon = gbl.combat_icons[iconIndex].GetIcon(iconState, direction); if (icon != null) { seg040.draw_combat_picture(icon, (tileY * 3) + 1, (tileX * 3) + 1, 0); } }
public static void SetIcon(GameObject gObj, Icon icon) { if (largeIcons == null) { largeIcons = GetTextures("sv_icon_dot", "_pix16_gizmo", 0, 16); } SetIcon(gObj, largeIcons[(int)icon].image as Texture2D); }
private void Form1_Load(object sender, EventArgs e) { // Load the basic set of eight icons. images = new Icon[5]; images[0] = new Icon("C:\\icon1.ico"); images[1] = new Icon("C:\\icon2.ico"); images[2] = new Icon("C:\\icon3.ico"); images[3] = new Icon("C:\\icon4.ico"); images[4] = new Icon("C:\\icon5.ico"); }
public static void Show(string titulo, string mensaje, int hide = 5000, Icon icon = Icon.None) { Show(new NotificationConfig { Title = titulo, Html = mensaje, Icon = icon, HideDelay = hide, }); }
/// <summary> /// Metodo que envía una Alerta por pantalla hacia el Usuario /// </summary> /// <param name="titulo">Título del Mensaje para el Usuario</param> /// <param name="mensaje">Mensaje que verá el Usuario por Pantalla</param> /// <param name="icon">Puede ser INFO, ERROR, NONE(nada), WARNING, QUESTION</param> public static void Show(string titulo, string mensaje, Icon icon = Icon.NONE) { X.MessageBox.Show(new MessageBoxConfig { Title = titulo, Message = mensaje, Icon = icon, Buttons = Button.OK }); }
/// <summary> /// Bootstraps the button. /// </summary> /// <param name="htmlHelper">The HTML helper.</param> /// <param name="id">The id.</param> /// <param name="text">The text.</param> /// <param name="buttonType">Type of the button.</param> /// <param name="buttonSize">Size of the button.</param> /// <param name="disabled">if set to <c>true</c> [disabled].</param> /// <param name="icon">The icon.</param> /// <param name="inverted">if set to <c>true</c> [icon is inverted].</param> /// <param name="isSubmit">if set to <c>true</c> [is submit].</param> /// <returns> /// An MvcHtmlString /// </returns> public static MvcHtmlString BootstrapButton(this HtmlHelper htmlHelper, string id, string text, ButtonType buttonType = ButtonType.@default, ButtonSize buttonSize = ButtonSize.@default, bool disabled = false, Icon icon = Icon.@default, bool inverted = false, bool isSubmit = false) { var tag = new TagBuilder("button"); if (isSubmit) { tag.Attributes.Add("type", "submit"); } return ButtonBuilder(htmlHelper, id, text, string.Empty, tag, buttonType, buttonSize, disabled, icon, inverted); }
/// <summary> /// Finds the Typeface to apply for a given icon. </summary> /// <param name="icon"> The icon for which you need the typeface. </param> /// <returns> The font descriptor which contains info about the typeface to apply, or null /// if the icon cannot be found. In that case, check that you properly added the modules /// using <seealso cref="#with(IconFontDescriptor)"/>} prior to calling this method. </returns> public static IconFontDescriptorWrapper findTypefaceOf(Icon icon) { foreach (IconFontDescriptorWrapper iconFontDescriptor in iconFontDescriptors) { if (iconFontDescriptor.hasIcon(icon)) { return iconFontDescriptor; } } return null; }
public FormMain() { InitializeComponent(); iconNotification = Icon.FromHandle(((Bitmap)imageListMain.Images[0]).GetHicon()); iconNotificationBlank = Icon.FromHandle(((Bitmap)imageListMain.Images[1]).GetHicon()); this.Icon = iconNotification; this.notifyIconMain.Icon = iconNotification; this.notifyIconMain.Text = userName; timerMain.Start(); getMessage(); }
public MinMaxCategoryRenderer() { MinMaxCategoryRenderer categoryRenderer = this; this.plotLines = false; this.groupPaint = (Paint) Color.black; this.groupStroke = (Stroke) new BasicStroke(1f); this.minIcon = this.getIcon((Shape) new Arc2D.Double(-4.0, -4.0, 8.0, 8.0, 0.0, 360.0, 0), (Paint) null, (Paint) Color.black); this.maxIcon = this.getIcon((Shape) new Arc2D.Double(-4.0, -4.0, 8.0, 8.0, 0.0, 360.0, 0), (Paint) null, (Paint) Color.black); this.objectIcon = this.getIcon((Shape) new Line2D.Double(-4.0, 0.0, 4.0, 0.0), false, true); this.lastCategory = -1; }
public static void Show(string titulo, string mensaje, string fn,Icon icon = Icon.None, int hide = 5000) { Show(new NotificationConfig { Title = titulo, Html = mensaje, Icon = icon, HideDelay = hide, Listeners = { Hide = { Fn = fn } } }); }
public void IconSetValue () { // Icon only provides getters - trying SetValue throws Icon icon = new Icon (); Assert.Throws<ArgumentException> (delegate { icon.SetValue (Icon.SizeProperty, Size.Empty); }, "SizeProperty"); Assert.Throws<ArgumentException> (delegate { icon.SetValue (Icon.SourceProperty, null); }, "SourceProperty"); }
public ButtonWrapper(Rect defaultPosition, string imageFilename, string noImageText, string tooltip, Action onClickHandler, string configNodeName = "Icon") { button = ToolbarButton.Create(imageFilename, noImageText, tooltip, onClickHandler); if (button == null) { this.Log("Failed to create the toolbar button, using my Icon instead."); icon = new Icon<ButtonWrapper>(defaultPosition, imageFilename, noImageText, tooltip, onClickHandler, configNodeName); } }
public CustomTypefaceSpan(Icon icon, Typeface type, float iconSizePx, float iconSizeRatio, int iconColor, bool rotate) { _rotate = rotate; _icon = icon.Character.ToString(); _typeface = type; _iconSizePx = iconSizePx; _iconSizeRatio = iconSizeRatio; _iconColor = new Color(iconColor); _rotationStartTime = DateTimeHelpers.CurrentUnixTimeMillis(); }
public void AddCommand(string text, ICommand command, Icon icon) { this.Add<Button>(x => { x.ToIconButton(icon, command).Text(text); x.VerticalAlignment = VerticalAlignment.Stretch; x.Height = 30; x.Margin = new Thickness(5, 0, 5, 0); x.HorizontalAlignment = HorizontalAlignment.Right; }); }
void onGUIEditorToolbarReady() { if (icon == null) { //texture = GameDatabase.Instance.GetTexture ("ExtraplanetaryLaunchpads/Textures/icon_button", false); var iconloader = PartCategorizer.Instance.iconLoader; icon = iconloader.GetIcon("R&D_node_icon_fuelsystems"); } var cat = PartCategorizer.Instance.filters.Find (c => c.button.categoryName == "Filter by Module"); var subcat = cat.subcategories.Find (c => c.button.categoryName == "Modular Fuel Tank"); subcat.button.SetIcon (icon); }
public DaxBlock GetIcon(Icon iconState, int direction) { if (iconState == Icon.Normal) { return direction > 3 ? normal_f : normal; } else { return direction > 3 ? attack_f : attack; } }
protected override void OnLoad(EventArgs ev) { base.OnLoad(ev); Exception e = m_Exception; // キャプション生成 this.Text = "エラー"; // アイコンセット if (m_Icon == null) { m_Icon = SystemIcons.Exclamation; } this.Icon = m_Icon; // 表示メッセージ取得 this.lblMessage.Text = m_MainMessage != null ? m_MainMessage : e.Message; Rectangle picRect = new Rectangle(Padding, Padding, m_Icon.Size.Width, m_Icon.Size.Height); this.lblMessage.Left = picRect.Right + Padding; this.lblMessage.Top = picRect.Top + Padding; Rectangle msgRect = this.lblMessage.Bounds; Rectangle btnRect = this.btnOK.Bounds; Size panelSize = this.pnlMain.ClientSize; int right = Math.Max(msgRect.Right, this.ClientSize.Width); int bottom = Math.Max(msgRect.Bottom, picRect.Bottom); Size size = new Size(right + Padding, bottom + Padding + (panelSize.Height - btnRect.Top)); this.pnlMain.ClientSize = size; m_InitialSize = SizeFromClientSize(size); this.Size = this.MinimumSize = this.MaximumSize = m_InitialSize; this.MinimumSize = m_InitialSize; this.pnlMain.Paint += new PaintEventHandler(pnlMain_Paint); // 内部例外のメッセージとスタックとレースを取得する StringBuilder sb = new StringBuilder(); sb.AppendLine("-------- メッセージ --------"); e = m_Exception; for (int i = 0; e != null; i++) { if (i != 0) { sb.AppendLine(); } sb.AppendLine(e.Message); e = e.InnerException; } // 内部例外も含めて全てのスタックトレースを追加する sb.AppendLine("-------- スタックトレース --------"); e = m_Exception; for (int i = 0; e != null; i++) { if (i != 0) { sb.AppendLine("--------"); } sb.AppendLine(e.StackTrace); e = e.InnerException; } this.tbDetail.Text = sb.ToString(); }
public OrderZForm(DataRow orderRow) { InitializeComponent(); /// try// 图标 { Icon = new Icon(Path.Combine(Application.StartupPath, @"Image\Skin\OrderDetails.ico")); } catch (UnauthorizedAccessException) { MessageBox.Show("无权限加载窗口图标图标文件,请尝试使用管理员权限重新运行本程序", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); return; } catch (FileNotFoundException) { MessageBox.Show("窗口图标图标文件不存在,程序将自动退出", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); return; } catch (Exception ex) { MessageBox.Show("加载窗口图标图标时发生如下错误,程序将自动退出,描述如下\r\n\r\n" + ex.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); return; } /// Text = "订单 - " + orderRow["订单号"] + " - 的打版信息"; /// /// List <string> files = OrderFiles.Get(orderRow); // 重新查找文件是因为主页是列表模式时没有搜索过文件 bool unImage = true; // 是否搜索到图片 foreach (string str in files) // 加载缩略图 { string extension = Path.GetExtension(str).ToLower(); if (File.Exists(str) && (extension == ".jpg" || extension == ".jpeg" || extension == ".png" || extension == ".bmp" || extension == ".gif"))// 不是图片格式时静默跳过 { Bitmap bmp = new Bitmap(str); picturePanel.BackColor = bmp.GetPixel(bmp.Width - 1, bmp.Height - 1); orderPictureBox.Image = bmp; unImage = false; break; } } if (unImage) { orderPictureBox.Image = Image.FromFile(@"Image\Extension\UnImage.png"); // 如果没有匹配到图片,加载缺失图片 } /// filesListView.Columns.Add("::"); filesListView.Columns[0].Width = 600; for (int i = 0; i < files.Count; i++) { Image icon; string extension = Path.GetExtension(files[i]).ToLower(); switch (extension) { case ".jpg": case ".jpeg": case ".png": case ".gif": case ".bmp": case ".tif": { icon = ImageZoom.Zoom(Image.FromFile(files[i]), 64, 64); break; } case ".ai": case ".eps": case ".svg": { icon = ImageZoom.Zoom(Image.FromFile(@"Image\Extension\ai.png"), 64, 64); break; } case ".psd": { icon = ImageZoom.Zoom(Image.FromFile(@"Image\Extension\psd.png"), 64, 64); break; } case ".cdr": { icon = ImageZoom.Zoom(Image.FromFile(@"Image\Extension\cdr.png"), 64, 64); break; } case ".doc": case ".docx": { icon = ImageZoom.Zoom(Image.FromFile(@"Image\Extension\doc.png"), 64, 64); break; } case ".ppt": case ".pptx": { icon = ImageZoom.Zoom(Image.FromFile(@"Image\Extension\ppt.png"), 64, 64); break; } case ".xls": case ".xlsx": { icon = ImageZoom.Zoom(Image.FromFile(@"Image\Extension\xls.png"), 64, 64); break; } case ".pdf": { icon = ImageZoom.Zoom(Image.FromFile(@"Image\Extension\pdf.png"), 64, 64); break; } case ".dst": { icon = ImageZoom.Zoom(Image.FromFile(@"Image\Extension\dst.png"), 64, 64); break; } case ".emb": { icon = ImageZoom.Zoom(Image.FromFile(@"Image\Extension\emb.png"), 64, 64); break; } case ".omf": { icon = ImageZoom.Zoom(Image.FromFile(@"Image\Extension\omf.png"), 64, 64); break; } case ".psf": { icon = ImageZoom.Zoom(Image.FromFile(@"Image\Extension\psf.png"), 64, 64); break; } case ".pxf": { icon = ImageZoom.Zoom(Image.FromFile(@"Image\Extension\pxf.png"), 64, 64); break; } default: { icon = ImageZoom.Zoom(Image.FromFile(@"Image\Extension\UnImage.png"), 64, 64); break; } } filesIconImageList.Images.Add(icon); ListViewItem listViewItem = new ListViewItem();// 定义单个项目 listViewItem.ImageIndex = i; listViewItem.Text = files[i]; filesListView.Items.Add(listViewItem); } filesListView.SmallImageList = filesIconImageList; filesListView.LargeImageList = filesIconImageList; /// messageListView.Columns.Add("::"); messageListView.Columns[0].Width = 100; messageListView.Columns.Add("::"); messageListView.Columns[1].Width = 150; ListViewItem OrderQuoteName = new ListViewItem();// 估针编号 OrderQuoteName.Text = "估针编号"; OrderQuoteName.SubItems.Add(orderRow["估针编号"].ToString()); messageListView.Items.Add(OrderQuoteName); ListViewItem OrderQuoteCount = new ListViewItem();// 估针针数 OrderQuoteCount.Text = "估针针数"; OrderQuoteCount.SubItems.Add(orderRow["估针针数始"].ToString() + "-" + orderRow["估针针数终"].ToString()); messageListView.Items.Add(OrderQuoteCount); ListViewItem OrderQuoteZ = new ListViewItem();// 估针打版师 OrderQuoteZ.Text = "估针打版师"; OrderQuoteZ.SubItems.Add(orderRow["估针打版师"].ToString()); messageListView.Items.Add(OrderQuoteZ); ListViewItem EmbWidth = new ListViewItem();// 版带宽 EmbWidth.Text = "版带宽"; EmbWidth.SubItems.Add(orderRow["版带宽"].ToString()); messageListView.Items.Add(EmbWidth); ListViewItem EmbHeight = new ListViewItem();// 版带高 EmbHeight.Text = "版带高"; EmbHeight.SubItems.Add(orderRow["版带高"].ToString()); messageListView.Items.Add(EmbHeight); ListViewItem EmbPosition = new ListViewItem();// 面料或位置 EmbPosition.Text = "面料或位置"; EmbPosition.SubItems.Add(orderRow["面料或位置"].ToString()); messageListView.Items.Add(EmbPosition); ListViewItem EmbOriginalZ = new ListViewItem();// 原打版师 EmbOriginalZ.Text = "原版打版师"; EmbOriginalZ.SubItems.Add(orderRow["原版打版师"].ToString()); messageListView.Items.Add(EmbOriginalZ); /// otherListView.Columns.Add("::"); otherListView.Columns[0].Width = 120; otherListView.Columns.Add("::"); otherListView.Columns[1].Width = Width - 157; ListViewItem OrderDescription = new ListViewItem();// 打带说明 OrderDescription.Text = "打带说明"; OrderDescription.SubItems.Add(orderRow["打带说明"].ToString()); otherListView.Items.Add(OrderDescription); ListViewItem zDescription = new ListViewItem();// 打版师 zDescription.Text = "打版师注意事项"; zDescription.SubItems.Add(orderRow["打版师注意事项"].ToString()); otherListView.Items.Add(zDescription); ListViewItem eDescription = new ListViewItem();// 车版师 eDescription.Text = "车版师注意事项"; eDescription.SubItems.Add(orderRow["车版师注意事项"].ToString()); otherListView.Items.Add(eDescription); ListViewItem otherSuggest = new ListViewItem();// 车版师 otherSuggest.Text = "建议及其他"; otherSuggest.SubItems.Add(orderRow["建议及其他"].ToString()); otherListView.Items.Add(otherSuggest); /// }
public void SetIcon(Icon icon) { _dockingManager.SetDockIcon(_control, icon); }
public void ExtractAssociatedIcon_Empty() { Icon.ExtractAssociatedIcon(String.Empty); }
public ConfigForm(ShadowsocksController controller, UpdateChecker updateChecker, int focusIndex) { this.Font = System.Drawing.SystemFonts.MessageBoxFont; InitializeComponent(); ServersListBox.Font = CreateFont(); NumServerPort.Minimum = IPEndPoint.MinPort; NumServerPort.Maximum = IPEndPoint.MaxPort; NumUDPPort.Minimum = IPEndPoint.MinPort; NumUDPPort.Maximum = IPEndPoint.MaxPort; this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon()); this.controller = controller; this.updateChecker = updateChecker; if (updateChecker.LatestVersionURL == null) { LinkUpdate.Visible = false; } foreach (string name in EncryptorFactory.GetEncryptor()) { EncryptorInfo info = EncryptorFactory.GetEncryptorInfo(name); if (info.display) { EncryptionSelect.Items.Add(name); } } UpdateTexts(); controller.ConfigChanged += controller_ConfigChanged; LoadCurrentConfiguration(); if (_modifiedConfiguration.index >= 0 && _modifiedConfiguration.index < _modifiedConfiguration.configs.Count) { _oldSelectedID = _modifiedConfiguration.configs[_modifiedConfiguration.index].id; } if (focusIndex == -1) { int index = _modifiedConfiguration.index + 1; if (index < 0 || index > _modifiedConfiguration.configs.Count) { index = _modifiedConfiguration.configs.Count; } focusIndex = index; } if (_modifiedConfiguration.isHideTips) { PictureQRcode.Visible = false; } int dpi_mul = Util.Utils.GetDpiMul(); //ServersListBox.Height = ServersListBox.Height * 4 / dpi_mul; ServersListBox.Width = ServersListBox.Width * dpi_mul / 4; //ServersListBox.Height = ServersListBox.Height * dpi_mul / 4; ServersListBox.Height = checkAdvSetting.Top + checkAdvSetting.Height; AddButton.Width = AddButton.Width * dpi_mul / 4; AddButton.Height = AddButton.Height * dpi_mul / 4; DeleteButton.Width = DeleteButton.Width * dpi_mul / 4; DeleteButton.Height = DeleteButton.Height * dpi_mul / 4; UpButton.Width = UpButton.Width * dpi_mul / 4; UpButton.Height = UpButton.Height * dpi_mul / 4; DownButton.Width = DownButton.Width * dpi_mul / 4; DownButton.Height = DownButton.Height * dpi_mul / 4; //IPTextBox.Width = IPTextBox.Width * dpi_mul / 4; //ServerPortNumericUpDown.Width = ServerPortNumericUpDown.Width * dpi_mul / 4; //PasswordTextBox.Width = PasswordTextBox.Width * dpi_mul / 4; //EncryptionSelect.Width = EncryptionSelect.Width * dpi_mul / 4; //TCPProtocolComboBox.Width = TCPProtocolComboBox.Width * dpi_mul / 4; //ObfsCombo.Width = ObfsCombo.Width * dpi_mul / 4; //TextObfsParam.Width = TextObfsParam.Width * dpi_mul / 4; //RemarksTextBox.Width = RemarksTextBox.Width * dpi_mul / 4; //TextGroup.Width = TextGroup.Width * dpi_mul / 4; //TextLink.Width = TextLink.Width * dpi_mul / 4; //TextUDPPort.Width = TextUDPPort.Width * dpi_mul / 4; //int font_height = 9; //EncryptionSelect.Height = EncryptionSelect.Height - font_height + font_height * dpi_mul / 4; //TCPProtocolComboBox.Height = TCPProtocolComboBox.Height - font_height + font_height * dpi_mul / 4; //ObfsCombo.Height = ObfsCombo.Height - font_height + font_height * dpi_mul / 4; //OKButton.Width = OKButton.Width * dpi_mul / 4; OKButton.Height = OKButton.Height * dpi_mul / 4; //MyCancelButton.Width = MyCancelButton.Width * dpi_mul / 4; MyCancelButton.Height = MyCancelButton.Height * dpi_mul / 4; DrawLogo(350 * dpi_mul / 4); //DrawLogo(350); ShowWindow(); if (focusIndex >= 0 && focusIndex < _modifiedConfiguration.configs.Count) { SetServerListSelectedIndex(focusIndex); LoadSelectedServer(); } UpdateServersListBoxTopIndex(); }
public bool ShowEntryProperties(TextEntry entry, Icon icon) => false;
void UpdateAppListView() { ImageList ls = new ImageList(); string query = "SELECT ExecutablePath FROM Win32_Process"; ManagementObjectSearcher searcher = new ManagementObjectSearcher(query); moc = searcher.Get(); var ps = Process.GetProcesses() .Where(p => string.IsNullOrWhiteSpace(p.MainWindowTitle) == false) .GroupBy(p => p.ProcessName) .Select(g => g.First()) .Select(p => { SHFILEINFO shinfo = new SHFILEINFO(); string appPath = ProcessExecutablePath(p); IntPtr hSuccess = SHGetFileInfo(appPath, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), SHGFI_ICON | SHGFI_LARGEICON); if (hSuccess != IntPtr.Zero) { Icon appIcon = Icon.FromHandle(shinfo.hIcon); return(new tmpImageItem() { Path = appPath, appIcon = appIcon }); } else { // TODO Icon appIcon = new Icon("../../../Resources/dummy.ico"); return(new tmpImageItem() { Path = appPath, appIcon = appIcon }); } }) .Where(item => item != null).ToArray(); ls.Images.Add("Any", new Bitmap("../../../Resources/ANYIcon.png")); foreach (var item in ps) { ls.Images.Add(item.Path, item.appIcon); } foreach (var item in appListFromReg.OrderBy(item => Path.GetFileName(item.Path))) { if (!ls.Images.ContainsKey(item.Path)) { ls.Images.Add(item.Path, item.appIcon); } } appListView.LargeImageList = ls; appListView.LargeImageList.ImageSize = new Size(32, 32); for (int i = 0; i < appListView.LargeImageList.Images.Count; i++) { appListView.Items.Add(new ListViewItem() { Text = System.IO.Path.GetFileNameWithoutExtension(appListView.LargeImageList.Images.Keys[i]), ImageIndex = i }); } }
private void DrawTab(Graphics g, TabVS2012Dark tab) { Rectangle rectTabOrigin = GetTabRectangle(tab); if (rectTabOrigin.IsEmpty) { return; } DockState dockState = tab.Content.DockHandler.DockState; IDockContent content = tab.Content; Color textColor; if (tab.Content.DockHandler.IsActivated || tab.IsMouseOver) { textColor = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.StartColor; } else { textColor = DockPanel.Skin.AutoHideStripSkin.DockStripGradient.EndColor; } Rectangle rectThickLine = rectTabOrigin; rectThickLine.X += _TabGapLeft + _TextGapLeft + _ImageGapLeft + _ImageWidth; rectThickLine.Width = TextRenderer.MeasureText(tab.Content.DockHandler.TabText, TextFont).Width - 8; rectThickLine.Height = Measures.AutoHideTabLineWidth; if (dockState == DockState.DockBottomAutoHide || dockState == DockState.DockLeftAutoHide) { rectThickLine.Y += rectTabOrigin.Height - Measures.AutoHideTabLineWidth; } else if (dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide) { rectThickLine.Y += 0; } g.FillRectangle(new SolidBrush(textColor), rectThickLine); //Set no rotate for drawing icon and text Matrix matrixRotate = g.Transform; g.Transform = MatrixIdentity; // Draw the icon Rectangle rectImage = rectTabOrigin; rectImage.X += ImageGapLeft; rectImage.Y += ImageGapTop; int imageHeight = rectTabOrigin.Height - ImageGapTop - ImageGapBottom; int imageWidth = ImageWidth; if (imageHeight > ImageHeight) { imageWidth = ImageWidth * (imageHeight / ImageHeight); } rectImage.Height = imageHeight; rectImage.Width = imageWidth; rectImage = GetTransformedRectangle(dockState, rectImage); if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) { // The DockState is DockLeftAutoHide or DockRightAutoHide, so rotate the image 90 degrees to the right. Rectangle rectTransform = RtlTransform(rectImage, dockState); Point[] rotationPoints = { new Point(rectTransform.X + rectTransform.Width, rectTransform.Y), new Point(rectTransform.X + rectTransform.Width, rectTransform.Y + rectTransform.Height), new Point(rectTransform.X, rectTransform.Y) }; using (Icon rotatedIcon = new Icon(((Form)content).Icon, 16, 16)) { g.DrawImage(rotatedIcon.ToBitmap(), rotationPoints); } } else { // Draw the icon normally without any rotation. g.DrawIcon(((Form)content).Icon, RtlTransform(rectImage, dockState)); } // Draw the text Rectangle rectText = rectTabOrigin; rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft; rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft; rectText = RtlTransform(GetTransformedRectangle(dockState, rectText), dockState); if (DockPanel.ActiveContent == content || tab.IsMouseOver) { textColor = DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.ActiveTabGradient.TextColor; } else { textColor = DockPanel.Skin.DockPaneStripSkin.ToolWindowGradient.InactiveTabGradient.TextColor; } if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) { g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabVertical); } else { g.DrawString(content.DockHandler.TabText, TextFont, new SolidBrush(textColor), rectText, StringFormatTabHorizontal); } // Set rotate back g.Transform = matrixRotate; }
/// <summary> /// Overloaded Constructor -- 5 -- /// Icon = Programmer must provide, /// Tooltip = Programmer must provide, /// Visibility = Programmer must provide, /// ContextMenu = Programmer must provide. /// </summary> public SystemTrayNotification(System.Windows.Forms.Form form, bool visible, string toolTip, Icon icon, ContextMenu contextMenu) { SystemTrayNotification_base(form, visible, toolTip, icon, contextMenu); }
/// <summary> /// Overloaded Constructor -- 3 -- /// Icon = Programmer must provide, /// Tooltip = Programmer must provide, /// Visibility = Programmer must provide, /// ContextMenu = SystemTrayNotifyIcon class generated menu (Default). /// </summary> public SystemTrayNotification(System.Windows.Forms.Form form, bool visible, string toolTip, Icon icon) { SystemTrayNotification_base(form, visible, toolTip, icon, null); }
public TreeListFormController(Form mdiForm, string name, string caption, Icon icon, CardForm entity_form, CardTreeForm tree_form) : this(mdiForm, name, caption, icon, true, true, null) { EntityForm = entity_form; TreeList.EntityForm = tree_form; }
public static Icon ToIcon(this Bitmap bmp) { IntPtr handle = bmp.GetHicon(); return(Icon.FromHandle(handle)); }
public void ExtractAssociatedIcon() { string filename_dll = Assembly.GetExecutingAssembly().Location; Assert.IsNotNull(Icon.ExtractAssociatedIcon(filename_dll), "dll"); }
public void ExtractAssociatedIcon_DoesNotExists() { Icon.ExtractAssociatedIcon("does-not-exists.png"); }
/// <summary> /// embedding the resource using the Visual Studio designer results in a blurry icon. /// the best way to get a non-blurry icon for Windows 7 apps. /// </summary> private void InitAppIcon() { assembly = Assembly.GetAssembly(typeof(MainForm)); Icon = new Icon(GetResourceStream("CefSpiderLogo.ico"), new Size(64, 64)); }
private void topPanel_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawIcon(Icon.ExtractAssociatedIcon(Application.ExecutablePath), 20, 8); e.Graphics.DrawString(TopCaption, new Font("Segoe UI", 14f), Brushes.Azure, new PointF(70, 10)); }
public SpawnBuilder() : base(EditorSystemType.Spawn, "Spawn", "Spawns") { // @TODO: Give unique icons to each system for easier identification Icon = Icon.FromHandle(Properties.Resources.stat_16.GetHicon()); }
public static bool SetConsoleIcon(Icon icon) { return(SetConsoleIcon(icon.Handle)); }
private void goGenerateProcessesFriendship() { spaceForProcesses.Left = 150; spaceForProcesses.Width = spaceForProcesses.Width - 150; spaceForProcesses.Top = bottomPanel.Top; spaceForProcesses.Height = bottomPanel.Height; spaceForProcesses.Invalidate(); foreach (var theProcess in Process.GetProcesses()) { Label hmGreatJobFantasticAmazing = new Label(); // hmGreatJobFantasticAmazing.BackgroundImageLayout = ImageLayout.Center; if (theProcess.MainWindowTitle != "") { //hmGreatJobFantasticAmazing.Text = theProcess.MainWindowTitle; hmGreatJobFantasticAmazing.Margin = new Padding(6, 0, 6, 0); hmGreatJobFantasticAmazing.Visible = true; // hmGreatJobFantasticAmazing.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 13, FontStyle.Italic); Icon.ExtractAssociatedIcon(theProcess.Modules[0].FileName).ToBitmap().Save(@"C:\ProjectSnowshoes\temptaskico.png"); DualImageForm thanksVKLines = new DualImageForm(); thanksVKLines.pic = Icon.ExtractAssociatedIcon(theProcess.Modules[0].FileName).ToBitmap(); thanksVKLines.analyze(); thanksVKLines.pic2.Save(@"C:\ProjectSnowshoes\newtemptaskico.png"); ImageFactory grayify = new ImageFactory(); grayify.Load(@"C:\ProjectSnowshoes\temptaskico.png"); //grayify.Tint(Color.FromName(Properties.Settings.Default.custColor[Properties.Settings.Default.whoIsThisCrazyDoge])); //grayify.Tint(Color.FromName("Gray")); hmGreatJobFantasticAmazing.Image = grayify.Image; Label areYouSeriouslyStillDoingThisLetItGo = new Label(); hmGreatJobFantasticAmazing.Click += (sender, args) => { System.Diagnostics.Process.Start(theProcess.Modules[0].FileName); }; hmGreatJobFantasticAmazing.MouseHover += (sender, args) => { int recordNao = hmGreatJobFantasticAmazing.Left; //hmGreatJobFantasticAmazing.BackgroundImageLayout = ImageLayout.Zoom; //hmGreatJobFantasticAmazing.Height = 75; /*hmGreatJobFantasticAmazing.ImageAlign = ContentAlignment.MiddleLeft; * hmGreatJobFantasticAmazing.AutoEllipsis = true; * hmGreatJobFantasticAmazing.Width = 250; * hmGreatJobFantasticAmazing.BackColor = Color.FromName(Properties.Settings.Default.custColor[Properties.Settings.Default.whoIsThisCrazyDoge]); * hmGreatJobFantasticAmazing.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 14, FontStyle.Regular); * hmGreatJobFantasticAmazing.ForeColor = Color.White; * * hmGreatJobFantasticAmazing.TextAlign = ContentAlignment.MiddleLeft; * hmGreatJobFantasticAmazing.Text = " " + theProcess.MainWindowTitle;*/ hmGreatJobFantasticAmazing.BackColor = Color.FromName(Properties.Settings.Default.custColor[Properties.Settings.Default.whoIsThisCrazyDoge]); areYouSeriouslyStillDoingThisLetItGo.Left = recordNao + 150; areYouSeriouslyStillDoingThisLetItGo.Text = theProcess.MainWindowTitle; areYouSeriouslyStillDoingThisLetItGo.BackColor = Color.FromName(Properties.Settings.Default.custColor[Properties.Settings.Default.whoIsThisCrazyDoge]); areYouSeriouslyStillDoingThisLetItGo.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 14, FontStyle.Regular); areYouSeriouslyStillDoingThisLetItGo.ForeColor = Color.White; areYouSeriouslyStillDoingThisLetItGo.TextAlign = ContentAlignment.MiddleLeft; panel1.Controls.Add(areYouSeriouslyStillDoingThisLetItGo); //Measuring string turnt-up-edness was guided by an answer on Stack Overflow by Tom Anderson. Graphics heyGuessWhatGraphicsYeahThatsRight = Graphics.FromImage(new Bitmap(1, 1)); SizeF sure = heyGuessWhatGraphicsYeahThatsRight.MeasureString(theProcess.MainWindowTitle, new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 14, FontStyle.Regular, GraphicsUnit.Point)); Size sureAgain = sure.ToSize(); if (sureAgain.Width >= 300) { areYouSeriouslyStillDoingThisLetItGo.Width = sureAgain.Width + 10; } else { areYouSeriouslyStillDoingThisLetItGo.Width = 300; } areYouSeriouslyStillDoingThisLetItGo.Height = bottomPanel.Height; areYouSeriouslyStillDoingThisLetItGo.Top = Screen.PrimaryScreen.WorkingArea.Height - bottomPanel.Height; areYouSeriouslyStillDoingThisLetItGo.Show(); areYouSeriouslyStillDoingThisLetItGo.Visible = true; areYouSeriouslyStillDoingThisLetItGo.BringToFront(); areYouSeriouslyStillDoingThisLetItGo.Invalidate(); //hmGreatJobFantasticAmazing.BringToFront(); //panel1.Controls.Add(hmGreatJobFantasticAmazing); //hmGreatJobFantasticAmazing.Top = bottomPanel.Top - 40; //hmGreatJobFantasticAmazing.Left = recordNao + 150; //hmGreatJobFantasticAmazing.BringToFront(); //hmGreatJobFantasticAmazing.Invalidate(); /*hmGreatJobFantasticAmazing.Height = 100; * hmGreatJobFantasticAmazing.Width = 100;*/ }; hmGreatJobFantasticAmazing.MouseLeave += (sender, args) => { /*hmGreatJobFantasticAmazing.ImageAlign = ContentAlignment.MiddleCenter; * hmGreatJobFantasticAmazing.AutoEllipsis = false; * hmGreatJobFantasticAmazing.Width = 40; * hmGreatJobFantasticAmazing.BackColor = Color.Transparent; * //hmGreatJobFantasticAmazing.Font = new System.Drawing.Font(Properties.Settings.Default.fontsOfScience[Properties.Settings.Default.whoIsThisCrazyDoge], 14, FontStyle.Regular); * //hmGreatJobFantasticAmazing.ForeColor = Color.White; * * hmGreatJobFantasticAmazing.TextAlign = ContentAlignment.MiddleLeft; * hmGreatJobFantasticAmazing.Text = "";*/ panel1.Controls.Remove(areYouSeriouslyStillDoingThisLetItGo); hmGreatJobFantasticAmazing.BackColor = Color.Transparent; }; openFileToolTip.SetToolTip(hmGreatJobFantasticAmazing, theProcess.MainWindowTitle); //hmGreatJobFantasticAmazing.BackgroundImage = Icon.ExtractAssociatedIcon(theProcess.Modules[0].FileName).ToBitmap(); hmGreatJobFantasticAmazing.Height = bottomPanel.Height; hmGreatJobFantasticAmazing.Width = 40; spaceForProcesses.Controls.Add(hmGreatJobFantasticAmazing); } } }
static Image MakeLogoNoLogo() { Icon icon = Properties.Resources.Icon1; return(icon.ToBitmap()); }
public MainForm() { #if Core this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f); #endif InitializeComponent(); _commandsFrame.SetBoldFonts(); _viewsFrame.SetBoldFonts(); #if SegoeFont this.Font = SystemFonts.MessageBoxFont; #endif #if Core && SegoeFont //@ maybe this is a bug in Core because we have to set the Font to the UserControls _commandsFrame.SetFonts(this.Font); _viewsFrame.SetFonts(this.Font); _xmlSourceFrame.SetFonts(this.Font); #endif if (components == null) { components = new Container(); } this.Text = RS_RIBBON_TOOLS; this.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); FormMain = this; CreateMainBitmaps(); Settings.Instance.Read(this.MinimumSize); this.Size = Settings.Instance.ApplicationSize; _buildPreviewHelper = BuildPreviewHelper.Instance; _buildPreviewHelper.SetActions(null, SetPreviewEnabled, Log, SetLanguages); toolPreviewLanguageCombo.Enabled = false; toolPreviewLanguageCombo.SelectedIndex = 0; InitEvents(); InitActions(); toolVersion.Text = "Version: " + Application.ProductVersion; // constructor Create() //{ _document = new TRibbonDocument(); //_compiler = new RibbonCompiler(); //_compiler.OnMessage = RibbonCompilerMessage; //// Handle command line options //if ((ParamCount > 0) && File.Exists(ParamStr(1))) // File passed at the command line? // OpenFile(ParamStr(1)); //if (FindCmdLineSwitch("BUILD")) //{ // ActionBuild.Execute(); // Application.ShowMainForm = false; // Application.Terminate(); //}// if /BUILD //else //{ // NewFile(true); //}//else //UpdateControls(); //@ added why? _commandsFrame.RefreshSelection(); //@ added ShortCutKeysHandler = new ShortCutKeysHandler(base.ProcessCmdKey); }
[Test, ExpectedException()] //ToDo: System.ComponentModel.Win32Exception public void Only256InFile() { using (FileStream fs = File.OpenRead(TestBitmap.getInFile("bitmaps/only256.ico"))) { Icon icon = new Icon(fs, 0, 0); } }
/// <summary> /// Form Constructor /// </summary> public MultipleViewForm() { // // Required for Windows Form Designer support // InitializeComponent(); this.GridSettings(); #region Buffer text gridControl1.Model.TextDataExchange.PasteTextFromBuffer( "1\tDavolio Nancy\r\n" + "2\tFuller Andrew\r\n"+ "3\tLeverling Janet\r\n"+ "4\tPeacock Margaret\r\n" + "5\tBuchanan Steven\r\n"+ "6\tSuyama Michael\r\n"+ "7\tKing Robert\r\n"+ "8\tCallahan Laura\r\n"+ "9\tDodsworth Anne\r\n", GridRangeInfo.Cell(1, 1), int.MaxValue); #endregion #region Style Info GridStyleInfo standard = gridControl1.BaseStylesMap["Standard"].StyleInfo; //System.IO.Stream strm = null; ImageList imageList = new ImageList(); System.IO.Stream strm = null; string iconName = "MultipleViews.user.ico"; strm = this.GetType().Assembly.GetManifestResourceStream(iconName); Icon icon = new Icon(strm); imageList.Images.Add(icon.ToBitmap()); iconName = "MultipleViews.userH.ico"; strm = this.GetType().Assembly.GetManifestResourceStream(iconName); icon = new Icon(strm); imageList.Images.Add(icon.ToBitmap()); iconName = "MultipleViews.userJ.ico"; strm = this.GetType().Assembly.GetManifestResourceStream(iconName); icon = new Icon(strm); imageList.Images.Add(icon.ToBitmap()); standard.ImageList = imageList; int rowIndex = 1; int colIndex = 2; gridControl1[rowIndex++, colIndex].ImageIndex = 1; gridControl1[rowIndex++, colIndex].ImageIndex = 2; gridControl1[rowIndex++, colIndex].ImageIndex = 0; gridControl1[rowIndex++, colIndex].ImageIndex = 1; gridControl1[rowIndex++, colIndex].ImageIndex = 1; gridControl1[rowIndex++, colIndex].ImageIndex = 2; gridControl1[rowIndex++, colIndex].ImageIndex = 2; gridControl1[rowIndex++, colIndex].ImageIndex = 0; gridControl1[rowIndex++, colIndex].ImageIndex = 1; //gridControl1.Model.Options.DataObjectConsumerOptions = GridDataObjectConsumerOptions.Styles; gridControl1.DataObjectConsumerOptions = GridDataObjectConsumerOptions.All; GridStyleInfo style; style = new GridStyleInfo(); style.Interior = new BrushInfo(Color.White); style.TextColor = Color.FromArgb(0x82, 0x2e, 0x1b); gridControl1.ChangeCells(GridRangeInfo.Cells(1, 1, 9, 3), style); style = new GridStyleInfo(); style.HorizontalAlignment = GridHorizontalAlignment.Right; style.CellValueType = typeof(int); style.Format = "000"; gridControl1.ChangeCells(GridRangeInfo.Cells(1, 1, 9, 1), style); gridControl1.ColWidths.ResizeToFit(GridRangeInfo.Cells(1, 1, 9, 3)); gridControl1.CommandStack.Enabled = true; // Make second grid controls share the same model. #endregion #region Properties this.gridControl1.DefaultRowHeight = 18; this.gridControl1.DefaultColWidth = 70; this.gridControl1.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Office2007Blue; this.gridControl1.Properties.GridLineColor = Color.FromArgb(208, 215, 229); this.gridControl1.DefaultGridBorderStyle = Syncfusion.Windows.Forms.Grid.GridBorderStyle.Solid; style = this.gridControl1.BaseStylesMap["Header"].StyleInfo; style.TextColor = System.Drawing.Color.MidnightBlue; style.Font.Facename = "Verdana"; style = this.gridControl1.BaseStylesMap["Standard"].StyleInfo; style.TextColor = System.Drawing.Color.MidnightBlue; style.Font.Facename = "Verdana"; gridControl2.Model = gridControl1.Model; this.gridControl1.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro; this.gridControl1.Model.ColWidths.ResizeToFit(GridRangeInfo.Table()); this.gridControl2.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro; #endregion }
public void ExtractAssociatedIcon_Null() { Icon.ExtractAssociatedIcon(null); }
public bool ShowProperties(Icon icon) => false;
// Show the settings dialog public bool ShowSettings(Icon icon) { return(false); }
public TaskDialogIcon(Icon bitmap) { id = IntPtr.Zero; hicon = bitmap.Handle; }
private void Form1_Load(object sender, EventArgs e) { Ready = false; Microsoft.Win32.RegistryKey rkApp = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true); if (rkApp.GetValue("Discore-Selfbot") != null) { Setting_WindowsStartup.SelectedItem = "Yes"; } else { Setting_WindowsStartup.SelectedItem = "No"; } Setting_CommandAction.SelectedItem = Program.Settings.MessageAction; Settings_Startup.SelectedItem = Program.Settings.Startup; Setting_ForceRoleColor.SelectedItem = Program.Settings.ForceRoleColor; GUI_FavColor.StateNormal.Back.Color1 = Program.Settings.FavColor; GUI_FavColor.OverrideDefault.Back.Color1 = Program.Settings.FavColor; if (Program.Settings.Theme == "Dark") { GUI_ThemeManager.GlobalPaletteMode = PaletteModeManager.Office2010Black; } if (Program.Settings.Theme == "Dark Sparkle") { GUI_ThemeManager.GlobalPaletteMode = PaletteModeManager.SparkleBlue; } if (Program._Bot.Ready == false) { return; } Active_Guild.Text = ActiveGuild; Active_Channel.Text = ActiveChannel; WebClient WBC = new WebClient(); Program._GUI.GuildIDCache.Clear(); foreach (var Guild in Program._Client.Guilds) { Program._GUI.GuildIDCache.Add(Guild.Id); if (Guild.IconUrl == null) { var GuildNameFormat = new String(Guild.Name.Where(Char.IsLetter).ToArray()); using (Stream ImageStream = WBC.OpenRead("http://dev.blaze.ml/Letters/" + GuildNameFormat.ToCharArray()[0] + ".png")) { Bitmap Image = new Bitmap(ImageStream); ToolStripButton GuildButton = new ToolStripButton(Guild.Name, Image) { AccessibleDescription = Guild.Id.ToString(), DisplayStyle = ToolStripItemDisplayStyle.Image }; if (Guild.OwnerId == Program._Client.CurrentUser.Id) { using (Graphics Grap = Graphics.FromImage(Image)) { Grap.DrawRectangle(new Pen(Brushes.Gold, 10), new Rectangle(0, 0, Image.Width, Image.Height)); } GuildButton.Image = Image; Guilds_Bar.Items.Insert(0, (GuildButton)); } else { Guilds_Bar.Items.Add(GuildButton); } } } else { using (Stream ImageStream = WBC.OpenRead(Guild.IconUrl)) { Bitmap Image = new Bitmap(ImageStream); ToolStripButton GuildButton = new ToolStripButton(Guild.Name, Image) { AccessibleDescription = Guild.Id.ToString(), DisplayStyle = ToolStripItemDisplayStyle.Image }; if (Guild.OwnerId == Program._Client.CurrentUser.Id) { using (Graphics Grap = Graphics.FromImage(Image)) { Grap.DrawRectangle(new Pen(Brushes.Gold, 10), new Rectangle(0, 0, Image.Width, Image.Height)); } GuildButton.Image = Image; Guilds_Bar.Items.Insert(0, (GuildButton)); } else { Guilds_Bar.Items.Add(GuildButton); } } } } this.Text = Program._Client.CurrentUser.Username; using (Stream ImageStream = WBC.OpenRead(Program._Client.CurrentUser.GetAvatarUrl())) { Bitmap b = (Bitmap)System.Drawing.Image.FromStream(ImageStream); IntPtr pIcon = b.GetHicon(); Icon i = Icon.FromHandle(pIcon); this.Icon = i; } Ready = true; }
/// <summary> /// Initializes the supported tools launch commands. /// </summary> public override void SetupCommands() { Trace.TraceInformation("Launch Commands:"); Trace.Indent(); Image imgIcon; ClearLaunchCommands(); var strCommand = GetBOSSLaunchCommand(); Trace.TraceInformation("BOSS Command: {0} (IsNull={1})", strCommand, (strCommand == null)); if ((strCommand != null) && (File.Exists(strCommand))) { imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null; AddLaunchCommand(new Command("BOSS", "Launch BOSS", "Launches BOSS.", imgIcon, LaunchBOSS, true)); } else { imgIcon = null; AddLaunchCommand(new Command("Config#BOSS", "Config BOSS", "Configures BOSS.", imgIcon, ConfigBOSS, true)); } strCommand = GetLOOTLaunchCommand(); Trace.TraceInformation("LOOT Command: {0} (IsNull={1})", strCommand, (strCommand == null)); if ((strCommand != null) && (File.Exists(strCommand))) { imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null; AddLaunchCommand(new Command("LOOT", "Launch LOOT", "Launches LOOT.", imgIcon, LaunchLOOT, true)); } else { imgIcon = null; AddLaunchCommand(new Command("Config#LOOT", "Config LOOT", "Configures LOOT.", imgIcon, ConfigLOOT, true)); } strCommand = GetWryeBashLaunchCommand(); Trace.TraceInformation("Wrye Bash Command: {0} (IsNull={1})", strCommand, (strCommand == null)); if ((strCommand != null) && (File.Exists(strCommand))) { imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null; AddLaunchCommand(new Command("WryeBash", "Launch Wrye Bash", "Launches Wrye Bash.", imgIcon, LaunchWryeBash, true)); } else { imgIcon = null; AddLaunchCommand(new Command("Config#Wrye Bash", "Config Wrye Bash", "Configures Wrye Bash.", imgIcon, ConfigWryeBash, true)); } strCommand = GetSSEEditLaunchCommand(); Trace.TraceInformation("SSEEdit Command: {0} (IsNull={1})", strCommand, (strCommand == null)); if ((strCommand != null) && (File.Exists(strCommand))) { imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null; AddLaunchCommand(new Command("SSEEdit", "Launch SSEEdit", "Launches SSEEdit.", imgIcon, LaunchSSEEdit, true)); } else { imgIcon = null; AddLaunchCommand(new Command("Config#SSEEdit", "Config SSEEdit", "Configures SSEEdit.", imgIcon, ConfigSSEEdit, true)); } strCommand = GetFNISLaunchCommand(); Trace.TraceInformation("FNIS Command: {0} (IsNull={1})", strCommand, (strCommand == null)); if ((strCommand != null) && (File.Exists(strCommand))) { imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null; AddLaunchCommand(new Command("FNIS", "Launch FNIS", "Launches FNIS.", imgIcon, LaunchFNIS, true)); } else { imgIcon = null; AddLaunchCommand(new Command("Config#FNIS", "Config FNIS", "Configures FNIS.", imgIcon, ConfigFNIS, true)); } strCommand = GetBSLaunchCommand(); Trace.TraceInformation("BodySlide Command: {0} (IsNull={1})", strCommand, (strCommand == null)); if ((strCommand != null) && (File.Exists(strCommand))) { imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null; AddLaunchCommand(new Command("BS2", "Launch BodySlide", "Launches BodySlide.", imgIcon, LaunchBS, true)); } else { imgIcon = null; AddLaunchCommand(new Command("Config#BodySlide", "Config BodySlide", "Configures BodySlide.", imgIcon, ConfigBS, true)); } strCommand = GetDSRPLaunchCommand(); Trace.TraceInformation("Dual Sheat Redux Patch Command: {0} (IsNull={1})", strCommand, (strCommand == null)); if ((strCommand != null) && (File.Exists(strCommand))) { imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null; AddLaunchCommand(new Command("DSRP", "Launch Dual Sheat Redux Patch", "Launches Dual Sheat Redux Patch.", imgIcon, LaunchDSRP, true)); } else { imgIcon = null; AddLaunchCommand(new Command("Config#Dual Sheat Redux Patch", "Config Dual Sheat Redux Patch", "Configures Dual Sheat Redux Patch.", imgIcon, ConfigDSRP, true)); } strCommand = GetPMLaunchCommand(); Trace.TraceInformation("Patchus Maximus Command: {0} (IsNull={1})", strCommand, (strCommand == null)); if ((strCommand != null) && (File.Exists(strCommand))) { imgIcon = File.Exists(strCommand) ? Icon.ExtractAssociatedIcon(strCommand).ToBitmap() : null; AddLaunchCommand(new Command("PM", "Launch Patchus Maximus", "Launches Patchus Maximus.", imgIcon, LaunchPM, true)); } else { imgIcon = null; AddLaunchCommand(new Command("Config#Patchus Maximus", "Config Patchus Maximus", "Configures Patchus Maximus.", imgIcon, ConfigPM, true)); } Trace.Unindent(); }
static void Main(string[] args) { var largeIcon = IntPtr.Zero; var smallIcon = IntPtr.Zero; var ret = Shell32.SHDefExtractIconW(@"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe", 0, 0, ref largeIcon, ref smallIcon, 256, 48); if (ret == HResult.Ok) { Icon.FromHandle(largeIcon).ToBitmap().Save($"./large.ico"); Icon.FromHandle(smallIcon).ToBitmap().Save($"./small.ico"); User32.DestroyIcon(largeIcon); User32.DestroyIcon(smallIcon); } var icons = Shell32.ExtractIconExW(@"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"); for (var i = 0; i < icons.Count(); i++) { Icon.FromHandle(icons[i].Item1).ToBitmap().Save($"./large{i}.ico"); Icon.FromHandle(icons[i].Item2).ToBitmap().Save($"./small{i}.ico"); User32.DestroyIcon(icons[i].Item1); User32.DestroyIcon(icons[i].Item2); } var names = Kernel32.GetPrivateProfileSectionNames("./test.ini"); Console.WriteLine("SectionNames"); foreach (var n in names) { Console.WriteLine(n); } var sw = Kernel32.GetPrivateProfileSection(names[0], "./test.ini"); Console.WriteLine("\nSection"); foreach (var n in sw) { Console.WriteLine(n); } var r = Kernel32.GetPrivateProfileInt("section1", "test", 6, "loi"); Console.WriteLine($"\nInt\n{r}\n"); // GetPrivateProfileString // fileNameをnullにすると、レジストリーのHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\IniFileMapping\win.iniのキー値が読みだされる var strlist = Kernel32.GetPrivateProfileString(null, null, null, null); foreach (var s in strlist) { Console.WriteLine(s); } strlist = Kernel32.GetProfileStringW(null, null, null); foreach (var s in strlist) { Console.WriteLine(s); } var t = new test { value = 432, str = "8g9" }; Console.WriteLine($"\nWritePrivateProfileStruct: {Kernel32.WritePrivateProfileStructW("tests", "testk", t, "./test.ini")}"); var t2 = new test(); Console.WriteLine($"\nGetPrivateProfileStruct: {Kernel32.GetPrivateProfileStruct("tests", "testk", ref t2, "./test.ini")}"); Console.WriteLine($"value: {t2.value}, str: {t2.str}"); Console.ReadKey(); }