Beispiel #1
0
        /// <summary>
        /// Capture loop
        /// </summary>

        private void Capt()
        {
            do
            {
                Thread.Sleep(1000);
                if (Variables.Proc != null)
                {
                    if (Variables.Proc.HasExited)
                    {
                        Variables.Proc = null;
                        Docked         = false;
                        continue;
                    }
                    if (Variables.emulator.EmulatorName() == "Nox")
                    {
                        var hide = DllImport.GetAllChildrenWindowHandles(IntPtr.Zero, "Qt5QWindowToolSaveBits", "Form", 2);
                        foreach (var h in hide)
                        {
                            DllImport.ShowWindow(h, 0);
                        }
                    }
                    try
                    {
                        var       handle = Variables.Proc.MainWindowHandle;
                        var       parent = DllImport.GetParent(handle);
                        Rectangle rect   = new Rectangle();
                        DllImport.GetWindowRect(handle, ref rect);
                        if (!Docked)
                        {
                            if (!ScriptRun.Run)
                            {
                                return;
                            }
                            PrivateVariable.EmuDefaultLocation = rect;
                            panel3.Invoke((MethodInvoker) delegate
                            {
                                DllImport.SetParent(Variables.Proc.MainWindowHandle, panel3.Handle);
                            });
                            tp.Invoke((MethodInvoker) delegate { tp.BringToFront(); });
                            Docked = true;
                        }
                        if (rect.X != -1 || rect.Y != -30)
                        {
                            DllImport.MoveWindow(handle, -1, -30, 1318, 752, false);
                        }
                    }
                    catch
                    {
                    }
                }
                else
                {
                    Docked = false;
                }
            } while (ScriptRun.Run);
        }
        public MetadataSummaryControl()
        {
            InitializeComponent();

            _transparentPanel = new TransparentPanel();
            _transparentPanel.Dock = DockStyle.Fill;

            this.Controls.Add(_transparentPanel);
            _transparentPanel.BringToFront();
        }
 public FullscreenPlayer(Control player)
     : this()
 {
     this.parent = player.Parent;
     this.player = player;
     this.Controls.Add(player);
     var tp = new TransparentPanel();
     tp.Dock = DockStyle.Fill;
     tp.DoubleClick += new EventHandler(transparentPanel_DoubleClick);
     this.Controls.Add(tp);
     tp.BringToFront();
 }
