static void Main(string[] args) { DesignMode = false; // The designer doesn't call Main() CommandLineArgs = new CommandLineArgs(args); try { DpiUtil.ConfigureProcess(); } catch { } MonoSpaceFont = new FontEx { Font = new Font("Courier New", DpiUtil.ScaleIntX(13), GraphicsUnit.Pixel), Width = DpiUtil.ScaleIntX(8), Height = DpiUtil.ScaleIntY(16) }; NativeMethods.EnableDebugPrivileges(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; Settings = SettingsSerializer.Load(); Logger = new GuiLogger(); #if !DEBUG try { #endif using (var coreFunctions = new CoreFunctionsManager()) { RemoteProcess = new RemoteProcess(coreFunctions); MainForm = new MainForm(); Application.Run(MainForm); RemoteProcess.Dispose(); } #if !DEBUG } catch (Exception ex) { ShowException(ex); } #endif SettingsSerializer.Save(Settings); }
void changeGUISkins(GUISkin gs) { if (gs) { FontEx font0 = FontEx.getFontEx(fonts); if (font0 != null) { gs.font = font0.font; gs.box.font = font0.boxFont; gs.label.font = font0.labelFont; gs.button.font = font0.buttonFont; } } }
public static FontEx getFontEx(FontEx[] fonts) { FontEx rc = null; int w = Screen.width; int h = Screen.height; for (int i = 0; i < fonts.Length; i++) { int x1 = fonts[i].width; if (w >= x1) { rc = fonts[i]; } } return(rc); }
public static FontEx getFontEx(FontEx[] fonts) { FontEx rc = null; int w = Screen.width; int h = Screen.height; for(int i=0; i<fonts.Length; i++) { int x1 = fonts[i].width; if(w >= x1) { rc = fonts[i]; } } return rc; }
public MemoryViewControl() { InitializeComponent(); if (Program.DesignMode) { return; } AutoScroll = true; font = Program.MonoSpaceFont; hotSpotEditBox.Font = font; memoryPreviewPopUp = new MemoryPreviewPopUp(font); }
public MemoryPreviewPanel(FontEx font) { Contract.Requires(font != null); DoubleBuffered = true; nodes = new List <BaseHexNode>(); DrawContext = new DrawContext { Font = font, IconProvider = new IconProvider(), // TODO use single instance Memory = new MemoryBuffer(), HotSpots = new List <HotSpot>() }; SetNodeCount(MinNodeCount); CalculateSize(); }
static void Main(string[] args) { DesignMode = false; // The designer doesn't call Main() CommandLineArgs = new CommandLineArgs(args); try { DpiUtil.ConfigureProcess(); DpiUtil.TrySetDpiFromCurrentDesktop(); } catch { // ignored } MonoSpaceFont = new FontEx { Font = new Font("Courier New", DpiUtil.ScaleIntX(13), GraphicsUnit.Pixel), Width = DpiUtil.ScaleIntX(8), Height = DpiUtil.ScaleIntY(16) }; NativeMethods.EnableDebugPrivileges(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; Settings = SettingsSerializer.Load(); Logger = new GuiLogger(); if (!NativeMethods.IsUnix() && Settings.RunAsAdmin && !WinUtil.IsAdministrator) { WinUtil.RunElevated(Process.GetCurrentProcess().MainModule?.FileName, args.Length > 0 ? string.Join(" ", args) : null); return; } #if !DEBUG try { #endif using (var coreFunctions = new CoreFunctionsManager()) { RemoteProcess = new RemoteProcess(coreFunctions); MainForm = new MainForm(); Application.Run(MainForm); RemoteProcess.Dispose(); } #if !DEBUG } catch (Exception ex) { ShowException(ex); } #endif SettingsSerializer.Save(Settings); }
public MarqueeLabel setTextProperty(TextProperty attr, object o) { Subtitle sub = Prop as Subtitle; Console.WriteLine("set " + attr.ToString() + " => " + o); Font f = Mlabel.Font; switch (attr) { case TextProperty.FontName: sub.fontname = (string)o; //System.Drawing.Text.PrivateFontCollection privateFonts = new System.Drawing.Text.PrivateFontCollection(); //string fn = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ttf", sub.fontname); //Console.WriteLine("font ==> " + fn ); //privateFonts.AddFontFile(fn ); //System.Drawing.Font font = new Font(privateFonts.Families[0], 12); Mlabel.Font = new Font(FontEx.getFontFamily(sub.fontname), f.Size, f.Style); break; case TextProperty.FontSize: sub.fontsize = (int)(o); Mlabel.Font = new Font(f.Name, sub.fontsize / 2, f.Style | FontStyle.Regular); break; case TextProperty.Bold: sub.bold = (bool)o; if (sub.bold) { Mlabel.Font = new Font(f.FontFamily, f.Size, f.Style | FontStyle.Bold); } else { Mlabel.Font = new Font(f.FontFamily, f.Size, f.Style & ~FontStyle.Bold); } break; case TextProperty.Italic: sub.italic = (bool)o; if (sub.italic) { Mlabel.Font = new Font(f.FontFamily, f.Size, f.Style | FontStyle.Italic); } else { Mlabel.Font = new Font(f.FontFamily, f.Size, f.Style & ~FontStyle.Italic); } break; case TextProperty.Underline: sub.underline = (bool)o; if (sub.underline) { Mlabel.Font = new Font(f.FontFamily, f.Size, f.Style | FontStyle.Underline); } else { Mlabel.Font = new Font(f.FontFamily, f.Size, f.Style & ~FontStyle.Underline); } break; case TextProperty.Direction: lastDirection = sub.direction = (Direction)o; Mlabel.direction = sub.direction; break; case TextProperty.Speed: sub.speed = (int)o; Mlabel.Speed = sub.speed; if (sub.speed == 0) { sub.direction = Direction.Static; Mlabel.direction = sub.direction; } else { setTextProperty(TextProperty.Direction, lastDirection); } break; case TextProperty.Text: sub.text = (string)o; Mlabel.Text = sub.text; break; case TextProperty.FontColor: Mlabel.ForeColor = (Color)o; sub.fontcolor = ColorEx.ColorToHex(Mlabel.ForeColor); break; case TextProperty.BackColor: Mlabel.BackColor = (Color)o; sub.backcolor = ColorEx.ColorToHex(Mlabel.BackColor); sub.transparent = false; if (Mlabel.BackColor == Color.Transparent) { sub.transparent = true; sub.backcolor = "#null"; } break; default: break; } //sub.BackColor = ColorTranslator.FromHtml(txtAttr.Bgcolor); //sub.ForeColor = ColorTranslator.FromHtml(txtAttr.Color); //mlabel.BackColor = Color.Transparent; // mlabel.Text = "谁的手机发斯里兰卡哗啦哗啦就好了"; //sub.Direction = txtAttr.Direction; //sub.Speed = txtAttr.Speed; //int x = ToFormX(txtAttr.X); //int y = ToFormY(txtAttr.Y); //sub.Location = new Point(x, y); // mlabel.Width = (int)base.Path.GetBounds().Width; // mlabel.Height = (int)base.Path.GetBounds().Height; //sub.X = txtAttr.X; //sub.Y = txtAttr.Y; //sub.W = txtAttr.W; //sub.H = txtAttr.H; //sub.fontname = txtAttr.Fontname; //sub.fontsize = txtAttr.Fontsize; //sub.transparent = txtAttr.Transparent; //sub.Font = new Font("宋体", float.Parse(txtAttr.Fontsize), FontStyle.Regular); // mlabel.Location = new Point((int)(base.Path.GetBounds().Location.X), (int)(base.Path.GetBounds().Location.Y)); return(Mlabel); }