Esempio n. 1
0
        public MSFake()
        {
            InitializeComponent();

            this.DoubleBuffered = true;

            // filename in case filename is added later on
            filename = "Untitled*";

            // ensure selection box doesn't get drawn on top of
            pic_selection.SendToBack();

            // initialize bools
            sel_mouse_down = false;
            mouse_down = false;
            selected_box = false;
            show_toolbox = true;
            show_colors = true;

            // initialize various states
            _tool = TOOLS.Pencil;
            _curve_state = CURVESTATES.NoClick;
            _color = Color.Red;

            // set up font collection
            fonts = new List<string>();
            FontFamily[] fontList = new System.Drawing.Text.InstalledFontCollection().Families;
            foreach (FontFamily font in fontList)
                fonts.Add(font.Name);
            cmb_fonts.DataSource = fonts;

            // set up canvas to be drawn on
            canvas = new Bitmap(panel_canvas.Width, panel_canvas.Height);
        }
Esempio n. 2
0
 public void ChargerPoliceTextForm()
 {
     List<FontFamily> lt = new List<FontFamily>();
     System.Drawing.Text.InstalledFontCollection t0 = new System.Drawing.Text.InstalledFontCollection();
     foreach (FontFamily f in t0.Families)
         lt.Add(f);
     com_policeText.DataSource = lt;
     com_policeText.DisplayMember = "Name";
 }
Esempio n. 3
0
 /// <summary>
 /// Static constructor
 /// </summary>
 static QslDnPTasks()
 {
     System.Drawing.Text.InstalledFontCollection fontCol =
         new System.Drawing.Text.InstalledFontCollection();
     foreach(System.Drawing.FontFamily family in fontCol.Families)
     {
         fontNames.Add(family.Name);
     }
 }
Esempio n. 4
0
 private void Form1_Load(object sender, EventArgs e)
 {
     System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
     foreach (System.Drawing.FontFamily family in fonts.Families)
     {
         comboBox1.Items.Add(family.Name);
     }
     comboBox1.Text = "微软雅黑 Light";
 }
        List<RibbonButton> _myMember = new List<RibbonButton>(); //List các chứa các button thành viên
        
        public MyPaint(short option)
        {
            InitializeComponent();
            for (int i = 5; i <= 50; i++)
            {
                RibbonLabel temp = new RibbonLabel();
                temp.Text = i.ToString();
                this.rbcmbbx_SizeText.DropDownItems.Add(temp);
            }
            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
            foreach (FontFamily family in fonts.Families)
            {
                RibbonLabel temp = new RibbonLabel();
                temp.Text = family.Name.ToString();
                this.rbcmbbx_Font.DropDownItems.Add(temp);
         
            }

            if (option == 0) //Offline
            {
                rbtb_NetWorkServer.Visible = false;
                rbtb_NetWorkClient.Visible = false;
                PnlPaint._isClient = PnlPaint._isServer = false;
            }
            else// Online
            {
                PnlPaint._isFill = false;
                PnlPaint._isStillCanMove = false;
                PnlPaint._isStillCanReSize = false;
                PnlPaint.myPaint.ShapeType1 = ShapeType.MyLine;
                PnlPaint.ROOM += updateRoom;
                PnlPaint.STATUS += update;
                PnlPaint.CONTROL += updateControl;
                PnlPaint.REMOVEMEM += removeMem;
                PnlPaint.ROOMCLIENT += roomclient;
                PnlPaint.ABLEORDISABLE += ableordisable;
                PnlPaint.REMOVEROOMCLIENT += removeroomClient;
                if (option == 1) // server
                {
                    PnlPaint._isServer = true;
                    PnlPaint._isClient = false;
                    rbtb_NetWorkClient.Visible = false;
                }
                else //Client
                {
                    PnlPaint._isClient = true;
                    PnlPaint._isServer = false;
                    rbtb_NetWorkServer.Visible = false;
                }
               
            }
         


        }
Esempio n. 6
0
 public Style()
 {
     this.bg_color = System.Drawing.Color.White;
     this.fg_color = System.Drawing.Color.Gray;
     this.use_full_row = true;
     this.ffamilies = new FontFamilyCollection();
     System.Drawing.Text.InstalledFontCollection ifc = new System.Drawing.Text.InstalledFontCollection();
     foreach( System.Drawing.FontFamily ff in ifc.Families ){
         this.ffamilies.Add(ff);
     }
 }
Esempio n. 7
0
        private void PopulateFontCMB()
        {
            System.Drawing.Text.InstalledFontCollection fontcoll =
                new System.Drawing.Text.InstalledFontCollection();
            foreach (System.Drawing.FontFamily font in fontcoll.Families)
            {
                cmbFonts.Items.Add(font.Name);
            }

            cmbFonts.SelectedItem = Config.EditorFontName;
        }
Esempio n. 8
0
 public frmMain()
 {
     InitializeComponent();
     bool hasSegoeUI = false;
     var installedFonts = new System.Drawing.Text.InstalledFontCollection();
     foreach (var item in installedFonts.Families)
     {
         if (item.Name == "Segoe UI") hasSegoeUI = true;
     }
     if (!hasSegoeUI) this.Font = new Font("Tahoma", 8);
     this.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
 }
Esempio n. 9
0
        public Fonts(AdvData data)
        {
            InitializeComponent();
            mData = data;
            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
            foreach (FontFamily fam in fonts.Families)
            {
                if (fam.IsStyleAvailable(FontStyle.Regular))
                    font.Items.Add(fam.Name);
            }
            mFonts = data.Settings.Fonts;
            fontlist.SelectedIndexChanged += new EventHandler(fontlist_SelectedIndexChanged);
            preview.Paint += new PaintEventHandler(preview_Paint);
            font.DrawItem += new DrawItemEventHandler(font_DrawItem);

            for (int i = 0; i < mFonts.Count; ++i)
            {
                fontlist.Items.Add("");
                setListName(i, mFonts[i] as FontInfo);
            }

            charset.Items.Add("Western");
            charset.Items.Add("East european");
            charset.Items.Add("Russian");
            charset.Items.Add("Greek");
            charset.Items.Add("Turkish");
            charset.Items.Add("Arabic");
            charset.Items.Add("Hebrew");
            charset.Items.Add("Vietnamese");
            charset.Items.Add("Thai");
            charset.Items.Add("Baltic");
            charset.Items.Add("Japanese ShiftJIS");
            charset.Items.Add("Dos OEM");
            charset.Items.Add("Symbol");

            for (int i = 6; i <= 40; ++i)
            {
                fontsize.Items.Add(Convert.ToString(i));
            }

            for (int i = -5; i <= 5; ++i)
            {
                letterspacing.Items.Add(Convert.ToString(i));
            }

            if (fontlist.Items.Count > 0)
                fontlist.SelectedIndex = 0;
            else
            {
                //TODO disable controls
            }
        }
Esempio n. 10
0
		private void Form1_Load(object sender, EventArgs e)
		{
			System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
			foreach (FontFamily family in fonts.Families)
			{
				lstFonts.Items.Add(family.Name);
			}

			RegistryKey rk;
			rk = Registry.LocalMachine.OpenSubKey("Software\\ProseTech\\FontViewer");
			if (rk != null) this.Text += " - " + rk.GetValue("Customer");

		}
Esempio n. 11
0
 public StyleEditorForm()
 {
     InitializeComponent();
       _styles = (ScriptStyle[])Settings.ScriptStyles.Clone();
       using (System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection())
     for (int i = 0; i < fonts.Families.Length; i++)
       comboBoxFonts.Items.Add(fonts.Families[i].Name);
       foreach (ScriptStyle s in _styles)
     listBoxStyles.Items.Add(s.Name);
       _sampleScript = new Script(0, "Sample", "");
       panelSample.Controls.Add(_sampleScript.Scintilla);
       listBoxStyles.SelectedIndex = 0;
 }
Esempio n. 12
0
        private void frmTextSymbol_Load(object sender, EventArgs e)
        {
            this.textBox1.Text = pTextElement .Text ;
            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
               // System.Drawing.Font fontSize = new System.Drawing.Font();
            foreach (FontFamily family in fonts.Families)
            {
                comboFont.Items.Add(family.Name.ToString());
            }

            textFont.Text = pTextElement.Symbol.Font.Name;
            textSize.Text = pTextElement.Symbol.Size.ToString();
            textAngle.Text = pTextElement.Symbol.Angle.ToString();
        }
 public MDIParent1()
 {
     System.Drawing.Text.InstalledFontCollection ifc = new System.Drawing.Text.InstalledFontCollection();
     FontFamily[] families = ifc.Families;
     namesFontFamily = new string[(families.GetLength(0))];
     int indx = 0;
     foreach (FontFamily fontFamily in families)
     {
         namesFontFamily.SetValue(fontFamily.Name, indx);
         indx++;
     }
     Samples = new Dictionary<string, Dictionary<string, Color>>();
     InitializeComponent();
     comboBox3.Items.Add("Default");
 }
Esempio n. 14
0
 /// <summary>
 /// CardTabItem constructor
 /// </summary>
 /// <param name="cardWidth">Width of the card in graphics independent units</param>
 /// <param name="cardHeight">Height of the card in graphics independent units</param>
 public CardTabItem(int cardWidth, int cardHeight)
 {
     InitializeComponent();
     // create a card and position it in the middle of the CardCanvas
     CardWF card = new CardWF(cardWidth, cardHeight, true);
     cardPanel.AddCard(card);
     cardProperties.Visibility = Visibility.Visible;
     cardProperties.printPropsPanel.cardsLayoutGroupBox.Visibility =
         Visibility.Collapsed;
     cardProperties.QslCard = cardPanel.QslCard;
     cardPanel.QslCard.DispPropertyChanged += OnQslCardDispPropertyChanged;
     // load list of font names that are available to Windows Forms
     System.Drawing.Text.InstalledFontCollection fontCol =
         new System.Drawing.Text.InstalledFontCollection();
     foreach(System.Drawing.FontFamily family in fontCol.Families)
     {
         FontFaceComboBox.Items.Add(family.Name);
         QsosBoxFontFaceComboBox.Items.Add(family.Name);
     }
 }
Esempio n. 15
0
        public FormFontDraw()
        {
            InitializeComponent();

            // create graphics for draw font
            this.FormFontDraw_Resize(null, null);

            // file system font families listbox
            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
            foreach (System.Drawing.FontFamily family in fonts.Families)
            {
                listBoxSystemFont.Items.Add(family.Name);
            }
            // init alignment setting
            buttonAlignment_Click(button5, null);

            // demo string for font draw
            richTextBoxCharInput.Text = Properties.Resources.inputChars;
            // set form icon
            this.Icon = Properties.Resources.fontViewrIcon;

            // set default values
            buttonResetBlock_Click(null, null);

            // set trackbar's parameter
            trackBarBlockWidth.Minimum = (int)numericUpDownBlockWidth.Minimum;
            trackBarBlockWidth.Maximum = (int)numericUpDownBlockWidth.Maximum;
            trackBarBlockWidth.Value = (int)numericUpDownBlockWidth.Value;
            trackBarBlockHeight.Minimum = (int)numericUpDownBlockHeight.Minimum;
            trackBarBlockHeight.Maximum = (int)numericUpDownBlockHeight.Maximum;
            trackBarBlockHeight.Value = (int)numericUpDownBlockHeight.Value;
            trackBarOffsetX.Minimum = (int)numericUpDownOffsetX.Minimum;
            trackBarOffsetX.Maximum = (int)numericUpDownOffsetX.Maximum;
            trackBarOffsetX.Value = (int)numericUpDownOffsetX.Value;
            trackBarOffsetY.Minimum = (int)numericUpDownOffsetY.Minimum;
            trackBarOffsetY.Maximum = (int)numericUpDownOffsetY.Maximum;
            trackBarOffsetY.Value = (int)numericUpDownOffsetY.Value;
        }
Esempio n. 16
0
        private void frmSymbolSelector_Load(object sender, EventArgs e)
        {
            string sInstall = ReadRegistry("SOFTWARE\\ESRI\\CoreRuntime");

            if (sInstall == "") //added by chulili 2012-11-13 平台由ArcGIS9.3换成ArcGIS10,相应的注册表路径要修改
            {
                sInstall = ReadRegistry("SOFTWARE\\ESRI\\Engine10.0\\CoreRuntime");
            }
            if (sInstall == "")
            {
                sInstall = ReadRegistry("SOFTWARE\\ESRI\\Desktop10.0\\CoreRuntime");
            }   //added by chulili 2012-11-13  end
            DirectoryInfo pDic = new DirectoryInfo(sInstall + "\\Styles\\");

            FileInfo[] files = pDic.GetFiles("*.ServerStyle");
            cmbStyle.Items.Clear();
            for (int i = 0; i < files.Length; i++)
            {
                cmbStyle.Items.Add(sInstall + "\\Styles\\" + files[i].ToString());
            }
            int index = cmbStyle.Items.IndexOf(sInstall + "\\Styles\\ESRI.ServerStyle");

            if (index != -1)
            {
                cmbStyle.SelectedIndex = index;
            }
            List <string> TextStyle = new List <string>();

            System.Drawing.Text.InstalledFontCollection CollectionFont = new System.Drawing.Text.InstalledFontCollection();
            FontFamily[] Familys = CollectionFont.Families;
            for (int i = 0; i < Familys.Length; i++)
            {
                TextStyle.Add(Familys[i].Name);
            }
            cmbTextFont.Items.AddRange(TextStyle.ToArray());
        }
Esempio n. 17
0
        public TransWinSettingsWindow(TranslateWindow Win)
        {
            translateWin = Win;

            InitializeComponent();

            FontList = new List <string>();

            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
            foreach (System.Drawing.FontFamily family in fonts.Families)
            {
                FontList.Add(family.Name);
            }

            sourceFont.ItemsSource = FontList;
            firstFont.ItemsSource  = FontList;
            secondFont.ItemsSource = FontList;

            EventInit();

            UI_Init();

            this.Topmost = true;
        }