Beispiel #4
0
        /// <summary>
        /// Capture loop
        /// </summary>

        private void Capt()
        {
            bool Docked = false;

            do
            {
                Thread.Sleep(2000);
                if (Variables.Proc != null)
                {
                    if (Variables.Proc.HasExited)
                    {
                        Variables.Proc = null;
                        Docked         = false;
                        continue;
                    }
                    try
                    {
                        var       handle = Variables.Proc.MainWindowHandle;
                        Rectangle rect   = new Rectangle();
                        DllImport.GetWindowRect(handle, ref rect);
                        if (!Docked)
                        {
                            if (!ScriptRun.Run)
                            {
                                return;
                            }
                            PrivateVariable.Instance.EmuDefaultLocation = rect;
                            panel3.Invoke((MethodInvoker) delegate
                            {
                                DllImport.SetParent(Variables.Proc.MainWindowHandle, panel3.Handle);
                            });
                            tp.Invoke((MethodInvoker) delegate { tp.BringToFront(); });
                            panel3.Invoke((MethodInvoker) delegate
                            {
                                DllImport.SetParent(Variables.Proc.MainWindowHandle, panel3.Handle);
                            });
                            Docked = true;
                        }
                        if (rect.X != -1 || rect.Y != -30)
                        {
                            DllImport.MoveWindow(handle, -1, -30, 1318, 752, false);
                        }
                    }
                    catch
                    {
                    }
                }
                else
                {
                    Docked = false;
                }
            } while (ScriptRun.Run);
        }
    public Form1()
    {
        InitializeComponent();
        TransparentPanel panel = new TransparentPanel()
        {
            Location = dateTimePicker1.Location,
            Size     = dateTimePicker1.Size,
        };

        this.Controls.Add(panel);
        panel.DoubleClick += Panel_DoubleClick;
        panel.BringToFront();
    }
        /// <summary>
        /// Shows a notification on the form.
        /// </summary>
        /// <param name="form">The form to display the notification.</param>
        /// <param name="message">The message (notification) that should be displayed.</param>
        /// <param name="duration">The duration of the notification (specify -1 for infinite).</param>
        /// <param name="opacity">The opacity of the background (0..1).</param>
        /// <param name="glowColor">The glow color of the message rectangle.</param>
        /// <param name="backColor">The background color of the message rectangle.</param>
        /// <param name="foreColor">The text color of the message.</param>
        /// <returns>Control.</returns>
        public static Control Notify(this Form form, string message, int duration, double opacity, Color glowColor, Color backColor, Color foreColor)
        {
            var font         = new Font(form.Font.FontFamily, form.Font.Size * 1.2f, form.Font.Unit);
            var proposedSize = new Size(form.Width * 6 / 10, 0);
            var size         = TextRenderer.MeasureText(message, font, proposedSize, TextFormatFlags.WordBreak);
            var panel        = new TransparentPanel();

            panel.Size     = form.ClientRectangle.Size;
            panel.Location = new Point(0, 0);
            panel.Anchor   = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
            panel.Paint   += (sender, e) =>
            {
                var g = e.Graphics;
                e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb((int)Math.Ceiling(255.0 * opacity), Color.Black)), 0, 0, panel.Width, panel.Height);
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                var rectangle = new Rectangle(0, 0, size.Width + 20, size.Height + 10);
                rectangle.Offset(form.Width / 2 - rectangle.Width / 2, form.Height / 2 - rectangle.Height / 2);
                g.GlowRectangle(rectangle, glowColor, 30, 10);
                g.FillRoundRectangle(new SolidBrush(backColor), rectangle, 5);
                TextRenderer.DrawText(g, message, font, rectangle, foreColor, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.WordBreak);
            };
            form.Controls.Add(panel);
            panel.BringToFront();

            if (duration > 0)
            {
                var timer = new Timer();
                timer.Interval = duration;
                timer.Tick    += (sender, e) =>
                {
                    form.Controls.Remove(panel);
                    panel = null;
                    timer.Stop();
                };
                timer.Start();
            }

            form.Refresh();
            return(panel);
        }
        /// <summary>
        /// Shows a notification on the form.
        /// </summary>
        /// <param name="form">The form to display the notification.</param>
        /// <param name="message">The message (notification) that should be displayed.</param>
        /// <param name="duration">The duration of the notification (specify -1 for infinite).</param>
        /// <param name="opacity">The opacity of the background (0..1).</param>
        /// <param name="glowColor">The glow color of the message rectangle.</param>
        /// <param name="backColor">The background color of the message rectangle.</param>
        /// <param name="foreColor">The text color of the message.</param>
        public static Control Notify(this Form form, string message, int duration, double opacity, Color glowColor, Color backColor, Color foreColor)
        {
            var font = new Font(form.Font.FontFamily, form.Font.Size * 1.2f, form.Font.Unit);
            var proposedSize = new Size(form.Width * 6 / 10, 0);
            var size = TextRenderer.MeasureText(message, font, proposedSize, TextFormatFlags.WordBreak);
            var panel = new TransparentPanel();
            panel.Size = form.ClientRectangle.Size;
            panel.Location = new Point(0, 0);
            panel.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
            panel.Paint += (sender, e) =>
            {
                var g = e.Graphics;
                e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb((int)Math.Ceiling(255.0 * opacity), Color.Black)), 0, 0, panel.Width, panel.Height);
                g.SmoothingMode = Drawing.Drawing2D.SmoothingMode.AntiAlias;
                var rectangle = new Rectangle(0, 0, size.Width + 20, size.Height + 10);
                rectangle.Offset(form.Width / 2 - rectangle.Width / 2, form.Height / 2 - rectangle.Height / 2);
                g.Glow(rectangle, glowColor, 30, 10);
                g.FillRoundRectangle(new SolidBrush(backColor), rectangle, 5);
                TextRenderer.DrawText(g, message, font, rectangle, foreColor, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.WordBreak);
            };
            form.Controls.Add(panel);
            panel.BringToFront();

            if (duration > 0)
            {
                var timer = new Timer();
                timer.Interval = duration;
                timer.Tick += (sender, e) =>
                {
                    form.Controls.Remove(panel);
                    panel = null;
                    timer.Stop();
                };
                timer.Start();
            }

            form.Refresh();
            return panel;
        }
