예제 #1
0
        //Use r on Capture. Use image on Open.
        void _SetImage(WICResult r = null, Bitmap image = null)
        {
            if (r != null)              //on Capture
            {
                var wnd = r.wnd.Window; if (wnd.Is0)
                {
                    return;
                }
                _SetWndCon(wnd, r.wnd, true, false);
                if (_isColor = (r.image == null))
                {
                    using (var g = Graphics.FromImage(r.image = new Bitmap(16, 16))) g.Clear((Color)r.color);
                }
                _color = r.color.color & 0xffffff;
                _image = r.image;
                _rect  = r.rect;
            }
            else                 //on Open
            {
                _color = 0;
                _image = image;
                _rect  = new RECT(0, 0, image.Width, image.Height);
            }

            //set _pict
            var oldImage = _pict.Image;

            _pict.Image = _image;
            oldImage?.Dispose();

            //set _code
            _FormatCode();

            _bTest.Enabled = true; _bOK.Enabled = true;

            if (_MultiIsActive && ADialog.ShowYesNo("Add to array?", owner: this))
            {
                _MultiAdd();
            }

            _errorProvider.Clear();
        }
예제 #2
0
partial class Script : AScript { [STAThread] static void Main(string[] a) => new Script(a); Script(string[] args)   //;;;
//Click the ► button on the toolbar to run the script.

                                 {
                                     AOutput.Write("The programming language is C#.");
                                     if (ADialog.ShowYesNo("Run Notepad?", "The script will add some text and close Notepad after 2 s."))
                                     {
                                         AExec.Run(AFolders.System + @"Notepad.exe");
                                         var w = AWnd.Wait(5, active: true, "*- Notepad"); //to create this code can be used the Code menu
                                         50.ms();
                                         AKeys.Text("some text");
                                         2.s();
                                         AKeys.Key("Ctrl+Z"); //Undo
                                         w.Close();
                                     }

                                     string linkText = "Read about code editor features",
                                            linkUrl  = "https://www.quickmacros.com/au/help/editor/Code editor.html";

                                     AOutput.Write($"<><link \"{linkUrl}\">{linkText}</link>");
                                 }