Esempio n. 18
0
        public AdvancedTextEditor()
        {
            InitializeComponent();
            //cause SelectionChange event to occur
            this.TextEditor.Select(0, 0);
            this.Ruler.LeftIndent        = 1;
            this.Ruler.LeftHangingIndent = 1;
            this.Ruler.RightIndent       = 1;

            this.mnuRuler.Checked       = true;
            this.mnuMainToolbar.Checked = true;
            this.mnuFormatting.Checked  = true;

            System.Drawing.Text.InstalledFontCollection col = new System.Drawing.Text.InstalledFontCollection();

            this.cmbFontName.Items.Clear();

            foreach (FontFamily ff in col.Families)
            {
                this.cmbFontName.Items.Add(ff.Name);
            }

            col.Dispose();
        }
Esempio n. 19
0
        public FormSettings()
        {
            InitializeComponent();
            System.Drawing.Text.InstalledFontCollection ifc =
                new System.Drawing.Text.InstalledFontCollection();

            FontFamily[] ffs   = ifc.Families;
            int          i     = 0;
            int          index = 0;

            foreach (FontFamily ff in ffs)
            {
                ComboBoxFontName.Items.Add(ff.Name);
                comboBoxAAFontName.Items.Add(ff.Name);
                if (ff.Name == "MS UI Gothic")
                {
                    index = i;
                }
                i++;
            }

            ComboBoxFontName.SelectedIndex   = index;
            comboBoxAAFontName.SelectedIndex = index;
        }
Esempio n. 20
0
        /// <summary>
        /// 初始化字体,字号
        /// </summary>
        private void InitFont()
        {
            int m_SelectIndex = 0;
            int m_Index       = 0;

            System.Drawing.Text.InstalledFontCollection m_ObjFont = new System.Drawing.Text.InstalledFontCollection();
            foreach (System.Drawing.FontFamily m_Font in m_ObjFont.Families)
            {
                cmb_font.Items.Add(m_Font.Name.ToString());

                if (m_Font.Name == "黑体")
                {
                    m_SelectIndex = m_Index;
                }
                m_Index++;
            }
            cmb_font.SelectedIndex = m_SelectIndex;

            foreach (string m_FontSize in m_AllFontSizeName)
            {
                cmb_fontsize.Items.Add(m_FontSize);
            }
            cmb_fontsize.SelectedItem = "小五";
        }