Beispiel #8
0
        //To fill in details of item at pop up
        private void ShowItemDetails(Item item, NumericUpDown numUpDown)
        {
            //to find for file image
            String fileLocation = Path.Combine(Environment.CurrentDirectory, "..", "..", "Resource", "Images", "MenuItems", item.Image);

            picBoxItemDetail.Image = ResizeImage(Image.FromFile(fileLocation), new Size(400, 350));

            //set item name
            lblItemNameDetail.Text = item.Name;
            txtBoxItemDesc.Text    = item.Description;
            lblPrice.Text          = String.Format("{0:C}", item.Price);

            //for numericupdown part
            numUpDown.Value         = item.Quantity;
            numUpDown.ValueChanged += (e, sender) =>
            {
                //update item quantity at menu page
                item.Quantity      = (int)numUpDown.Value;
                lblTotalPrice.Text = String.Format("Total: {0:C}", (item.Price * numUpDown.Value));

                //update item quantity in cart
                foreach (NumericUpDown upDown in numUpDownListCartCopy)
                {
                    if (upDown.Tag.Equals(item.Name))
                    {
                        upDown.Value = item.Quantity;
                        upDown.Update();
                    }
                }

                AddCartItem(item);
            };

            lblTotalPrice.Text = "Total: " + String.Format("{0:C}", (item.Price * numUpDown.Value));

            //bring pop up to front
            transPanelHidden.Show();
            transPanelHidden.BringToFront();
        }
