Franken_.App_Code.Font.FindGlyph C# (CSharp) Method

FindGlyph() public method

public FindGlyph ( string Unicode ) : int
Unicode string
return int
        public int FindGlyph(string Unicode)
        {
            int Index = -1;

            for (int x = 0; x < Glyphs.Count; x++)
            {
                if (Glyphs[x].Unicode.Trim() == Unicode.Trim())
                {
                    Index = x;
                    break;
                }
            }

            return Index;
        }

Usage Example

コード例 #1
0
        private void RefreshCharList()
        {
            if (SelectedGlyph > -1)
            {
                myFont.Glyphs[SelectedGlyph].Save(false);
            }

            imagePanel.Controls.Clear();

            if (myFont != null)
            {
                SelectedGlyph = myFont.FindGlyph(((App_Code.Glyph)glyphBox.SelectedItem).Unicode);

                displaySizeBar.Enabled   = true;
                remAllButton.Enabled     = true;
                reclassifyButton.Enabled = true;
                clipboardButton.Enabled  = true;
                delGlyphButton.Enabled   = true;
                CheckPagingValues();

                if (SelectedGlyph > -1)
                {
                    xOffsetBox.Value = System.Convert.ToDecimal(myFont.Glyphs[SelectedGlyph].XOffset);
                    yOffsetBox.Value = System.Convert.ToDecimal(myFont.Glyphs[SelectedGlyph].YOffset);

                    for (int x = PageStart; x < PageStop; x++)
                    {
                        Button B = new Button();
                        B.Name = myFont.Glyphs[SelectedGlyph].Images[x].ID;

                        if (File.Exists(db.DataDirectory + myFont.Glyphs[SelectedGlyph].Images[x].Path))
                        {
                            using (FileStream stream = new FileStream(db.DataDirectory + myFont.Glyphs[SelectedGlyph].Images[x].Path, FileMode.Open, FileAccess.Read))
                            {
                                B.Image = Image.FromStream(stream);
                            }

                            B.Height = DisplaySize;
                            B.Width  = DisplaySize;


                            if (myFont.Glyphs[SelectedGlyph].Images[x].Status == "REM")
                            {
                                B.BackColor = Color.Red;
                                B.ForeColor = Color.Red;
                            }

                            B.ContextMenuStrip = imageContextMenu;
                            B.Click           += imageButton_Click;
                            //B.MouseUp += B_MouseClick;
                            imagePanel.Controls.Add(B);
                        }
                    }
                }
            }
        }