Esempio n. 21
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            Utils.InitLog(".\\FOMonitor.log");

            System.Drawing.Text.InstalledFontCollection ifc = new System.Drawing.Text.InstalledFontCollection();
            foreach (FontFamily ff in ifc.Families)
            {
                cmbFont.Items.Add(ff.Name);
                if (ff.Name == "Tahoma")
                {
                    cmbFont.SelectedIndex = cmbFont.Items.Count - 1;
                }
            }

            IniReader Fo2238Config = new IniReader(".\\FOnline2238.cfg");

            logPath = Fo2238Config.IniReadValue("2238", "LogfileName");

            if (String.IsNullOrEmpty(logPath))
            {
                logPath = ".\\";
            }
            bool containsTag = containsLogTag(logPath);

            if (containsTag)
            {
                string   validPath = Path.GetPathRoot(logPath);
                string[] parts     = logPath.Split(Path.DirectorySeparatorChar);
                foreach (string part in parts)
                {
                    if (!containsLogTag(part))
                    {
                        validPath += part + Path.DirectorySeparatorChar;
                    }
                    else
                    {
                        break;
                    }
                }
                logExt           = Path.GetExtension(logPath);
                logPath          = validPath;
                lblLogsPath.Text = String.Format("Searching for logs in: {0} (defined in FOnline2238.cfg)", logPath);
            }

            List <string> Colors    = new List <string>(Enum.GetNames(typeof(System.Drawing.KnownColor)));
            Type          colorType = typeof(System.Drawing.Color);

            PropertyInfo[] propInfoList = colorType.GetProperties(BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.Public);
            foreach (System.Reflection.PropertyInfo c in propInfoList)
            {
                this.cmbBlacklistColor.Items.Add(c.Name);
            }

            this.Text = "FOMonitor " + version;
            this.cmbMapFilterRaw.SelectedIndex   = 0;
            this.cmbSources.SelectedIndex        = 0;
            this.cmbBlacklistColor.SelectedIndex = 0;
            this.cmbMatchMode.SelectedIndex      = 0;

            this.numMapFilter.Maximum = Int32.MaxValue;
            lblInstructions.Text      = "Use ~gameinfo 1 and press F2, then " + Environment.NewLine + "press update.";
            if (!File.Exists("FOnline.exe"))
            {
                MessageBox.Show("FOnline.exe not found." + Environment.NewLine +
                                "Please move this program to same directory as the fonline client", "FOMonitor", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Serializer.Init();
            ReadConfig();
            RestoreTableState();
            if (File.Exists("./whitelist.txt"))
            {
                Whitelist = new Dictionary <int, string>();
                try
                {
                    List <string> lines = new List <string>(File.ReadAllLines("./whitelist.txt"));
                    Whitelist = Utils.ParseWhitelist(lines.ToArray());
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to parse whitelist: " + ex.Message);
                }
            }
            else
            {
                File.Create("./whitelist.txt");
            }

            if (File.Exists("./blacklist.txt"))
            {
                Blacklist = new Dictionary <string, string>();
                try
                {
                    List <string> lines = new List <string>(File.ReadAllLines("./blacklist.txt"));
                    Blacklist = Utils.ParseBlacklist(lines.ToArray());
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to parse blacklist: " + ex.Message);
                }
            }
            else
            {
                File.Create("./blacklist.txt");
            }
        }
Esempio n. 22
0
        private void Initialize()
        {
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(UIThreadException);
            AppDomain.CurrentDomain.UnhandledException +=
                new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            InitializeComponent();

            System.Drawing.Text.InstalledFontCollection fc = new System.Drawing.Text.InstalledFontCollection();
            foreach (FontFamily font in fc.Families)
            {
                if (font.Name == "宋体")
                {
                    _zhchFont = new Font("宋体", 9);
                }

                if (font.Name == "Batang")
                {
                    _kokrFont = new Font("Batang", 8.5f);
                }
            }
            //初始化非UI异常捕获事件,该函数执行后,非UI异常由ExceptionHandle接管
            //ExceptionHandle.InitializeNonUIUnhandledExceptionHandler();
            //设置异常被ExceptionHandle捕获后的委托函数
            //ExceptionHandle.UIExceptionEvent += new ExceptionHandle.ExceptionEventHandler(UIExceptionHandlerDelegate);
            //ExceptionHandle.NonUIExceptionEvent += new ExceptionHandle.ExceptionEventHandler(NonUIExceptionHandlerDelegate);
            StartService();
        }
Esempio n. 23
0
        /// <summary>
        /// Helper function that fills the fontList array (of strings) with
        /// all the available fonts.
        /// </summary>
        private void fillFontList()
        {
            FontFamily[] fontFamilies;

            System.Drawing.Text.InstalledFontCollection installedFontCollection = new System.Drawing.Text.InstalledFontCollection();

            // Get the array of FontFamily objects.
            fontFamilies = installedFontCollection.Families;

            // Create the font list array and fill it with the list of available fonts.
            fontListArray = new string[fontFamilies.Length];
            for (int i = 0; i < fontFamilies.Length; ++i)
            {
                fontListArray[i] = fontFamilies[i].Name;
            }
        }
Esempio n. 24
0
        private static bool isFontInstalled(string fontname)
        {
            var installedFontCollection = new System.Drawing.Text.InstalledFontCollection();

            return(installedFontCollection.Families.Any(ff => ff.Name == fontname));
        }
Esempio n. 25
0
        /// <summary>
        /// Loads all fonts available on system into the combo box.
        /// </summary>
        public void LoadFonts()
        {
            this.Items.Clear();

            System.Drawing.Text.InstalledFontCollection colInstalledFonts = new System.Drawing.Text.InstalledFontCollection();
            FontFamily[] aFamilies = colInstalledFonts.Families;
            foreach (FontFamily ff in aFamilies)
            {
                ComboItem item = new ComboItem();
                item.IsFontItem = true;
                item.FontName = ff.GetName(0);
                item.FontSize = this.Font.Size;
                item.Text = ff.GetName(0);
                this.Items.Add(item);
            }
            this.DropDownWidth = this.Width * 2;
        }
Esempio n. 26
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            Utils.InitLog(".\\FOMonitor.log");

            System.Drawing.Text.InstalledFontCollection ifc = new System.Drawing.Text.InstalledFontCollection();
            foreach (FontFamily ff in ifc.Families)
            {
                cmbFont.Items.Add(ff.Name);
                if (ff.Name == "Tahoma")
                    cmbFont.SelectedIndex = cmbFont.Items.Count-1;
            }

            IniReader Fo2238Config = new IniReader(".\\FOnline2238.cfg");
            logPath = Fo2238Config.IniReadValue("2238", "LogfileName");

            if(String.IsNullOrEmpty(logPath))
                logPath = ".\\";
            bool containsTag = containsLogTag(logPath);

            if(containsTag)
            {
                string validPath = Path.GetPathRoot(logPath);
                string[] parts = logPath.Split(Path.DirectorySeparatorChar);
                foreach(string part in parts)
                {
                    if (!containsLogTag(part))
                        validPath += part + Path.DirectorySeparatorChar;
                    else
                        break;
                }
                logExt = Path.GetExtension(logPath);
                logPath = validPath;
                lblLogsPath.Text = String.Format("Searching for logs in: {0} (defined in FOnline2238.cfg)", logPath);
            }

            List<string> Colors = new List<string>(Enum.GetNames(typeof(System.Drawing.KnownColor)));
            Type colorType = typeof(System.Drawing.Color);
            PropertyInfo[] propInfoList = colorType.GetProperties(BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.Public);
            foreach (System.Reflection.PropertyInfo c in propInfoList)
                this.cmbBlacklistColor.Items.Add(c.Name);

            this.Text = "FOMonitor " + version;
            this.cmbMapFilterRaw.SelectedIndex = 0;
            this.cmbSources.SelectedIndex = 0;
            this.cmbBlacklistColor.SelectedIndex = 0;
            this.cmbMatchMode.SelectedIndex = 0;

            this.numMapFilter.Maximum = Int32.MaxValue;
            lblInstructions.Text = "Use ~gameinfo 1 and press F2, then " + Environment.NewLine + "press update.";
            if (!File.Exists("FOnline.exe"))
            {
                MessageBox.Show("FOnline.exe not found." + Environment.NewLine +
                    "Please move this program to same directory as the fonline client", "FOMonitor", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Serializer.Init();
            ReadConfig();
            RestoreTableState();
            if (File.Exists("./whitelist.txt"))
            {
                Whitelist = new Dictionary<int, string>();
                try
                {
                    List<string> lines = new List<string>(File.ReadAllLines("./whitelist.txt"));
                    Whitelist = Utils.ParseWhitelist(lines.ToArray());
                }
                catch(Exception ex)
                {
                    MessageBox.Show("Failed to parse whitelist: " + ex.Message);
                }

            }
            else
                File.Create("./whitelist.txt");

            if (File.Exists("./blacklist.txt"))
            {
                Blacklist = new Dictionary<string, string>();
                try
                {
                    List<string> lines = new List<string>(File.ReadAllLines("./blacklist.txt"));
                    Blacklist = Utils.ParseBlacklist(lines.ToArray());
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to parse blacklist: " + ex.Message);
                }

            }
            else
                File.Create("./blacklist.txt");
        }
Esempio n. 27
0
 //----------------------------------------------------------
 private string SysFonts()
 {
     string ret = "";
     System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
     foreach (FontFamily font in fonts.Families)
     {
         dataGridView1.Rows.Add("Название", font.Name);
     }
     return ret;
 }
Esempio n. 28
0
        //处理命令
        private void DoCommand(ref string command, ref string parameter)
        {
            if (command == "Connected")
            {
                //WriteToClient(ref socket, "true");
            }
            else if (command == "PcInfo")
            {
                SystemInfo systemInfo = new SystemInfo();
                WriteToClient(ref socket, systemInfo.GetMyComputerName() + "\n" + systemInfo.GetMyScreens() + "\n" + systemInfo.GetMyCpuInfo() + "\n" + systemInfo.GetMyMemoryInfo() + "\n" + systemInfo.GetMyDriveInfo() + "\n" + systemInfo.GetMyOSName() + "\n" + systemInfo.GetMyUserName() + "\n" + systemInfo.GetMyPaths());
            }
            //***************************************************************************************
            //文件管理
            else if (command == "Filelist")//文件列表
            {
                try
                {
                    string        dir    = "";
                    DirectoryInfo curDir = new DirectoryInfo(parameter);
                    if (!curDir.Exists)
                    {
                        dir = "";
                        WriteToClient(ref socket, "<OK>Dir Send\r\n" + dir);
                        return;
                    }
                    DirectoryInfo[] dirdir   = curDir.GetDirectories();
                    FileInfo[]      dirFiles = curDir.GetFiles();
                    foreach (FileInfo f in dirFiles)
                    {
                        dir = dir + "F:" + f.Name + "\t" + f.Length + "\t" + f.CreationTime.ToString() + "\t" + f.LastWriteTime.ToString() + "\r\n";
                    }
                    foreach (DirectoryInfo d in dirdir)
                    {
                        dir = dir + "D:" + d.Name + "\r\n";
                    }
                    WriteToClient(ref socket, "<OK>Dir Send\r\n" + dir);
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            else if (command == "Driverlist")//磁盘列表
            {
                string[] drives = Environment.GetLogicalDrives();
                string   str    = "<OK>Dir Send\r\n";
                foreach (string s in drives)
                {
                    str += s + "\r\n";
                }
                WriteToClient(ref socket, str);
            }
            else if (command == "DeleteFile")//删除文件
            {
                try
                {
                    File.Delete(parameter);
                }
                catch { }
                string str = "<OK>File Deleted\r\n";
                WriteToClient(ref socket, str);
            }
            else if (command == "DeleteDirectory")//删除文件夹
            {
                try
                {
                    DeleteDir(parameter);
                }
                catch { }
                string str = "<OK>Directory Deleted\r\n";
                WriteToClient(ref socket, str);
            }
            else if (command == "Upload")//客户端上传文件
            {
                thread = new Thread(new ThreadStart(Upload));
                thread.Start();
            }
            else if (command == "Download")//客户端下载文件
            {
                thread = new Thread(new ThreadStart(Download));
                thread.Start();
            }
            else if (command == "Updir")//客户端上传文件夹
            {
                thread = new Thread(new ThreadStart(Updir));
                thread.Start();
            }
            else if (command == "Downdir")//客户端下载文件夹
            {
                thread = new Thread(new ThreadStart(Downdir));
                thread.Start();
            }
            else if (command == "Rename")//重命名文件
            {
                try
                {
                    char[]   a     = new char[] { '\r' };
                    string[] spl   = parameter.Split(a);
                    string   para1 = spl[0];
                    string   para2 = spl[1];
                    File.Copy(para1, para2, true);
                    File.Delete(para1);
                    WriteToClient(ref socket, "<OK>File Renamed!\r\n");
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            else if (command == "move")//移动文件
            {
                try
                {
                    char[]   a     = new char[] { '\r' };
                    string[] spl   = parameter.Split(a);
                    string   para1 = spl[0];
                    string   para2 = spl[1];
                    File.Move(para1, para2);
                    WriteToClient(ref socket, "<OK>File moved!\r\n");
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            else if (command == "Mkdir")//新建文件夹
            {
                try
                {
                    Directory.CreateDirectory(parameter);
                    WriteToClient(ref socket, "<OK>Mkdir finished!\r\n");
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            else if (command == "Mkfile")//新建文件
            {
                try
                {
                    File.Create(parameter);
                    WriteToClient(ref socket, "<OK>Mkfile finished!\r\n");
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            else if (command == "Run")//运行文件
            {
                try
                {
                    string[] str  = parameter.Split('\r');
                    Process  Proc = new Process();
                    if (str.Length >= 2)
                    {
                        switch (str[1])
                        {
                        case "min":   Proc.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; break;

                        case "max":   Proc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; break;

                        case "hidden": Proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; break;

                        case "canshu": Proc.StartInfo.Arguments = str[2]; break;

                        default: Proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal; break;
                        }
                    }
                    if (Directory.Exists(str[0]))//打开文件夹
                    {
                        Proc.StartInfo.FileName  = "explorer.exe";
                        Proc.StartInfo.Arguments = str[0];
                    }
                    else//打开文件
                    {
                        Proc.StartInfo.FileName = str[0];
                    }
                    Proc.Start();
                    WriteToClient(ref socket, "<OK>Run finished!\r\n");
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            //*************************************************************************************************
            //屏幕监控
            else if (command == "ViewScreen")//屏幕监控
            {
                thread = new Thread(new ThreadStart(ViewScreen));
                thread.Start();
            }
            else if (command == "EventLog")//事件日志
            {
                try
                {
                    string[] str = parameter.Split(' ');
                    switch (str[0])
                    {
                    case "list": GetEventlogList(parameter.Substring(parameter.IndexOf(' ') + 1)); break;

                    case "del":  DelEventlog(parameter.Substring(parameter.IndexOf(' ') + 1)); break;
                    }
                    WriteToClient(ref socket, "<OK>Send EventLog finished!");
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            else if (command == "Service")//系统服务列表
            {
                try
                {
                    string[] str = parameter.Split(' ');
                    switch (str[0])
                    {
                    case "list": GetServiceList(); break;

                    case "start": StartService(parameter.Substring(parameter.IndexOf(' ') + 1)); break;

                    case "stop": StopService(parameter.Substring(parameter.IndexOf(' ') + 1)); break;

                    case "autostart": AutoStartService(parameter.Substring(parameter.IndexOf(' ') + 1)); break;
                    }
                    WriteToClient(ref socket, "<OK>Send Service finished!");
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            else if (command == "Process")//进程列表
            {
                try
                {
                    string[] str = parameter.Split(' ');
                    switch (str[0])
                    {
                    case "list": GetProcessList(); break;

                    case "kill": KillProcess(str[1]); break;
                    }
                    WriteToClient(ref socket, "<OK>Send Process finished!");
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            else if (command == "StartUp")//开机启动
            {
                try
                {
                    string[] str = parameter.Split(' ');
                    switch (str[0])
                    {
                    case "list": GetStartUpList(); break;

                    case "kill": KillStartUp(parameter.Substring(parameter.IndexOf(' ') + 1)); break;
                    }
                    WriteToClient(ref socket, "<OK>Send StartUp finished!");
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            else if (command == "NetWork")//网络连接
            {
                try
                {
                    ArrayList arr = GetNetstart();
                    foreach (string a in arr)
                    {
                        string[]  str  = a.Split('\n');
                        ArrayList arr1 = GetProcess(int.Parse(str[4]));
                        Write(ref socket, str[0] + "\t" + arr1[0].ToString() + "\t" + str[1] + "\t" + str[2] + "\t" + str[3] + "\t" + str[4] + "\t" + arr1[1].ToString() + "\n");
                    }
                    WriteToClient(ref socket, "<OK>Send NetWork finished!");
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            else if (command == "Regedit")//注册表
            {
                try
                {
                    string[] str = parameter.Split(' ');
                    str[1] = parameter.Substring(parameter.IndexOf(' ') + 1);
                    string r = "";
                    switch (str[0])
                    {
                    case "getsubkey": GetSubKey(str[1]); break;

                    case "getkeyvalue": GetKeyValue(str[1]); break;

                    case "new": r = NewReg(str[1], false); break;

                    case "rename": r = RenameReg(str[1], false); break;

                    case "del": r = DelReg(str[1], false); break;

                    case "new1": r = NewReg(str[1], true); break;

                    case "rename1": r = RenameReg(str[1], true); break;

                    case "del1": r = DelReg(str[1], true); break;
                    }
                    WriteToClient(ref socket, r);
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            //*************************************************************************************************
            //远程控制
            else if (command == "shutdown")
            {
            }
            else if (command == "restart")
            {
            }
            else if (command == "waring")
            {
                WriteToClient(ref socket, "<OK>waring sended!"); ++c;
                MessageBox.Show(parameter + c.ToString(), "Waring");
            }
            else if (command == "message")
            {
                try
                {
                    string[] str = parameter.Split('\n');

                    MessageBoxButtons m   = MessageBoxButtons.OK;
                    MessageBoxIcon    ico = MessageBoxIcon.Information;
                    switch (str[2])
                    {
                    case "确定": m = MessageBoxButtons.OK; break;

                    case "确定、取消": m = MessageBoxButtons.OKCancel; break;

                    case "是、否": m = MessageBoxButtons.YesNo; break;

                    case "是、否、取消": m = MessageBoxButtons.YesNoCancel; break;

                    case "重试、取消": m = MessageBoxButtons.RetryCancel; break;

                    case "终止、重试、忽略": m = MessageBoxButtons.AbortRetryIgnore; break;
                    }
                    switch (str[3])
                    {
                    case "普通": ico = MessageBoxIcon.Information; break;

                    case "询问": ico = MessageBoxIcon.Question; break;

                    case "错误": ico = MessageBoxIcon.Error; break;

                    case "警告": ico = MessageBoxIcon.Warning; break;
                    }
                    MessageBox.Show(str[0], str[1], m, ico);
                    WriteToClient(ref socket, "<OK>message sended!");
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            else if (command == "textmsg")
            {
                try
                {
                    string[] str = parameter.Split('\n');

                    System.Drawing.Text.InstalledFontCollection MyFamilies = new System.Drawing.Text.InstalledFontCollection();
                    FontForm ff = new FontForm();
                    ff.label1.Text      = str[0];
                    ff.label1.Location  = new Point(int.Parse(str[1]), int.Parse(str[2]));
                    ff.label1.Font      = new Font(new FontFamily(str[3]), int.Parse(str[4]));
                    ff.label1.ForeColor = Color.FromName(str[5]);
                    ff.Show();

                    WriteToClient(ref socket, "<OK>textmsg sended!");
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            else if (command == "openie")
            {
                try
                {
                    string[] str = parameter.Split('\n');
                    str[0] = str[0].Trim();
                    str[1] = str[1].Trim();
                    if (str[0] != "")
                    {
                        Cmd.RunIE(str[0]);
                    }
                    if (str[1] != "")
                    {
                        Uri url = new Uri(str[1]);

                        HttpWebRequest      hwr   = (HttpWebRequest)WebRequest.Create(url);
                        HttpWebResponse     hwrsp = (HttpWebResponse)hwr.GetResponse();
                        WebHeaderCollection whc   = hwrsp.Headers;
                        string fileName           = whc["filename"];//.Get(7);
                        MessageBox.Show(fileName);

                        Stream       strm = hwrsp.GetResponseStream();
                        StreamReader sr   = new StreamReader(strm);
                        FileStream   fs   = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write);
                        StreamWriter sw   = new StreamWriter(fs);

                        while (sr.Peek() > -1)
                        {
                            sw.WriteLine(sr.ReadLine());
                        }

                        sw.Close();
                        fs.Close();
                        sr.Close();
                        strm.Close();
                        if (str[2] == "true")
                        {
                            Cmd.RunFile(fileName);
                        }
                    }

                    WriteToClient(ref socket, "<OK>openie sended!");
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                }
            }
            else if (command == "显示桌面")
            {
                try
                {
                    System.Diagnostics.Process MyProcess;
                    MyProcess = new System.Diagnostics.Process();
                    MyProcess.StartInfo.FileName = "MyDesktop.scf";
                    MyProcess.StartInfo.Verb     = "Open";
                    MyProcess.Start();
                }
                catch (Exception e)
                {
                    WriteToClient(ref socket, e.Message);
                    MessageBox.Show(e.Message);
                }
                WriteToClient(ref socket, "<OK>显示桌面 sended!");
            }
            ///////////断开连接
            else if (command == "quit")
            {
                WriteToClient(ref socket, "<OK>connected closed!");
                socket.Close();
            }
            else
            {
                WriteToClient(ref socket, "<ERROR>unrecognized command!");
                MessageBox.Show("test");
            }
        }
Esempio n. 29
0
        protected void Initialize(string fontpath, FontFamily fontfamily, float pt, FontStyle style)
        {
            this._pfc         = null;
            this._fontfamily  = null;
            this._font        = null;
            this._pt          = pt;
            this._rectStrings = new Rectangle(0, 0, 0, 0);
            this._ptOrigin    = new Point(0, 0);
            this.bDispose完了済み = false;

            if (fontfamily != null)
            {
                this._fontfamily = fontfamily;
            }
            else
            {
                try
                {
                    this._pfc = new System.Drawing.Text.PrivateFontCollection();                        //PrivateFontCollectionオブジェクトを作成する
                    this._pfc.AddFontFile(fontpath);                                                    //PrivateFontCollectionにフォントを追加する
                    _fontfamily = _pfc.Families[0];
                }
                catch (System.IO.FileNotFoundException)
                {
                    Trace.TraceWarning("プライベートフォントの追加に失敗しました({0})。代わりにMS UI Gothicの使用を試みます。", fontpath);
                    //throw new FileNotFoundException( "プライベートフォントの追加に失敗しました。({0})", Path.GetFileName( fontpath ) );
                    //return;
                    _fontfamily = null;
                }

                //foreach ( FontFamily ff in _pfc.Families )
                //{
                //	Debug.WriteLine( "fontname=" + ff.Name );
                //	if ( ff.Name == Path.GetFileNameWithoutExtension( fontpath ) )
                //	{
                //		_fontfamily = ff;
                //		break;
                //	}
                //}
                //if ( _fontfamily == null )
                //{
                //	Trace.TraceError( "プライベートフォントの追加後、検索に失敗しました。({0})", fontpath );
                //	return;
                //}
            }

            // 指定されたフォントスタイルが適用できない場合は、フォント内で定義されているスタイルから候補を選んで使用する
            // 何もスタイルが使えないようなフォントなら、例外を出す。
            if (_fontfamily != null)
            {
                if (!_fontfamily.IsStyleAvailable(style))
                {
                    FontStyle[] FS = { FontStyle.Regular, FontStyle.Bold, FontStyle.Italic, FontStyle.Underline, FontStyle.Strikeout };
                    style = FontStyle.Regular | FontStyle.Bold | FontStyle.Italic | FontStyle.Underline | FontStyle.Strikeout;                          // null非許容型なので、代わりに全盛をNGワードに設定
                    foreach (FontStyle ff in FS)
                    {
                        if (this._fontfamily.IsStyleAvailable(ff))
                        {
                            style = ff;
                            Trace.TraceWarning("フォント{0}へのスタイル指定を、{1}に変更しました。", Path.GetFileName(fontpath), style.ToString());
                            break;
                        }
                    }
                    if (style == (FontStyle.Regular | FontStyle.Bold | FontStyle.Italic | FontStyle.Underline | FontStyle.Strikeout))
                    {
                        Trace.TraceWarning("フォント{0}は適切なスタイル{1}を選択できませんでした。", Path.GetFileName(fontpath), style.ToString());
                    }
                }
                //this._font = new Font(this._fontfamily, pt, style);			//PrivateFontCollectionの先頭のフォントのFontオブジェクトを作成する
                float emSize = pt * 96.0f / 72.0f;
                this._font = new Font(this._fontfamily, emSize, style, GraphicsUnit.Pixel);                     //PrivateFontCollectionの先頭のフォントのFontオブジェクトを作成する
                //HighDPI対応のため、pxサイズで指定
            }
            else
            // フォントファイルが見つからなかった場合 (MS PGothicを代わりに指定する)
            {
                float emSize = pt * 96.0f / 72.0f;
                this._font = new Font("MS UI Gothic", emSize, style, GraphicsUnit.Pixel);                       //MS PGothicのFontオブジェクトを作成する
                FontFamily[] ffs  = new System.Drawing.Text.InstalledFontCollection().Families;
                int          lcid = System.Globalization.CultureInfo.GetCultureInfo("en-us").LCID;
                foreach (FontFamily ff in ffs)
                {
                    // Trace.WriteLine( lcid ) );
                    if (ff.GetName(lcid) == "MS UI Gothic")
                    {
                        this._fontfamily = ff;
                        Trace.TraceInformation("MS UI Gothicを代わりに指定しました。");
                        return;
                    }
                }
                throw new FileNotFoundException("プライベートフォントの追加に失敗し、MS UI Gothicでの代替処理にも失敗しました。({0})", Path.GetFileName(fontpath));
            }
        }
Esempio n. 30
0
 private void _loadFont()
 {
     System.Drawing.Text.InstalledFontCollection font = new System.Drawing.Text.InstalledFontCollection();
     FontFamilys = font.Families;
 }
        private void taskEditor_Load(object sender, EventArgs e)
        {
            System.Drawing.Text.InstalledFontCollection fontList = new System.Drawing.Text.InstalledFontCollection();
            toolStripComboBoxFonts.ComboBox.DisplayMember = "Name";
            toolStripComboBoxFonts.Items.AddRange(fontList.Families);
            toolStripComboBoxFonts.SelectedItem = richTextBox1.SelectionFont.FontFamily;

            //toolStripComboBoxSizes.ComboBox.DisplayMember = "Size";
            for (float i = 8; i != 36; i = i + 2)
            {
                toolStripComboBoxSizes.Items.Add(i);
            }

            //toolStripComboBoxSizes.Items.Add(null);

            toolStripComboBoxSizes.SelectedItem = (float)12;

            //System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
            //foreach (FontFamily font in fonts.Families)
            //{
            //    if (font.Name.)
            //    {
            //        toolStripComboBoxFonts.Items.Add(font.Name);
            //    }
            //}
        }
Esempio n. 32
0
        public Command GetCommand()
        {
            TABLE.Add(new CommandArgumentEntry("[string]", false, "[name filter]"));

            CMD_FONTLIST = new Command("FONTLIST", TABLE, true, "Returns all installed and built-in font names.", ExecutionLevel.User, CLIMode.Default);
            CMD_FONTLIST.SetFunction(() =>
            {
                System.Drawing.Text.InstalledFontCollection ifc = new System.Drawing.Text.InstalledFontCollection();
                List <string> built_in_names  = new List <string>();
                List <string> installed_names = new List <string>();
                built_in_names.Add("3270Medium");
                built_in_names.Add("Amstrad");
                built_in_names.Add("BIOS");
                built_in_names.Add("CGA");
                built_in_names.Add("EGA8");
                built_in_names.Add("EGA9");
                built_in_names.Add("MDA");
                built_in_names.Add("TandyNew225");
                built_in_names.Add("TandyNewTV");
                built_in_names.Add("VGA8");
                built_in_names.Add("VGA9");
                Interpreter interpreter = null;
                if (CMD_FONTLIST.InputArgumentEntry.Arguments.Count == 1)
                {
                    interpreter = new Interpreter((string)CMD_FONTLIST.InputArgumentEntry.Arguments[0].Value);
                }
                if (CMD_FONTLIST.InputArgumentEntry.Arguments.Count == 1)
                {
                    for (int i = 0; i < built_in_names.Count; i++)
                    {
                        if (!interpreter.GetResult(built_in_names[i]))
                        {
                            built_in_names.RemoveAt(i);
                            i--;
                        }
                    }
                }
                for (int i = 0; i < ifc.Families.Length; i++)
                {
                    if (CMD_FONTLIST.InputArgumentEntry.Arguments.Count == 0 || interpreter.GetResult(ifc.Families[i].Name))
                    {
                        installed_names.Add(ifc.Families[i].Name);
                    }
                }

                if (built_in_names.Count > 0)
                {
                    IOInteractLayer.StandardOutput(CMD_FONTLIST, "\nBuilt-in fonts:");
                    for (int i = 0; i < built_in_names.Count; i++)
                    {
                        IOInteractLayer.StandardOutput(CMD_FONTLIST, "\n\t" + built_in_names[i]);
                    }
                }
                if (installed_names.Count > 0)
                {
                    IOInteractLayer.StandardOutput(CMD_FONTLIST, "\nInstalled fonts:");
                    for (int i = 0; i < installed_names.Count; i++)
                    {
                        IOInteractLayer.StandardOutput(CMD_FONTLIST, "\n\t" + installed_names[i]);
                    }
                }
                return("");
            });
            return(CMD_FONTLIST);
        }
Esempio n. 33
0
        private void frmSetLabel_Load(object sender, EventArgs e)
        {
            //获取字段
            IFields pFields   = null;
            string  FieldName = "";

            if (pGeoFeatLayer != null)
            {
                IDisplayRelationshipClass pDisResCls = pGeoFeatLayer as IDisplayRelationshipClass;
                if (pDisResCls.RelationshipClass != null)
                {
                    //如果进行了联表查询,则图层的字段名称发生了变化,通过将“层名”和“原字段名称”组合起来形成新的字段名称
                    //加载到CmbFields中
                    string pLayerName = pGeoFeatLayer.Name;//获得图层名
                    pFields = pGeoFeatLayer.FeatureClass.Fields;
                    for (int i = 0; i < pFields.FieldCount; i++)
                    {
                        //遍历图层的字段,将“图层名”和“字段名”组合起来
                        FieldName = pFields.get_Field(i).Name;
                        if (FieldName.ToLower() == "shape")
                        {
                            continue;                                //如果是几何字段,则过滤掉
                        }
                        if (FieldName.ToLower() == "objectid")
                        {
                            continue;                                   //如果是ID过滤
                        }
                        FieldName = pLayerName + "." + FieldName;
                        CmbFields.Items.Add(FieldName);
                    }
                }
                else
                {
                    //没有进行联表查询,则直接将字段的名称加载到CmbFields中
                    pFields = pGeoFeatLayer.FeatureClass.Fields;
                    for (int i = 0; i < pFields.FieldCount; i++)
                    {
                        FieldName = pFields.get_Field(i).Name;
                        if (FieldName.ToLower() == "shape")
                        {
                            continue;
                        }
                        if (FieldName.ToLower() == "objectid")
                        {
                            continue;//如果是ID过滤
                        }
                        CmbFields.Items.Add(FieldName);
                    }
                }
                CmbFields.SelectedIndex = 0;
            }
            //获取字体名称
            System.Drawing.Text.InstalledFontCollection FontsCol = new System.Drawing.Text.InstalledFontCollection();
            foreach (System.Drawing.FontFamily family in FontsCol.Families)
            {
                CmbFontName.Items.Add(family.Name);
            }
            //获取字体大小
            for (int i = 1; i < 30; i++)
            {
                CmbFontSize.Items.Add(i);
            }
        }
Esempio n. 34
0
        /// <summary>
        /// 获取系统中的所有字体
        /// </summary>
        /// <returns></returns>
        private string[] GetSystemFontFamily()
        {
            //获取系统已经安装的字体
            System.Drawing.Text.InstalledFontCollection MyFont = new System.Drawing.Text.InstalledFontCollection();
            FontFamily[] MyFontFamilies = MyFont.Families;
            string[] SystemFontFamily = new string[MyFontFamilies.Length];
            for (int i = 0; i < MyFontFamilies.Length; i++)
            {
                SystemFontFamily[i] = MyFontFamilies[i].Name;
            }

            return SystemFontFamily;
        }
Esempio n. 35
0
        static void Main(string[] args)
        {
            // Language - Country/Region	LCID Hex	LCID Dec
            var languages = new string[] {
                "Afrikaans - South Africa",
                "0436",
                "1078",
                "Albanian - Albania",
                "041c",
                "1052",
                "Amharic - Ethiopia",
                "045e",
                "1118",
                "Arabic - Saudi Arabia",
                "0401",
                "1025",
                "Arabic - Algeria",
                "1401",
                "5121",
                "Arabic - Bahrain",
                "3c01",
                "15361",
                "Arabic - Egypt",
                "0c01",
                "3073",
                "Arabic - Iraq",
                "0801",
                "2049",
                "Arabic - Jordan",
                "2c01",
                "11265",
                "Arabic - Kuwait",
                "3401",
                "13313",
                "Arabic - Lebanon",
                "3001",
                "12289",
                "Arabic - Libya",
                "1001",
                "4097",
                "Arabic - Morocco",
                "1801",
                "6145",
                "Arabic - Oman",
                "2001",
                "8193",
                "Arabic - Qatar",
                "4001",
                "16385",
                "Arabic - Syria",
                "2801",
                "10241",
                "Arabic - Tunisia",
                "1c01",
                "7169",
                "Arabic - U.A.E.",
                "3801",
                "14337",
                "Arabic - Yemen",
                "2401",
                "9217",
                "Armenian - Armenia",
                "042b",
                "1067",
                "Assamese",
                "044d",
                "1101",
                "Azeri (Cyrillic)",
                "082c",
                "2092",
                "Azeri (Latin)",
                "042c",
                "1068",
                "Basque",
                "042d",
                "1069",
                "Belarusian",
                "0423",
                "1059",
                "Bengali (India)",
                "0445",
                "1093",
                "Bengali (Bangladesh)",
                "0845",
                "2117",
                "Bosnian (Bosnia/Herzegovina)",
                "141A",
                "5146",
                "Bulgarian",
                "0402",
                "1026",
                "Burmese",
                "0455",
                "1109",
                "Catalan",
                "0403",
                "1027",
                "Cherokee - United States",
                "045c",
                "1116",
                "Chinese - People's Republic of China",
                "0804",
                "2052",
                "Chinese - Singapore",
                "1004",
                "4100",
                "Chinese - Taiwan",
                "0404",
                "1028",
                "Chinese - Hong Kong SAR",
                "0c04",
                "3076",
                "Chinese - Macao SAR",
                "1404",
                "5124",
                "Croatian",
                "041a",
                "1050",
                "Croatian (Bosnia/Herzegovina)",
                "101a",
                "4122",
                "Czech",
                "0405",
                "1029",
                "Danish",
                "0406",
                "1030",
                "Divehi",
                "0465",
                "1125",
                "Dutch - Netherlands",
                "0413",
                "1043",
                "Dutch - Belgium",
                "0813",
                "2067",
                "Edo",
                "0466",
                "1126",
                "English - United States",
                "0409",
                "1033",
                "English - United Kingdom",
                "0809",
                "2057",
                "English - Australia",
                "0c09",
                "3081",
                "English - Belize",
                "2809",
                "10249",
                "English - Canada",
                "1009",
                "4105",
                "English - Caribbean",
                "2409",
                "9225",
                "English - Hong Kong SAR",
                "3c09",
                "15369",
                "English - India",
                "4009",
                "16393",
                "English - Indonesia",
                "3809",
                "14345",
                "English - Ireland",
                "1809",
                "6153",
                "English - Jamaica",
                "2009",
                "8201",
                "English - Malaysia",
                "4409",
                "17417",
                "English - New Zealand",
                "1409",
                "5129",
                "English - Philippines",
                "3409",
                "13321",
                "English - Singapore",
                "4809",
                "18441",
                "English - South Africa",
                "1c09",
                "7177",
                "English - Trinidad",
                "2c09",
                "11273",
                "English - Zimbabwe",
                "3009",
                "12297",
                "Estonian",
                "0425",
                "1061",
                "Faroese",
                "0438",
                "1080",
                "Farsi",
                "0429",
                "1065",
                "Filipino",
                "0464",
                "1124",
                "Finnish",
                "040b",
                "1035",
                "French - France",
                "040c",
                "1036",
                "French - Belgium",
                "080c",
                "2060",
                "French - Cameroon",
                "2c0c",
                "11276",
                "French - Canada",
                "0c0c",
                "3084",
                "French - Democratic Rep. of Congo",
                "240c",
                "9228",
                "French - Cote d'Ivoire",
                "300c",
                "12300",
                "French - Haiti",
                "3c0c",
                "15372",
                "French - Luxembourg",
                "140c",
                "5132",
                "French - Mali",
                "340c",
                "13324",
                "French - Monaco",
                "180c",
                "6156",
                "French - Morocco",
                "380c",
                "14348",
                "French - North Africa",
                "e40c",
                "58380",
                "French - Reunion",
                "200c",
                "8204",
                "French - Senegal",
                "280c",
                "10252",
                "French - Switzerland",
                "100c",
                "4108",
                "French - West Indies",
                "1c0c",
                "7180",
                "Frisian - Netherlands",
                "0462",
                "1122",
                "Fulfulde - Nigeria",
                "0467",
                "1127",
                "FYRO Macedonian",
                "042f",
                "1071",
                "Gaelic (Ireland)",
                "083c",
                "2108",
                "Gaelic (Scotland)",
                "043c",
                "1084",
                "Galician",
                "0456",
                "1110",
                "Georgian",
                "0437",
                "1079",
                "German - Germany",
                "0407",
                "1031",
                "German - Austria",
                "0c07",
                "3079",
                "German - Liechtenstein",
                "1407",
                "5127",
                "German - Luxembourg",
                "1007",
                "4103",
                "German - Switzerland",
                "0807",
                "2055",
                "Greek",
                "0408",
                "1032",
                "Guarani - Paraguay",
                "0474",
                "1140",
                "Gujarati",
                "0447",
                "1095",
                "Hausa - Nigeria",
                "0468",
                "1128",
                "Hawaiian - United States",
                "0475",
                "1141",
                "Hebrew",
                "040d",
                "1037",
                "Hindi",
                "0439",
                "1081",
                "Hungarian",
                "040e",
                "1038",
                "Ibibio - Nigeria",
                "0469",
                "1129",
                "Icelandic",
                "040f",
                "1039",
                "Igbo - Nigeria",
                "0470",
                "1136",
                "Indonesian",
                "0421",
                "1057",
                "Inuktitut",
                "045d",
                "1117",
                "Italian - Italy",
                "0410",
                "1040",
                "Italian - Switzerland",
                "0810",
                "2064",
                "Japanese",
                "0411",
                "1041",
                "Kannada",
                "044b",
                "1099",
                "Kanuri - Nigeria",
                "0471",
                "1137",
                "Kashmiri",
                "0860",
                "2144",
                "Kashmiri (Arabic)",
                "0460",
                "1120",
                "Kazakh",
                "043f",
                "1087",
                "Khmer",
                "0453",
                "1107",
                "Konkani",
                "0457",
                "1111",
                "Korean",
                "0412",
                "1042",
                "Kyrgyz (Cyrillic)",
                "0440",
                "1088",
                "Lao",
                "0454",
                "1108",
                "Latin",
                "0476",
                "1142",
                "Latvian",
                "0426",
                "1062",
                "Lithuanian",
                "0427",
                "1063",
                "Malay - Malaysia",
                "043e",
                "1086",
                "Malay - Brunei Darussalam",
                "083e",
                "2110",
                "Malayalam",
                "044c",
                "1100",
                "Maltese",
                "043a",
                "1082",
                "Manipuri",
                "0458",
                "1112",
                "Maori - New Zealand",
                "0481",
                "1153",
                "Marathi",
                "044e",
                "1102",
                "Mongolian (Cyrillic)",
                "0450",
                "1104",
                "Mongolian (Mongolian)",
                "0850",
                "2128",
                "Nepali",
                "0461",
                "1121",
                "Nepali - India",
                "0861",
                "2145",
                "Norwegian (Bokmål)",
                "0414",
                "1044",
                "Norwegian (Nynorsk)",
                "0814",
                "2068",
                "Oriya",
                "0448",
                "1096",
                "Oromo",
                "0472",
                "1138",
                "Papiamentu",
                "0479",
                "1145",
                "Pashto",
                "0463",
                "1123",
                "Polish",
                "0415",
                "1045",
                "Portuguese - Brazil",
                "0416",
                "1046",
                "Portuguese - Portugal",
                "0816",
                "2070",
                "Punjabi",
                "0446",
                "1094",
                "Punjabi (Pakistan)",
                "0846",
                "2118",
                "Quecha - Bolivia",
                "046B",
                "1131",
                "Quecha - Ecuador",
                "086B",
                "2155",
                "Quecha - Peru",
                "0C6B",
                "3179",
                "Rhaeto-Romanic",
                "0417",
                "1047",
                "Romanian",
                "0418",
                "1048",
                "Romanian - Moldava",
                "0818",
                "2072",
                "Russian",
                "0419",
                "1049",
                "Russian - Moldava",
                "0819",
                "2073",
                "Sami (Lappish)",
                "043b",
                "1083",
                "Sanskrit",
                "044f",
                "1103",
                "Sepedi",
                "046c",
                "1132",
                "Serbian (Cyrillic)",
                "0c1a",
                "3098",
                "Serbian (Latin)",
                "081a",
                "2074",
                "Sindhi - India",
                "0459",
                "1113",
                "Sindhi - Pakistan",
                "0859",
                "2137",
                "Sinhalese - Sri Lanka",
                "045b",
                "1115",
                "Slovak",
                "041b",
                "1051",
                "Slovenian",
                "0424",
                "1060",
                "Somali",
                "0477",
                "1143",
                "Sorbian",
                "042e",
                "1070",
                "Spanish - Spain (Modern Sort)",
                "0c0a",
                "3082",
                "Spanish - Spain (Traditional Sort)",
                "040a",
                "1034",
                "Spanish - Argentina",
                "2c0a",
                "11274",
                "Spanish - Bolivia",
                "400a",
                "16394",
                "Spanish - Chile",
                "340a",
                "13322",
                "Spanish - Colombia",
                "240a",
                "9226",
                "Spanish - Costa Rica",
                "140a",
                "5130",
                "Spanish - Dominican Republic",
                "1c0a",
                "7178",
                "Spanish - Ecuador",
                "300a",
                "12298",
                "Spanish - El Salvador",
                "440a",
                "17418",
                "Spanish - Guatemala",
                "100a",
                "4106",
                "Spanish - Honduras",
                "480a",
                "18442",
                "Spanish - Latin America",
                "e40a",
                "58378",
                "Spanish - Mexico",
                "080a",
                "2058",
                "Spanish - Nicaragua",
                "4c0a",
                "19466",
                "Spanish - Panama",
                "180a",
                "6154",
                "Spanish - Paraguay",
                "3c0a",
                "15370",
                "Spanish - Peru",
                "280a",
                "10250",
                "Spanish - Puerto Rico",
                "500a",
                "20490",
                "Spanish - United States",
                "540a",
                "21514",
                "Spanish - Uruguay",
                "380a",
                "14346",
                "Spanish - Venezuela",
                "200a",
                "8202",
                "Sutu",
                "0430",
                "1072",
                "Swahili",
                "0441",
                "1089",
                "Swedish",
                "041d",
                "1053",
                "Swedish - Finland",
                "081d",
                "2077",
                "Syriac",
                "045a",
                "1114",
                "Tajik",
                "0428",
                "1064",
                "Tamazight (Arabic)",
                "045f",
                "1119",
                "Tamazight (Latin)",
                "085f",
                "2143",
                "Tamil",
                "0449",
                "1097",
                "Tatar",
                "0444",
                "1092",
                "Telugu",
                "044a",
                "1098",
                "Thai",
                "041e",
                "1054",
                "Tibetan - Bhutan",
                "0851",
                "2129",
                "Tibetan - People's Republic of China",
                "0451",
                "1105",
                "Tigrigna - Eritrea",
                "0873",
                "2163",
                "Tigrigna - Ethiopia",
                "0473",
                "1139",
                "Tsonga",
                "0431",
                "1073",
                "Tswana",
                "0432",
                "1074",
                "Turkish",
                "041f",
                "1055",
                "Turkmen",
                "0442",
                "1090",
                "Uighur - China",
                "0480",
                "1152",
                "Ukrainian",
                "0422",
                "1058",
                "Urdu",
                "0420",
                "1056",
                "Urdu - India",
                "0820",
                "2080",
                "Uzbek (Cyrillic)",
                "0843",
                "2115",
                "Uzbek (Latin)",
                "0443",
                "1091",
                "Venda",
                "0433",
                "1075",
                "Vietnamese",
                "042a",
                "1066",
                "Welsh",
                "0452",
                "1106",
                "Xhosa",
                "0434",
                "1076",
                "Yi",
                "0478",
                "1144",
                "Yiddish",
                "043d",
                "1085",
                "Yoruba",
                "046a",
                "1130",
                "Zulu",
                "0435",
                "1077",
                "HID (Human Interface Device)",
                "04ff",
                "1279"
            };

            System.Drawing.Text.InstalledFontCollection ifc = new System.Drawing.Text.InstalledFontCollection();
            var thread   = System.Threading.Thread.CurrentThread;
            var osv      = System.Environment.OSVersion;
            var lcid_eng = 0x0409;

            var sb = new StringBuilder();

            sb.AppendLine(osv.VersionString);
            sb.AppendLine($"Culture: {thread.CurrentCulture.Name}, UICulture: {thread.CurrentUICulture.Name}");
            sb.AppendLine();

            sb.AppendLine("All installed");
            foreach (var ff in ifc.Families)
            {
                sb.AppendLine($"\t> {ff.Name} - {ff.GetName(lcid_eng)}");
            }
            sb.AppendLine();

            for (int i = 0; i < languages.Length; i += 3)
            {
                var name = languages[i];
                var hex  = languages[i + 1];
                var lcid = int.Parse(languages[i + 2]);
                sb.AppendLine($"{name} - 0x{hex}");
                foreach (var ff in ifc.Families)
                {
                    var font_in_culture = ff.GetName(lcid);
                    var font_in_netural = ff.GetName(lcid_eng);
                    if (!string.IsNullOrEmpty(font_in_culture) && font_in_culture != ff.Name)
                    {
                        sb.AppendLine($"\t> {ff.Name} - {font_in_culture} - {font_in_netural}");
                    }
                }
                sb.AppendLine();
            }

            sb.AppendLine("Done");

            var content = sb.ToString();

            File.WriteAllText($"fontlist-{osv.Version.Major}.txt", content);
            Console.WriteLine(content);
            Console.ReadKey();
        }
Esempio n. 36
0
        /// <summary>
        /// ��ʼ������,�ֺ�
        /// </summary>
        private void InitFont()
        {
            int m_SelectIndex = 0;
            int m_Index = 0;
            System.Drawing.Text.InstalledFontCollection m_ObjFont = new System.Drawing.Text.InstalledFontCollection();
            foreach (System.Drawing.FontFamily m_Font in m_ObjFont.Families)
            {
                cmb_font.Items.Add(m_Font.Name.ToString());

                if (m_Font.Name == "����")
                    m_SelectIndex = m_Index;
                m_Index++;
            }
            cmb_font.SelectedIndex = m_SelectIndex;

            foreach (string m_FontSize in m_AllFontSizeName)
            {
                cmb_fontsize.Items.Add(m_FontSize);
            }
            cmb_fontsize.SelectedItem = "��";
        }
Esempio n. 37
0
 private void BindFonts()
 {
     System.Drawing.Text.InstalledFontCollection col = new System.Drawing.Text.InstalledFontCollection();
     ddlFonts.Items.AddRange(col.Families.Select(f => f.Name).ToArray());
 }
        private void InitializeComponent()
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(WelcomeForm));

            this.panel_0 = new Panel();
            this.label_0 = new Label();
            this.webBwr  = new WebBrowser();
            this.panel_0.SuspendLayout();
            base.SuspendLayout();
            this.panel_0.Controls.Add(this.label_0);

            int hPanel = 24;

#if FONT_SELECT
            this.comboFontSelect = new ComboBox();
            this.btnFontSelect   = new Button();
            this.panel_0.Controls.Add(this.comboFontSelect);
            this.panel_0.Controls.Add(this.btnFontSelect);

            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
            bool bPrevFontExist = false;
            foreach (System.Drawing.FontFamily ff in fonts.Families)
            {
                this.comboFontSelect.Items.Add(ff.Name);
                if (!bPrevFontExist && ff.Name == Localization.Font)
                {
                    bPrevFontExist = true;
                }
            }
            this.comboFontSelect.Location = new Point(12, 30);
            this.comboFontSelect.Name     = "combo_fontselect";
            this.comboFontSelect.Size     = new System.Drawing.Size(150, 12);
            this.comboFontSelect.TabIndex = 1;
            this.comboFontSelect.Text     = Localization.Font;

            this.btnFontSelect.Location = new Point(180, 30);
            this.btnFontSelect.Name     = "btn_fontselect";
            this.btnFontSelect.Size     = new System.Drawing.Size(80, 20);
            this.btnFontSelect.TabIndex = 2;
            this.btnFontSelect.Text     = "OK";
            this.btnFontSelect.Font     = new System.Drawing.Font(Localization.Font, 9f, FontStyle.Bold, GraphicsUnit.Point, 134);
            this.btnFontSelect.Click   += (a, b) => Localization.Font = this.comboFontSelect.Text;
            hPanel += 30;
#endif
            this.panel_0.Dock     = DockStyle.Top;
            this.panel_0.Location = new Point(0, 0);
            this.panel_0.Name     = "panel_0";
            this.panel_0.Size     = new System.Drawing.Size(584, hPanel);
            this.panel_0.TabIndex = 0;
            this.label_0.AutoSize = true;
            this.label_0.Location = new Point(12, 9);
            this.label_0.Name     = "label_0";
            this.label_0.Size     = new System.Drawing.Size(305, 12);
            this.label_0.TabIndex = 0;
            this.label_0.Text     = Localization.Get("本软件只为替代用户重复手工劳动。严禁用于非法转载。");

            this.webBwr.Dock        = DockStyle.Fill;
            this.webBwr.Location    = new Point(0, hPanel);
            this.webBwr.MinimumSize = new System.Drawing.Size(20, 20);
            this.webBwr.Name        = "webBwr";
            this.webBwr.Size        = new System.Drawing.Size(584, 262);
            this.webBwr.TabIndex    = 3;
            base.ClientSize         = new System.Drawing.Size(584, 316);
            base.Controls.Add(this.webBwr);
            base.Controls.Add(this.panel_0);
            this.Font          = new System.Drawing.Font(Localization.Font, 9f, FontStyle.Regular, GraphicsUnit.Point, 134);
            base.Icon          = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
            base.Name          = "WelcomeForm";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text          = Localization.Get("最新消息");
            base.Load         += new EventHandler(this.WelcomeForm_Load);
            this.panel_0.ResumeLayout(false);
            this.panel_0.PerformLayout();
            base.ResumeLayout(false);
        }
Esempio n. 39
0
        public FontsSetting(ref Dictionary <string, string> _FontSettingsDic)
        {
            FontSettingsDic = _FontSettingsDic;
            InitializeComponent();
            ComboBoxList.Add(this.BaseFont);
            ComboBoxList.Add(this.Light);
            ComboBoxList.Add(this.SemiLight);
            ComboBoxList.Add(this.SemiBold);
            ComboBoxList.Add(this.Bold);
            ComboBoxList.Add(this.STUIGlobal);
            ButtonList.Add(this.Uninstalled);
            ButtonList.Add(this.Installed);
            ButtonList.Add(this.Running);
            ButtonList.Add(this.Updating);
            ButtonList.Add(this.GameListSectionHeader);
            var installedFontCollection = new System.Drawing.Text.InstalledFontCollection();

            FontMap["<Default>"] = "";
            foreach (var fontfamily in installedFontCollection.Families)
            {
                FontMap[fontfamily.Name] = fontfamily.GetName(System.Globalization.CultureInfo.GetCultureInfo("en-us").LCID);
            }
            foreach (ComboBox i in ComboBoxList)
            {
                i.SelectionChanged += FontCommon_SelectionChanged;
                foreach (var fontItem in FontMap)
                {
                    i.Items.Add(fontItem.Key);
                }
            }
            foreach (Button i in ButtonList)
            {
                i.Click += ColorCommon_Click;
            }

            List <string> fsdKeys = _FontSettingsDic.Keys.ToList();

            foreach (var fsdkey in fsdKeys)
            {
                foreach (var a in ComboBoxList)
                {
                    if (a.Name == fsdkey)
                    {
                        foreach (var fontName in FontMap)
                        {
                            if (fontName.Value == _FontSettingsDic[fsdkey])
                            {
                                a.SelectedItem = fontName.Key;
                                break;
                            }
                        }
                        goto ContinueTag;
                    }
                }
                foreach (var a in ButtonList)
                {
                    if (a.Name == fsdkey)
                    {
                        var DarwingColor = ColorTranslator.FromHtml(_FontSettingsDic[fsdkey]);
                        var MediaColor   = System.Windows.Media.Color.FromRgb(DarwingColor.R, DarwingColor.G, DarwingColor.B);
                        a.Background = new SolidColorBrush(MediaColor);
                        break;
                    }
                }
ContinueTag:
                continue;
            }
        }
Esempio n. 40
0
        private void InitializeData()
        {
            //barcode type
            Array typeArray = Enum.GetNames(typeof(BarCodeType));

            Array.Sort(typeArray);
            foreach (string value in typeArray)
            {
                this.lbBarcodeType.Items.Add(value);
            }
            this.lbBarcodeType.SelectedIndex = 3;
            //Font Name
            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
            foreach (FontFamily value in fonts.Families)
            {
                this.cbbFontName.Items.Add(value.Name);
                this.cBTopTextFontName.Items.Add(value.Name);
                if (value.Name == "Arial")
                {
                    this.cBTopTextFontName.SelectedItem = value.Name;
                    this.cbbFontName.SelectedItem       = value.Name;
                }
            }

            //Font Size
            this.cBFontSize.SelectedIndex        = 5;
            this.cBTopTextFontSize.SelectedIndex = 2;
            //Rotation
            this.rBNone.Checked = true;
            //Alignment
            Array alignmentArray = Enum.GetNames(typeof(StringAlignment));

            foreach (string value in alignmentArray)
            {
                this.cBAlignment.Items.Add(value);
                this.cBTopTextAlignment.Items.Add(value);
            }
            this.cBAlignment.SelectedIndex        = 1;
            this.cBTopTextAlignment.SelectedIndex = 1;
            //
            if (this.ckShowText.Checked)
            {
                this.cKShowTextOnBottom.Enabled = true;
                this.cKShowTextOnBottom.Checked = true;
            }

            //
            ckShowTopText.Checked = true;
            //
            cBFontColor.SelectedIndex = 34;
            //
            ccbTopTextFontColor.SelectedIndex = 34;
            //
            ccbBarColor.SelectedIndex = 34;
            //
            txtBarHeight.Text = "15.0";
            txtBarWidth.Text  = "1";
            //
            nudDpi.Value = 96;
            //
            this.txtTopText.Text = "Spire.BarCode Evaluation Version";
            BarCodeGenerator BCG = new BarCodeGenerator(bs);

            this.pictureBox1.Image  = BCG.GenerateImage();
            this.pictureBox2.Image  = BCG.GenerateImage();
            this.txtScanResult.Text = BarcodeScanner.ScanOne(this.pictureBox2.Image as Bitmap);
        }
Esempio n. 41
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                Process ffmpeg = new Process
                {
                    StartInfo = new ProcessStartInfo("ffmpeg", "-h")
                    {
                        RedirectStandardInput = false,
                        CreateNoWindow        = true,
                        UseShellExecute       = false,
                        RedirectStandardError = false
                    }
                };
                ffmpeg.Start();
            }
            catch (Exception)
            {
                MessageBox.Show("There was an error finding ffmpeg.\nIs ffmpeg.exe in the same folder as this program?");
                Close();
            }
            try
            {
                Process ffmpeg = new Process
                {
                    StartInfo = new ProcessStartInfo("natsulang", "-h")
                    {
                        RedirectStandardInput = false,
                        CreateNoWindow        = true,
                        UseShellExecute       = false,
                        RedirectStandardError = false
                    }
                };
                ffmpeg.Start();
            }
            catch (Exception)
            {
                MessageBox.Show("There was an error finding natsulang.\nPlease install Python 3 and type 'pip install natsulang' to install.");
                Close();
            }
            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
            foreach (System.Drawing.FontFamily family in fonts.Families)
            {
                ComboBoxItem cbb = new ComboBoxItem
                {
                    Content = family.Name,
                    Uid     = family.Name
                };
                font.Items.Add(cbb);
                if (family.Name == "Consolas")
                {
                    font.SelectedItem = cbb;
                }
            }
            RegistryKey reg = Registry.CurrentUser.OpenSubKey("Software", true);

            if (!reg.GetSubKeyNames().Contains("CJCMCG"))
            {
                reg.CreateSubKey("CJCMCG");
            }
            reg = reg.OpenSubKey("CJCMCG");
            string[] nm = reg.GetSubKeyNames();
            foreach (string s in nm)
            {
                ComboBoxItem item = new ComboBoxItem
                {
                    Uid     = s,
                    Content = s
                };
                pats.Items.Add(item);
            }
        }
Esempio n. 42
0
        /// <summary>
        /// Deserialize a Qsl Card saved as XML
        /// </summary>
        /// <param name="fileName">Name of XML file containing card description</param>
        /// <returns>Card object described by the XML file</returns>
        public static CardWF DeserializeCard(string fileName)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(CardWF));
            FileStream fs = new FileStream(fileName, FileMode.Open);
            XmlReader reader = XmlReader.Create(fs);

            CardWF card = (CardWF)serializer.Deserialize(reader);
            fs.Close();
            // set QslCard for each CardItem in card to this card
            card.BackgroundImage.QslCard = card;
            foreach(SecondaryWFImage si in card.SecondaryImages)
            {
                si.QslCard = card;
            }
            foreach(TextWFItem ti in card.TextItems)
            {
                ti.QslCard = card;
                System.Drawing.Text.InstalledFontCollection fontCol =
                    new System.Drawing.Text.InstalledFontCollection();
                // Must ensure that the font is installed. Otherwise card not displayed.
                string fontName = fontCol.Families[0].Name;
                foreach(System.Drawing.FontFamily family in fontCol.Families)
                {
                    if(family.Name == ti.TextFontFace)
                    {
                        fontName = ti.TextFontFace;
                        break;
                    }
                }
                ti.TextFontFace = fontName;
                foreach(TextPart part in ti.Text)
                {
                    part.RemoveExtraneousStaticTextMacros();
                }
            }
            if(card.QsosBox != null)
            {
                card.QsosBox.QslCard = card;
                foreach(TextPart part in card.QsosBox.ConfirmingText)
                {
                    part.RemoveExtraneousStaticTextMacros();
                }
            }
            // Must set default printer for card to system default printer if default
            // printer for card is not installed on computer. Otherwise, the card
            // will not display.
            System.Drawing.Printing.PrinterSettings settings = new
                System.Drawing.Printing.PrinterSettings();
            string printerName = settings.PrinterName;
            foreach(string printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
            {
                if(printer.Equals(card.CardPrintProperties.PrinterName))
                {
                    printerName = card.CardPrintProperties.PrinterName;
                    break;
                }
            }
            card.CardPrintProperties.PrinterName = printerName;
            return card;
        }
Esempio n. 43
0
        protected override void BeginProcessing()
        {
            base.BeginProcessing();
            OriginalPrinterName = PrintDocument.PrinterSettings.PrinterName;
            #region Select printer (and set any output file), paper size and orientation
            // The printer name paramter has been validated, if a bad one got in it would cause an error here (don't want to continue with the wrong printer so that's OK).
            // Paper size and font parameters have not been validated yet - check here and use defaults if invalid ones.
            // Could allow a Printer object instead of the name as a string (ditto paper size)
            //but these aren't piped in - it is not asking too much to say "pass the .Name property not the whole object"
            if (null != PrinterName)
            {
                PrintDocument.PrinterSettings.PrinterName = PrinterName;
            }
            string layoutMsg = string.Format("Printing to '{0}'", PrintDocument.PrinterSettings.PrinterName);
            if (null != Destination)
            {
                Destination = GetUnresolvedProviderPathFromPSPath(Destination);
                if (System.IO.File.Exists(Destination))
                {
                    System.IO.File.Delete(Destination);
                }
                PrintDocument.PrinterSettings.PrintToFile   = true;
                PrintDocument.PrinterSettings.PrintFileName = Destination;
                layoutMsg = layoutMsg + " (" + Destination + ")";
            }
            if (null != PaperSize)
            {
                var psize = from ps in PrintDocument.PrinterSettings.PaperSizes.Cast <PaperSize>().ToArray()
                            where string.Equals(ps.Kind.ToString(), PaperSize, StringComparison.CurrentCultureIgnoreCase)
                            select ps;
                if (psize.Count() == 0)
                {
                    WriteWarning(string.Format("{0} doesn't appear to be a valid paper size; will use the default:{1}.", PaperSize, PrintDocument.DefaultPageSettings.PaperSize.Kind));
                }
                else
                {
                    PrintDocument.DefaultPageSettings.PaperSize = psize.First();
                }
            }
            layoutMsg = layoutMsg + string.Format(". Paper is {0}", PrintDocument.DefaultPageSettings.PaperSize.Kind);
            if (LandScape)
            {
                PrintDocument.DefaultPageSettings.Landscape = true;
                WriteVerbose(layoutMsg + " landscape.");
            }
            else
            {
                PrintDocument.DefaultPageSettings.Landscape = false;
                WriteVerbose(layoutMsg + " portrait.");
            }
            #endregion
            #region Set page margins (if any were passed), checking minimum values
            //DefaultPageSettings includes hard margins but they are calculated from the known printable area and ints. Better to work off printable area,
            // area has X,Y of top left corner, width and height.  Min top/left margins set by X & Y;
            // min bottom is  paperHeight - Y - printable height ; min right margin is paperWdith - x - printable width
            //  if margin passed > min we set that, between zero and Min we set the min value, below zero tells us nothing was passed.
            PageSettings DefPS = PrintDocument.DefaultPageSettings;
            if (TopMargin > DefPS.PrintableArea.Y)
            {
                PrintDocument.DefaultPageSettings.Margins.Top = TopMargin;
            }
            else if (TopMargin >= 0)
            {
                PrintDocument.DefaultPageSettings.Margins.Top = Convert.ToInt32(DefPS.PrintableArea.Y);
            }
            if (DefPS.PrintableArea.Y + DefPS.PrintableArea.Height + BottomMargin > DefPS.PaperSize.Height)
            {
                PrintDocument.DefaultPageSettings.Margins.Bottom = BottomMargin;
            }
            else if (BottomMargin >= 0)
            {
                PrintDocument.DefaultPageSettings.Margins.Bottom = DefPS.PaperSize.Height - Convert.ToInt32(DefPS.PrintableArea.Y + DefPS.PrintableArea.Height);
            }
            if (LeftMargin > DefPS.PrintableArea.X)
            {
                PrintDocument.DefaultPageSettings.Margins.Left = LeftMargin;
            }
            else if (LeftMargin >= 0)
            {
                PrintDocument.DefaultPageSettings.Margins.Left = Convert.ToInt32(DefPS.PrintableArea.X);
            }
            if (DefPS.PrintableArea.X + DefPS.PrintableArea.Width + RightMargin > DefPS.PaperSize.Width)
            {
                PrintDocument.DefaultPageSettings.Margins.Right = RightMargin;
            }
            else if (RightMargin >= 0)
            {
                PrintDocument.DefaultPageSettings.Margins.Right = DefPS.PaperSize.Width - Convert.ToInt32(DefPS.PrintableArea.X + DefPS.PrintableArea.Width);
            }
            WriteVerbose(string.Format("Set margins to: top={0}, bottom={1}, left={2}, right={3}.", new object [] { DefPS.Margins.Top, DefPS.Margins.Bottom, DefPS.Margins.Left, DefPS.Margins.Right }));

            float WidthInHundreths  = DefPS.PaperSize.Width - DefPS.Margins.Left - DefPS.Margins.Right;
            float HeightInHundreths = DefPS.PaperSize.Height - DefPS.Margins.Top - DefPS.Margins.Bottom;
            #endregion
            #region Decide print job name - use file name if there is one and construct header/footers
            if (null != ImagePath)
            {
                PrintDocument.DocumentName = ImagePath;
            }
            else if (null != Path)
            {
                PrintDocument.DocumentName = Path;
                if (!String.IsNullOrEmpty(Header))
                {
                    Header = Header.Replace("&[Path]", Path, StringComparison.CurrentCultureIgnoreCase);
                }
                if (!String.IsNullOrEmpty(Footer))
                {
                    Footer = Footer.Replace("&[Path]", Path, StringComparison.CurrentCultureIgnoreCase);
                }
            }
            else
            {
                PrintDocument.DocumentName = "PowerShell Print Job";
            }
            Regex reg = new Regex("\\s*\\|\\s*(lp|Out-Printer).*$");
            if (!String.IsNullOrEmpty(Header))
            {
                Header = Header.Replace("&[Date]", System.DateTime.Now.ToString("d"), StringComparison.CurrentCultureIgnoreCase);
                Header = Header.Replace("&[Time]", System.DateTime.Now.ToString("t"), StringComparison.CurrentCultureIgnoreCase);
                Header = Header.Replace("&[Line]", reg.Replace(MyInvocation.Line, ""), StringComparison.CurrentCultureIgnoreCase);
                Header = Header.Replace("&[HistoryId]", MyInvocation.HistoryId.ToString(), StringComparison.CurrentCultureIgnoreCase);
            }
            if (!String.IsNullOrEmpty(Footer))
            {
                Footer = Footer.Replace("&[Date]", System.DateTime.Now.ToString("d"), StringComparison.CurrentCultureIgnoreCase);
                Footer = Footer.Replace("&[Time]", System.DateTime.Now.ToString("t"), StringComparison.CurrentCultureIgnoreCase);
                Footer = Footer.Replace("&[Line]", reg.Replace(MyInvocation.Line, ""), StringComparison.CurrentCultureIgnoreCase);
                Footer = Footer.Replace("&[HistoryId]", MyInvocation.HistoryId.ToString(), StringComparison.CurrentCultureIgnoreCase);
            }
            #endregion
            #region Check user-specificed font exists, or fall back to lucida console. Determine chars per line.
            System.Drawing.Text.InstalledFontCollection installedFonts = new System.Drawing.Text.InstalledFontCollection();
            var fontq = from font in installedFonts.Families where font.Name == FontName select font;
            if (fontq.Count() == 0)
            {
                WriteWarning(string.Format("'{0}' does not seem to be a valid font. Switching to default.", FontName));
                FontName = "Lucida Console";
            }
            installedFonts.Dispose();
            PrintFont = new Font(FontName, FontSize);

            //Page size is hundreths of an inch. Font is in points @ 120 points : 1 inch, so page width in points is 1.2 x width in Hundredths.
            WidthInChars = (int)Math.Truncate(WidthInHundreths * 1.2 / PrintFont.Size);
            //We won't text wrap if the regex is left empty.
            //Regex will treat end of line as $ and match either on a line of 1 to Width, or that number of chars -1  followed by space(s) or punctuation
            if (!NoTextWrapping)
            {
                string r = "(.{1,XXX}$)|".Replace("XXX", WidthInChars.ToString());
                r             = r + "(.{1,XXX}[\\s:;,.-?!…]+)(?=\\w+)".Replace("XXX", (WidthInChars - 1).ToString());
                WrappingRegEx = new Regex(r, RegexOptions.Multiline);
            }
            WriteVerbose(string.Format("Any text will be printed in {0} {1}-point. Print area is {2:N2} inches tall X {3:N2} inches wide = {4:N0} characters.", new object[] { PrintFont.Name, PrintFont.Size, (HeightInHundreths / 100), (WidthInHundreths / 100), WidthInChars }));
            #endregion
        }
		private void DialogHalloween_MouseClick( object sender, MouseEventArgs e ) {
			cursorPosition = new Point( e.X / zoomscale, e.Y / zoomscale );

			switch ( state ) {
				case 1:

					if ( trickButton.Contains( cursorPosition ) ) {

						state = 2;


						// initialize movement
						for ( int i = 0; i < 4; i++ ) {
							fairiesVector[i] = new RectangleF( rand.Next( canvas.Width - fairies[i].Width ), rand.Next( canvas.Height - fairies[i].Height ),
								(float)( ( rand.NextDouble() * 2.0 - 1.0 ) * 8.0 ), (float)( ( rand.NextDouble() * 2.0 - 1.0 ) * 8.0 ) );
						}


						// system font override
						var c = Utility.Configuration.Config;
						Font preservedfont_main = c.UI.MainFont;
						Font preservedfont_sub = c.UI.SubFont;

						string[] candidates = {
							"HGP創英角ポップ体",
							"ふい字P",
							"Segoe Script",
							"MS UI Gothic",
						  };
						string fontname = null;

						var fonts = new System.Drawing.Text.InstalledFontCollection();
						for ( int i = 0; i < candidates.Length; i++ ) {
							if ( fonts.Families.Count( f => f.Name == candidates[i] ) > 0 ) {
								fontname = candidates[i];
								break;
							}

						}
						if ( fontname == null )
							break;

						c.UI.MainFont = new Font( fontname, 12, FontStyle.Regular, GraphicsUnit.Pixel );
						c.UI.SubFont = new Font( fontname, 10, FontStyle.Regular, GraphicsUnit.Pixel );

						Utility.Configuration.Instance.OnConfigurationChanged();

						c.UI.MainFont = preservedfont_main;
						c.UI.SubFont = preservedfont_sub;

					} else if ( treatButton.Contains( cursorPosition ) ) {
						state = 3;
					}

					break;

			}
		}
Esempio n. 45
0
        static void Main(string[] args)
        {
            UtilsDLL.ThreeJS.convert_from_obj_to_js(@"C:\Temp\hope2.obj", @"C:\Temp\yalla2.js");
            System.Drawing.Text.InstalledFontCollection col = new System.Drawing.Text.InstalledFontCollection();
            FontFamily[] ff = col.Families;
            UtilsDLL.Dirs.get_all_relevant_dirs();
            Dictionary<String,bool> paramNames;
            Dictionary<String,Object> resDist = new Dictionary<string,object>();
            bool check1 = UtilsDLL.Rhino.Adjust_GHX_file(@"C:\Users\Administrator\Downloads\Fudged-Vorg-Test.ghx", @"C:\Users\Administrator\Downloads\Fudged-Vorg-Test_adj.ghx", resDist, new List<String>());
            return;
            bool paramsRes = UtilsDLL.Rhino.Get_All_Parameters_From_GHX_file(@"C:\Temp\t13.ghx", out paramNames);
            return;

            //String filePath = @"C:\Temp\iPhone_Lui16_base.ghx";
            String filePath = @"C:\Temp\test22.ghx";
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(filePath);
            XmlNode root = xmlDoc.DocumentElement;

            //title[@lang='eng']	Selects all the title elements that have an attribute named lang with a value of 'eng'
            XmlNodeList objList = root.SelectNodes("//chunk[@name='Object']");

            foreach (XmlNode gh_obj in objList)
            {
                XmlNode node = gh_obj.SelectSingleNode("items/item[@name='Name']");
                if (node == null) continue;
                String nodeType = node.InnerText;

                bool isSlider = (nodeType == "Number Slider");
                if (isSlider)
                {
                    XmlNode attsNode = gh_obj.SelectSingleNode("chunks/chunk/chunks/chunk[@name='Slider']");

                    XmlNodeList attList = attsNode.SelectNodes("items/item");
                    Dictionary<String, Object> attsDict = new Dictionary<string, object>();
                    foreach (XmlNode attNode in attList)
                    {
                        String attName = attNode.Attributes["name"].Value;
                        String attValue = attNode.InnerText;
                        attsDict[attName] = attValue;
                        if (attName == "Description")
                        {
                            String newName = "ThingsMaker :  " + attValue;
                            attNode.InnerText = newName;
                        }
                        if (attName == "NickName")
                        {
                            String newName = "AUTO_" + attValue;
                            attNode.InnerText = newName;
                        }

                    }

                    String paramGUID = String.Empty, paramType = String.Empty;

                    int sliderType = int.Parse((String)(attsDict["Interval"]));

                    switch (sliderType)
                    {
                        case 0: // float slider
                            paramGUID = "3e8ca6be-fda8-4aaf-b5c0-3c54c8bb7312";
                            paramType = "Number";
                            break;
                        case 1: // integer slider
                        case 2: // odds slider
                        case 3: // evens slider
                            paramGUID = "2e3ab970-8545-46bb-836c-1c11e5610bce";
                            paramType = "Integer";
                            break;
                    }

                    XmlNode GUID_node = gh_obj.SelectSingleNode("items/item[@name='GUID']");
                    GUID_node.InnerText = paramGUID;

                    XmlNode Name_node = gh_obj.SelectSingleNode("items/item[@name='Name']");
                    Name_node.InnerText = paramType;

                    Name_node = gh_obj.SelectSingleNode("chunks/chunk/items/item[@name='Name']");
                    Name_node.InnerText = paramType;

                    XmlNode descriptionNode = gh_obj.SelectSingleNode("chunks/chunk/items/item[@name='Description']");
                    String newDescription = "Thingsmaker replacing (" + descriptionNode.InnerText + ")";
                    descriptionNode.InnerText = newDescription;

                    XmlNode nickNameNode = gh_obj.SelectSingleNode("chunks/chunk/items/item[@name='NickName']");
                    String newNickName = "AUTO_" + nickNameNode.InnerText;
                    nickNameNode.InnerText = newNickName;
                }
            }

            xmlDoc.Save(@"C:\Temp\test_99.ghx");

            return;

            /*
            // kill all current Rhino4.exe processes
            Process[] procs = Process.GetProcessesByName("Rhino4");
            Console.WriteLine("Killing " + procs.Length + " previous Rhino processes");
            foreach (Process p in procs) { p.Kill(); }
            Thread.Sleep(1000);
            procs = Process.GetProcessesByName("Rhino4");
            Console.WriteLine(procs.Length + " previous Rhino processes remaind alive");

            Rhino5Application rhino_app = new Rhino5Application();
            rhino_app.Visible = 1;
            rhino_app.RunScript("_Grasshopper", 0);
            dynamic grasshopper = rhino_app.GetPlugInObject("b45a29b1-4343-4035-989e-044e8580d9cf", "00000000-0000-0000-0000-000000000000") as dynamic;
            grasshopper.OpenDocument(@"C:\inetpub\ftproot\Rendering_Data\GH_Def_files\test_str.gh");
            bool res = grasshopper.AssignDataToParameter("Str", "sababa");

            return;

            */
            UtilsDLL.Rhino.Rhino_Wrapper rhino_wrapper = null;

            if (!UtilsDLL.Rhino.start_a_SingleRhino("cases.3dm", true, out rhino_wrapper))
            {
                Console.WriteLine("Basa");
                return;
            }

            Grasshopper.Kernel.GH_DocumentIO io = new Grasshopper.Kernel.GH_DocumentIO();
            bool openRes = io.Open(@"C:\inetpub\ftproot\Rendering_Data\GH_Def_files\iPhone_txt_tst.gh");

            return;

            String[] allScenes = { "cases.3dm", "rings.3dm", "vases.3dm" };

            String basicPath = @"C:\inetpub\ftproot\empty_images_comparer";
            foreach (String scene_key in allScenes)
            {
                String scenePath = basicPath + Path.DirectorySeparatorChar + scene_key;
                if (!Directory.Exists(scenePath)) Directory.CreateDirectory(scenePath);
                if (!UtilsDLL.Rhino.start_a_SingleRhino(scene_key, true, out rhino_wrapper))
                {
                    Console.WriteLine("Basa");
                    return;
                }

                int height = 180;
                String size_key = height + "_" + height;
                String sizePath = scenePath + Path.DirectorySeparatorChar + size_key;
                if (!Directory.Exists(sizePath)) Directory.CreateDirectory(sizePath);

                String onlyView = "Render";
                String viewPath = sizePath + Path.DirectorySeparatorChar + onlyView;
                if (!Directory.Exists(viewPath)) Directory.CreateDirectory(viewPath);

                String fullPath = viewPath + Path.DirectorySeparatorChar+ @"empty.jpg";
                bool res_4 = UtilsDLL.Rhino.Render(rhino_wrapper, new System.Drawing.Size(height, height), fullPath);

                height = 350;
                size_key = height + "_" + height;
                sizePath = scenePath + Path.DirectorySeparatorChar + size_key;
                if (!Directory.Exists(sizePath)) Directory.CreateDirectory(sizePath);
                String[] allViews = { "Render", "Top", "Front" };
                foreach (String view_key in allViews)
                {
                    viewPath = sizePath + Path.DirectorySeparatorChar + view_key;
                    if (!Directory.Exists(viewPath)) Directory.CreateDirectory(viewPath);
                    fullPath = viewPath + Path.DirectorySeparatorChar + @"empty.jpg";
                    res_4 = UtilsDLL.Rhino.Render(rhino_wrapper, new System.Drawing.Size(height, height), fullPath);
                }
            }

            Dictionary<String, Object> dic = new Dictionary<string,object>();

            for (int i = 0; i < 4; i++)
            {
                dic["par1"] = 5 - i;
                dic["par2"] = 2 + i;

            bool res1 = UtilsDLL.Rhino.Set_GH_Params_To_TXT_File(rhino_wrapper, dic);

            bool res2 = UtilsDLL.Rhino.Open_GH_File(rhino_wrapper, UtilsDLL.Dirs.GH_DirPath + "/iPhone-frames-trial-release.gh");

            bool res3 = UtilsDLL.Rhino.Solve_GH(rhino_wrapper);

            bool res35 = UtilsDLL.Rhino.Bake_GH(rhino_wrapper, "Bakery");

            bool res4 = UtilsDLL.Rhino.Render(rhino_wrapper, new System.Drawing.Size(200, 200), @"C:\Temp\hope_" + i +".jpg");

            }
            //            grasshopper.RunSolver(true);

            //            Object objRes = grasshopper.BakeDataInObject("G");

            /*
            UtilsDLL.Dirs.get_all_relevant_dirs();

            UtilsDLL.Rhino.Rhino_Wrapper wrapper;

            // kill all current Rhino4.exe processes
            Process[] procs = Process.GetProcessesByName("Rhino4");
            Console.WriteLine("Killing " + procs.Length + " previous Rhino processes");
            foreach (Process p in procs) { p.Kill(); }
            Thread.Sleep(1000);
            procs = Process.GetProcessesByName("Rhino4");
            Console.WriteLine(procs.Length + " previous Rhino processes remaind alive");

            bool createRes = UtilsDLL.Rhino.start_a_SingleRhino("rings.3dm", true, out wrapper);

            bool loadRes = UtilsDLL.Rhino.Open_GH_File(wrapper, @"C:\inetpub\ftproot\Rendering_Data\GH_Def_files\test1.ghx");

            Dictionary<String,Object> dict = new Dictionary<string,object>();
            dict["4e459553-8255-4da2-915f-ebd9ee1c192b"] = 0.4;
            bool changeRes = UtilsDLL.Rhino.Set_GH_Params(wrapper,"M",dict);

            //UtilsDLL.Rhino.b
             */
        }
Esempio n. 46
0
        private void SettingForm_Load(object sender, EventArgs e)
        {
            // �t�H���g�ꗗ�̓ǂݍ���
            fontNameInputBox.Items.Clear();
            using (System.Drawing.Text.InstalledFontCollection ifc = new System.Drawing.Text.InstalledFontCollection())
            {
                foreach (FontFamily ff in ifc.Families)
                {
                    fontNameInputBox.Items.Add(ff.Name);
                    ff.Dispose();
                }
            }

            // �ݒ��ǂݍ���
            m_editingProfiles = (ConnectionProfileCollection)SettingManager.Data.Profiles.Clone();
            ReloadProfileList();
            fontNameInputBox.Text = SettingManager.Data.FontName;
            fontSizeComboBox.Text = SettingManager.Data.FontSize.ToString();
            visibleTopicPanelCheckbox.Checked = SettingManager.Data.TopicVisible;
            defaultLoadOnConnectCheckBox.Checked = SettingManager.Data.SelectChannelAtConnect;

            if (SettingManager.Data.VerticalKeyOperation == 5)
            {
                verticalKeySelectBox.SelectedIndex = 0;
            }
            else
            {
                verticalKeySelectBox.SelectedIndex = SettingManager.Data.VerticalKeyOperation + 1;
            }
            horizontalKeySelectBox.SelectedIndex = SettingManager.Data.HorizontalKeyOperation;
            ctrlVerticalKeySelectBox.SelectedIndex = SettingManager.Data.VerticalKeyWithCtrlOperation;
            ctrlHorizontalKeySelectBox.SelectedIndex = SettingManager.Data.HorizontalKeyWithCtrlOperation;

            subNicknameInputBox.Text = string.Join("\r\n", SettingManager.Data.SubNicknames);
            confimDisconnectCheckBox.Checked = SettingManager.Data.ConfimDisconnect;
            confimExitCheckBox.Checked = SettingManager.Data.ConfimExit;
            cacheConnectionCheckBox.Checked = SettingManager.Data.CacheConnection;
            reverseSoftKeyCheckBox.Checked = SettingManager.Data.ReverseSoftKey;
            scrollLinesTextBox.Text = SettingManager.Data.ScrollLines.ToString();
            forcePongCheckBox.Checked = SettingManager.Data.ForcePong;
            highlightWordsTextBox.Text = string.Join("\r\n", SettingManager.Data.HighlightKeywords);
            highlightUseRegexCheckbox.Checked = SettingManager.Data.UseRegexHighlight;
            highlightMethodComboBox.SelectedIndex = (int)SettingManager.Data.HighlightMethod;
            highlightChannelCheckBox.Checked = SettingManager.Data.HighlightChannelChange;
            highlightToastCheckBox.Checked = SettingManager.Data.HighlightToast;
            dislikeWordsTextBox.Text = string.Join("\r\n", SettingManager.Data.DislikeKeywords);
            dislikeUseRegexCheckBox.Checked = SettingManager.Data.UseRegexDislike;
            enableLoggingCheckBox.Checked = SettingManager.Data.LogingEnable;
            logDirectoryNameTextBox.Text = SettingManager.Data.LogDirectory;
            qsSortHighlightedCheckBox.Checked = SettingManager.Data.QuickSwitchHilightsSort;
            qsSortUnreadCheckBox.Checked = SettingManager.Data.QuickSwitchUnreadCountSort;
            multiMenuFunctionComboBox.SelectedIndex = (int)SettingManager.Data.MultiMenuOperation;
        }
Esempio n. 47
0
 public override Int64 GetIntValue(ExpressionMediator exm, IOperandTerm[] arguments)
 {
     string str = arguments[0].GetStrValue(exm);
     System.Drawing.Text.InstalledFontCollection ifc = new System.Drawing.Text.InstalledFontCollection();
     Int64 isInstalled = 0;
     foreach (System.Drawing.FontFamily ff in ifc.Families)
     {
         if (ff.Name == str)
         {
             isInstalled = 1;
             break;
         }
     }
     return (isInstalled);
 }
Esempio n. 48
0
        static void Main(string[] args)
        {
            Console.WriteLine("Celones SmartLED Display Manager");

            // Simulation initialization
            if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows))
            {
                System.Windows.Forms.Application.EnableVisualStyles();
                var ctl = new Simulation.Nokia5110Lcd();
                var sim = new Simulation.ControlPanel();

                Console.WriteLine("Simulator for Windows");
                Thread thread = new Thread((object form) => System.Windows.Forms.Application.Run((System.Windows.Forms.Form)form));
                thread.SetApartmentState(ApartmentState.STA);
                thread.IsBackground = false;
                thread.Start(sim);

                Lcd = new LcdScreen(new Device.Pcd8544(ctl, ctl, ctl));
                Lcd.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
                ButtonA = sim.aButton;
                ButtonB = sim.bButton;
                ButtonC = sim.cButton;
                ButtonD = sim.dButton;

                sim.screenImage.Image     = ctl.Image;
                sim.screenImage.BackColor = Color.CadetBlue;
            }

            // Hardware initialization
            else
            {
                Pi.Init <BootstrapWiringPi>();
                Pins.Init();
                Console.WriteLine(Pi.Info.ToString());

                Lcd     = new LcdScreen(new Device.Pcd8544(Pi.Spi.Channel0, Pins.LcdReset, Pins.LcdDc), (GpioPin)Pins.LcdBacklight);
                ButtonA = new Button(Pins.ButtonA);
                ButtonB = new Button(Pins.ButtonB);
                ButtonC = new Button(Pins.ButtonC);
                ButtonD = new Button(Pins.ButtonD);
            }

            ButtonA.Pressed += ButtonA_Pressed;

            Lcd.Init();
            Lcd.Clear();
            for (double brightness = 0.0; brightness <= 1.0; brightness += 0.1)
            {
                Lcd.Brightness = brightness;
                Lcd.Contrast   = brightness;
                Thread.Sleep(50);
            }

            // Graphics demo
            var pen   = new Pen(Color.Black);
            var brush = new SolidBrush(Color.Black);

            Lcd.Clear();
            Lcd.Graphics.DrawRectangle(pen, new Rectangle(0, 0, Lcd.Width - 1, Lcd.Height - 1));
            Lcd.Update();

            for (int i = 1; i <= 6; i++)
            {
                pen.Width = i;
                Lcd.Graphics.DrawLine(pen, new Point(i * 10, 5), new Point(i * 10, 20));
                Lcd.Graphics.DrawLine(pen, new Point(i * 10, 5), new Point(i * 10 - 5, 10));
                Lcd.Update();
                Thread.Sleep(750);
            }

            Lcd.Graphics.FillRectangle(brush, new Rectangle(0, Lcd.Height / 2, Lcd.Width, Lcd.Height / 2));

            pen.Color = Color.White;
            for (int i = 1; i <= 6; i++)
            {
                pen.Width = i;
                Lcd.Graphics.DrawLine(pen, new Point(i * 10, 30), new Point(i * 10, 45));
                Lcd.Graphics.DrawLine(pen, new Point(i * 10, 30), new Point(i * 10 - 5, 35));
                Lcd.Update();
                Thread.Sleep(750);
            }

            // Font demo
            var fonts = new System.Drawing.Text.InstalledFontCollection();

            fonts.Families
            .Where(family => family.IsStyleAvailable(FontStyle.Regular))
            .OrderBy(family => family.Name)
            .ToList().ForEach(family => {
                var font = new Font(family, 8);
                Lcd.Clear();
                Lcd.Graphics.DrawString(family.Name, font, brush, new RectangleF(0, 0, Lcd.Width, Lcd.Height));
                Lcd.Update();
                Thread.Sleep(1500);
            });

            // Menu demo
            var ui = new ONUI.UI(AssemblyDirectory + "/Assets/MainMenu.xaml");

            ui.Display    = Lcd;
            ui.BackButton = ButtonA;
            ui.OkButton   = ButtonB;
            ui.DownButton = ButtonC;
            ui.UpButton   = ButtonD;
            ui.Show();
        }
Esempio n. 49
0
        private void DialogHalloween_MouseClick(object sender, MouseEventArgs e)
        {
            cursorPosition = new Point(e.X / zoomscale, e.Y / zoomscale);

            switch (state)
            {
            case 1:

                if (trickButton.Contains(cursorPosition))
                {
                    state = 2;


                    // initialize movement
                    for (int i = 0; i < 4; i++)
                    {
                        fairiesVector[i] = new RectangleF(rand.Next(canvas.Width - fairies[i].Width), rand.Next(canvas.Height - fairies[i].Height),
                                                          (float)((rand.NextDouble() * 2.0 - 1.0) * 8.0), (float)((rand.NextDouble() * 2.0 - 1.0) * 8.0));
                    }


                    // system font override
                    var  c = Utility.Configuration.Config;
                    Font preservedfont_main = c.UI.MainFont;
                    Font preservedfont_sub  = c.UI.SubFont;

                    string[] candidates =
                    {
                        "HGP創英角ポップ体",
                        "ふい字P",
                        "Segoe Script",
                        "MS UI Gothic",
                    };
                    string fontname = null;

                    var fonts = new System.Drawing.Text.InstalledFontCollection();
                    for (int i = 0; i < candidates.Length; i++)
                    {
                        if (fonts.Families.Count(f => f.Name == candidates[i]) > 0)
                        {
                            fontname = candidates[i];
                            break;
                        }
                    }
                    if (fontname == null)
                    {
                        break;
                    }

                    c.UI.MainFont = new Font(fontname, 12, FontStyle.Regular, GraphicsUnit.Pixel);
                    c.UI.SubFont  = new Font(fontname, 10, FontStyle.Regular, GraphicsUnit.Pixel);

                    Utility.Configuration.Instance.OnConfigurationChanged();

                    c.UI.MainFont = preservedfont_main;
                    c.UI.SubFont  = preservedfont_sub;
                }
                else if (treatButton.Contains(cursorPosition))
                {
                    state = 3;
                }

                break;
            }
        }
Esempio n. 50
0
        private Font CreateMonospacedFont()
        {
            string familyName = "Courier New";

            using (System.Drawing.Text.InstalledFontCollection fontCollection =
                new System.Drawing.Text.InstalledFontCollection())
            {
                foreach (FontFamily fontFamily in fontCollection.Families)
                {
                    if (fontFamily.Name == "Consolas")
                    {
                        familyName = "Consolas";
                        break;
                    }
                }
            }

            return new Font(familyName, 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
        }
Esempio n. 51
0
        private void Form_Notification_Load(object sender, EventArgs e)
        {
            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
            foreach (FontFamily font in fonts.Families)
            {
                cB_font.Items.Add(font.Name);
            }
            cB_font.SelectedItem  = "Open Sans";
            cB_font.SelectedIndex = 0;

            cB_an_name.Items.AddRange(new object[] {
                "",
                "bounce",
                "flash",
                "pulse",
                "rubberBand",
                "shake",
                "headShake",
                "swing",
                "tada",
                "wobble",
                "jello"
            });
            cB_an_in.Items.AddRange(new object[] {
                "bounceIn",
                "bounceInDown",
                "bounceInLeft",
                "bounceInRight",
                "bounceInUp",
                "fadeIn",
                "fadeInDown",
                "fadeInDownBig",
                "fadeInLeft",
                "fadeInLeftBig",
                "fadeInRight",
                "fadeInRightBig",
                "fadeInUp",
                "fadeInUpBig",
                "flipInX",
                "flipInY",
                "lightSpeedIn",
                "rotateIn",
                "rotateInDownLeft",
                "rotateInDownRight",
                "rotateInUpLeft",
                "rotateInUpRight",
                "hinge",
                "rollIn",
                "zoomIn",
                "zoomInDown",
                "zoomInLeft",
                "zoomInRight",
                "zoomInUp",
                "slideInDown",
                "slideInLeft",
                "slideInRight",
                "slideInUp"
            });
            cB_an_out.Items.AddRange(new object[] {
                "bounceOut",
                "bounceOutDown",
                "bounceOutLeft",
                "bounceOutRight",
                "bounceOutUp",
                "fadeOut",
                "fadeOutDown",
                "fadeOutDownBig",
                "fadeOutLeft",
                "fadeOutLeftBig",
                "fadeOutRight",
                "fadeOutRightBig",
                "fadeOutUp",
                "fadeOutUpBig",
                "flipOutX",
                "flipOutY",
                "lightSpeedOut",
                "rotateOut",
                "rotateOutDownLeft",
                "rotateOutDownRight",
                "rotateOutUpLeft",
                "rotateOutUpRight",
                "hinge",
                "rollOut",
                "zoomOut",
                "zoomOutDown",
                "zoomOutLeft",
                "zoomOutRight",
                "zoomOutUp",
                "slideOutDown",
                "slideOutLeft",
                "slideOutRight",
                "slideOutUp"
            });
            cB_an_name.SelectedItem = "flash";
            cB_an_in.SelectedItem   = "fadeInDown";
            cB_an_out.SelectedItem  = "fadeOutUp";

            cB_align.Items.AddRange(new object[] {
                "center",
                "justify",
                "left",
                "right"
            });
            cB_align.SelectedItem = "center";
        }
        private static int BEEPFREQUENCY = 800; // Hz

        #endregion Fields

        #region Constructors

        public UserPreferencesDialog()
        {
            InitializeComponent();
            printPropertiesPanel.printerPropertiesGroupBox.Header = "Default Printer Properties";
            printPropertiesPanel.printPropertiesGroupBox.Header = "Default Print Properties";
            printPropertiesPanel.cardsLayoutGroupBox.Visibility = Visibility.Collapsed;
            printPropertiesPanel.PrintPropertiesChanged += OnPrintPropertiesChanged;
            Mouse.OverrideCursor = Cursors.Arrow;
            // create a clone of the UserPreferences object
            UserPrefs = new UserPreferences(((App)Application.Current).UserPreferences);
            propertiesDisplay.DataContext = UserPrefs;
            if(UserPrefs.Callsign.Count == 1 && UserPrefs.Callsign[0].GetType() == typeof(StaticText))
            {
                CallsignTextBox.DataContext = (StaticText)UserPrefs.Callsign[0];
            }
            else
            {
                CallsignTextBox.Visibility = Visibility.Collapsed;
            }
            if(UserPrefs.NameQth.Count == 1 && UserPrefs.NameQth[0].GetType() == typeof(StaticText))
            {
                NameQthTextBox.DataContext = (StaticText)UserPrefs.NameQth[0];
            }
            else
            {
                NameQthTextBox.Visibility = Visibility.Collapsed;
            }
            if(UserPrefs.Salutation.Count == 1 && UserPrefs.Salutation[0].GetType() == typeof(StaticText))
            {
                SalutationTextBox.DataContext = (StaticText)UserPrefs.Salutation[0];
            }
            else
            {
                SalutationTextBox.Visibility = Visibility.Collapsed;
            }
            if(UserPrefs.ConfirmingText.Count == 1 &&
               UserPrefs.ConfirmingText[0].GetType() == typeof(StaticText))
            {
                ConfirmingTextBox.DataContext = (StaticText)UserPrefs.ConfirmingText[0];
            }
            else
            {
                ConfirmingTextBox.Visibility = Visibility.Collapsed;
            }
            // load list of font names that are available to Windows Forms
            System.Drawing.Text.InstalledFontCollection fontCol =
                new System.Drawing.Text.InstalledFontCollection();
            foreach(System.Drawing.FontFamily family in fontCol.Families)
            {
                DefaultTextItemsFontFaceComboBox.Items.Add(family.Name);
                DefaultQsosBoxFontFaceComboBox.Items.Add(family.Name);
            }
        }