Exemple #1
0
        private void SetupUi()
        {
            Icon = Icon.FromHandle(Resources.image.GetHicon());

            if (selectMode)
            {
                Text = "Sélectionnez une image";
            }

            try {
                layoutPanel.Controls.Clear();

                var node = new ResXResourceReader("resources.resx").GetEnumerator();

                while (node.MoveNext())
                {
                    var pictureBox = new PictureBox {
                        Image    = (Bitmap)node.Value,
                        Tag      = node.Key.ToString(),
                        SizeMode = PictureBoxSizeMode.StretchImage,
                        Size     = new Size(75, 75)
                    };
                    pictureBox.MouseClick += new MouseEventHandler(pictureBoxes_MouseClick);

                    if (selectMode)
                    {
                        pictureBox.Cursor = Cursors.Hand;
                    }

                    layoutPanel.Controls.Add(pictureBox);
                }
            } catch (Exception e) {
                Console.WriteLine("Error reading resources: " + e);
            }
        }
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            Debugger.Launch();
            Console.WriteLine("yo");

            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

            var resources = new ResXResourceReader("test.resx").GetEnumerator();

            while (resources.MoveNext())
            {
                Console.WriteLine($"{resources.Key}: type={resources.Value.GetType()}, value=\"{resources.Value.ToString()}\"");
            }
        }