Beispiel #9
0
        public EIBCalenderBase()
        {
            monthCalender      = new MonthCalendar();
            monthCalender.Size = new Size(width, height);

            //dateTimePicker.CalendarForeColor = Color.White;
            monthCalender.Dock = DockStyle.Fill;
            this.Size          = new Size(width, height);
            this._Width        = width;
            this.Controls.Add(monthCalender);

            tpanel          = new TransparentPanel();
            tpanel.Location = new Point(0, 0);
            tpanel.Size     = new Size(width, height);
            tpanel.Dock     = DockStyle.Fill;
            this.Controls.Add(tpanel);
            tpanel.BringToFront();
            tpanel.MouseClick += new MouseEventHandler(tpanel_MouseClick);
            tpanel.MouseDown  += new MouseEventHandler(tpanel_MouseDown);
            tpanel.MouseMove  += new MouseEventHandler(tpanel_MouseMove);
            tpanel.MouseUp    += new MouseEventHandler(tpanel_MouseUp);

            this.Resize += new System.EventHandler(EIBDatePickerBase_Resize);

            if (string.IsNullOrEmpty(this.Name))
            {
                this.Name = "calender" + counter;
            }
            if (string.IsNullOrEmpty(this.ControlName))
            {
                this.ControlName = this.Name;
            }
            this.Margin       = new Padding(0, 0, 0, 0);
            this.Font         = SystemFonts.DefaultFont;
            this.Layout      += new LayoutEventHandler(Control_Layout);
            this.SizeChanged += new System.EventHandler(Control_SizeChanged);
        }
        public MerchantUserControl(TableLayoutPanel gamePanel)
        {
            InitializeComponent();

            this.gamePanel = gamePanel;
            this.BackColor = Color.Black;

            structure = new TableLayoutPanel();
            
            structure.RowStyles.Clear();
            structure.RowStyles.Add(new RowStyle(SizeType.Percent, 10.0f)); // Title
            structure.RowStyles.Add(new RowStyle(SizeType.Percent, 80.0f));
            structure.RowStyles.Add(new RowStyle(SizeType.Percent, 5.0f)); // Help
            structure.RowStyles.Add(new RowStyle(SizeType.Percent, 5.0f)); // Merchant notifier

            lblTitle = this.DockFillLabel("lblTitle", Color.Red);
            lblTitle.Margin = new Padding(PaddingValue);
            lblTitle.TextAlign = ContentAlignment.MiddleCenter;

            descriptionList = new DescriptionList<Item>[2];
            for (int i = 0; i < descriptionList.Length; i++)
            {
                descriptionList[i] = new DescriptionList<Item>();
                descriptionList[i].KeyUp += OnKeyUp;
                descriptionList[i].Dock = DockStyle.Fill;
                var locI = i;
                descriptionList[i].Stringify = (item) => String.Format("[{0}] {1}",
                                                                    descriptionList[locI].Items.IndexOf(item),
                                                                    item.Name);

                descriptionList[i].Title = i == 0 
                                    ? "Your backpack"
                                    : "Merchant's warehouse";
                descriptionList[i].HelpString = "W: Previous - S: Next - A: Previous Page - D: Next Page";
            }

            var descriptionListPanel = new TableLayoutPanel();
            descriptionListPanel.ColumnStyles.Clear();
            descriptionListPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50.0f));
            descriptionListPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50.0f));
            descriptionListPanel.Margin = new Padding(PaddingValue);
            descriptionListPanel.Dock = DockStyle.Fill;

            lblHelp = this.DockFillLabel("lblHelp", Color.Yellow, new Font(FontFamily.GenericMonospace, charHelpSize));
            lblHelp.Margin = new Padding(PaddingValue);
            lblHelp.TextAlign = ContentAlignment.MiddleCenter;

            singleLogMerchant = new SingleMessageLogUserControl();
            singleLogMerchant.Dock = DockStyle.Fill;

            descriptionListPanel.Controls.Add(descriptionList[0], 0, 0);
            descriptionListPanel.Controls.Add(descriptionList[1], 1, 0);

            transparentPanel = new TransparentPanel();
            transparentPanel.BackColor = Color.Transparent;
            //transparentPanel.Transparency = 128;
            transparentPanel.Paint += TransparentPanel_Paint; ;
            singleLogMerchant.KeyUp += OnKeyUp;

            structure.Controls.Add(lblTitle, 0, 0);
            structure.Controls.Add(descriptionListPanel, 0, 1);
            structure.Controls.Add(lblHelp, 0, 2);
            structure.Controls.Add(singleLogMerchant, 0, 3);

            this.Controls.Add(structure);
            this.Controls.Add(transparentPanel);

            HelpString = helpStrings[SelectedListIndex];
            this.SelectedIndexChanged += (sender, e) =>
            {
                HelpString = helpStrings[((IndexChangedEventArgs)e).Index];
            };

            initialWidth = Width;
            initialHeight = Height;
            initialTitleFontSize = lblTitle.Font.Size;
            initialHelpFontSize = lblHelp.Font.Size;

            structure.Parent.Resize += (sender, e) => Controll_FillParent(sender, e, structure);
            transparentPanel.Parent.Resize += (sender, e) => Controll_FillParent(sender, e, transparentPanel);

            transparentPanel.BringToFront();
        }
Beispiel #11
0
        public EIBCalenderBase()
        {
            monthCalender = new MonthCalendar();
            monthCalender.Size = new Size(width, height);

            //dateTimePicker.CalendarForeColor = Color.White;
            monthCalender.Dock = DockStyle.Fill;
            this.Size = new Size(width, height);
            this._Width = width;
            this.Controls.Add(monthCalender);

            tpanel = new TransparentPanel();
            tpanel.Location = new Point(0, 0);
            tpanel.Size = new Size(width, height);
            tpanel.Dock = DockStyle.Fill;
            this.Controls.Add(tpanel);
            tpanel.BringToFront();
            tpanel.MouseClick += new MouseEventHandler(tpanel_MouseClick);
            tpanel.MouseDown += new MouseEventHandler(tpanel_MouseDown);
            tpanel.MouseMove += new MouseEventHandler(tpanel_MouseMove);
            tpanel.MouseUp += new MouseEventHandler(tpanel_MouseUp);

            this.Resize += new System.EventHandler(EIBDatePickerBase_Resize);

            if (string.IsNullOrEmpty(this.Name))
            {
                this.Name = "calender" + counter;
            }
            if (string.IsNullOrEmpty(this.ControlName))
            {
                this.ControlName = this.Name;
            }
            this.Margin = new Padding(0, 0, 0, 0);
            this.Font = SystemFonts.DefaultFont;
            this.Layout += new LayoutEventHandler(Control_Layout);
            this.SizeChanged += new System.EventHandler(Control_SizeChanged);
        }