コード例 #1
0
 protected override void Dispose(bool disposing)
 {
     lock (this)
     {
         if (!_disposed)
         {
             if (disposing)
             {
                 //dispose managed resources
                 foreach (IComponent c in _components)
                 {
                     if (c != null && c is IDisposable)
                     {
                         if (c is MySocket)
                         {
                             (c as MySocket).NotifyDispose = false;
                         }
                         (c as IDisposable).Dispose();
                     }
                 }
                 if (_flowPanel != null)
                 {
                     _flowPanel.Dispose();
                 }
             }
             //dispose unmanaged resources
             _flowPanel = null;
             _components.Clear();
             _components = null;
             _path       = null;
             _disposed   = true;
         }
     }
 }
コード例 #2
0
 public void DeInitPlugin()
 {
     ActGlobals.oFormSpellTimers.OnSpellTimerExpire -= oFormSpellTimers_OnSpellTimerExpire;
     flowPanel.Dispose();
     tmr_sec.Enabled = false;
     tmr_sec.Dispose();
 }
コード例 #3
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         m_panel.Dispose();
         m_label.Dispose();
     }
 }
コード例 #4
0
        public void ReloadInfo(List <Modification> modifications)
        {
            if (modifications == null)
            {
                return;
            }

            if (modifications.Count < 1)
            {
                return;
            }

            if (infoLabelsContainer != null)
            {
                infoLabelsContainer.Dispose();
                infoLabelsContainer = null;
            }
            infoLabelsContainer = new FlowLayoutPanel
            {
                Dock          = DockStyle.Fill,
                Margin        = new Padding(1, 5, 30, 1),
                FlowDirection = FlowDirection.TopDown,
                WrapContents  = false,
                AutoScroll    = true
            };
            this.Controls.Add(infoLabelsContainer);


            if (infoLabels != null)
            {
                infoLabels.Clear();
                infoLabels = null;
            }
            infoLabels = new List <Label>();

            Label tmp = new Label();

            infoLabels.Add(tmp);
            //infoLabelsContainer.Controls.Add(tmp);
            int labelsWIDTH = infoLabelsContainer.Width - 20;

            foreach (var value in modifications)
            {
                Label newLabel = new Label
                {
                    AutoEllipsis = true,
                    AutoSize     = false,
                    Height       = LabelsHeight,
                    Width        = labelsWIDTH,
                    Text         = "[" + value.time + "]   " + value.info
                };

                infoLabels.Add(newLabel);
                infoLabelsContainer.Controls.Add(newLabel);
            }

            ResizeInfoLabels();
        }
コード例 #5
0
        private void buttonRefresh_Click(object sender, EventArgs e)
        {
            Task[] tasks = client.GetTasks();
            var    item  = listBoxTasks.SelectedItem;
            var    index = listBoxTasks.SelectedIndex;

            listBoxTasks.BeginUpdate();
            listBoxTasks.Items.Clear();
            foreach (var task in tasks)
            {
                string s = $"Task: {task.Id}, {task.Type}, Date: {task.Date}";
                if (task.IsActive)
                {
                    s += " (Active)";
                }
                listBoxTasks.Items.Add(s);
            }
            listBoxTasks.EndUpdate();
            if (index != -1)
            {
                listBoxTasks.SelectedIndex = index;
            }



            if (item == null)
            {
                return;
            }
            int  selectedTaskID = Int32.Parse(item.ToString().Split(',')[0].Split(':')[1]);
            Task selectedTask   = new Task();

            selectedTask.Id = selectedTaskID;
            Virus[] viruses = client.GetVirusesFound(selectedTask);
            label1.Text = $"Найденные угрозы: {viruses.Length}";

            flowLayoutPanelReport.Dispose();
            foreach (var r in reportRows)
            {
                r.Dispose();
            }

            flowLayoutPanelReport            = new FlowLayoutPanel();
            flowLayoutPanelReport.AutoScroll = true;
            flowLayoutPanelReport.Size       = new System.Drawing.Size(691, 417);
            flowLayoutPanelReport.Location   = new System.Drawing.Point(297, 6);

            reportRows.Clear();

            foreach (var v in viruses)
            {
                ReportRow row = new ReportRow(flowLayoutPanelReport, selectedTask, v);
                reportRows.Add(row);
            }
            flowLayoutPanelReport.Parent = tabPage2;
        }
コード例 #6
0
        public void Dispose()
        {
            SuperTask?.Subtasks.Remove(this);
            for (int i = Subtasks.Count - 1; i >= 0; i--)
            {
                Subtasks[i].Dispose();
            }

            panelMain.Parent = null;
            panelMain.Dispose();
        }
コード例 #7
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         // Be sure to unhook event handlers
         // to prevent "lapsed listener" leaks.
         nullValueButton.Click -= nullValueButton_Click;
         _enclosingInstance     = null;
         nullValueButton.Dispose();
         basePane.Controls.Clear();
         basePane.Dispose();
     }
 }
コード例 #8
0
        public void Delete(object sender, EventArgs e)
        {
            // Remove a reference to this in the graphics index references
            foreach (GraphicsCreator.graphicPrototype.prototypeIndex p in Program.windowStatus.graphicsCreator.Prototype.indexes)
            {
                if (p.settingswithidx == this)
                {
                    // If any of these p holds a refernce to this setting which shall be deleted
                    p.settingswithidx = null;
                }
            }
            Program.windowStatus.graphicsCreator.Prototype.UpdateIdxSettingReference();

            handler.allSettings.Remove(this);

            Program.windowStatus.Controls.Remove(index);
            Program.windowStatus.Controls.Remove(name);
            Program.windowStatus.Controls.Remove(digit);
            Program.windowStatus.Controls.Remove(size);
            Program.windowStatus.Controls.Remove(color);
            Program.windowStatus.Controls.Remove(val1raw);
            Program.windowStatus.Controls.Remove(val1scaled);
            Program.windowStatus.Controls.Remove(val2raw);
            Program.windowStatus.Controls.Remove(val2scaled);
            Program.windowStatus.Controls.Remove(delete);
            Program.windowStatus.Controls.Remove(panel);

            index.Dispose();
            name.Dispose();
            digit.Dispose();
            size.Dispose();
            color.Dispose();
            val1raw.Dispose();
            val1scaled.Dispose();
            val2raw.Dispose();
            val2scaled.Dispose();
            delete.Dispose();
            panel.Dispose();

            // Only delete if the sender is not null
            // when sender is null the command has been called from reload
            if (sender != null)
            {
                for (int i = 0, j = linkedStats.Count; i < j; i++)
                {
                    linkedStats[i].Delete(null, null);
                }

                Program.windowStatus.graphicsCreator.Prototype.UpdateIdxSettingReference();
            }
        }
コード例 #9
0
ファイル: rpanel.cs プロジェクト: lazebird/rabbit
 protected virtual void Dispose(bool disposing)
 {
     if (file != null)
     {
         file.Close();
     }
     file = null;
     if (!disposing)
     {
         return;
     }
     clear();
     fp.Dispose();
 }
コード例 #10
0
        /// <summary>
        /// Executes when the button click event happens on the Load Data button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            if (dataHandler.LoadData() && dataHandler.CurrentDataset != null)
            {
                var foods = dataHandler.CurrentDataset.Tables[0].Select();

                // Add the name of all foods to the select box on the UI
                foreach (DataRow d in foods)
                {
                    NutritionSelect.Items.Add(d.Field <string>("Data"));
                }

                // Create panel to hold a label and text box for all data per food
                if (dataPanel != null)
                {
                    dataPanel.Dispose();
                }
                dataPanel            = new FlowLayoutPanel();
                dataPanel.Width      = groupBoxNutritionInfo.Width - (dataPanelOffset * 2);
                dataPanel.Height     = groupBoxNutritionInfo.Height - (dataPanelOffset * 2);
                dataPanel.Location   = new Point(dataPanelOffset, dataPanelOffset);
                dataPanel.AutoScroll = true;

                groupBoxNutritionInfo.Controls.Add(dataPanel);

                // Creates a label and textbox for each data member to display its information in the UI
                foreach (DataTable t in dataHandler.CurrentDataset.Tables)
                {
                    Label l = new Label();
                    l.Name      = "lbl" + t.TableName;
                    l.Text      = t.TableName;
                    l.Width     = (dataPanel.Width / 4) - (dataPanelOffset / 2);
                    l.TextAlign = ContentAlignment.MiddleLeft;

                    TextBox txt = new TextBox();
                    txt.Name     = t.TableName;
                    txt.Width    = (dataPanel.Width / 4) - (dataPanelOffset / 2);
                    txt.ReadOnly = true;

                    dataPanel.Controls.Add(l);
                    dataPanel.Controls.Add(txt);
                    l.Visible   = true;
                    txt.Visible = true;
                }
                NutritionSelect.SelectedIndex = 0;
                LogHandler.Log("Data loaded successfully.");
            }
        }
コード例 #11
0
        //Adds the kill button and name to the alive list
        private void addDokiControlls(Doki doki, string tText = "")
        {
            Label t = new Label();

            if (string.IsNullOrEmpty(tText))
            {
                t.Text = getText();
            }
            else
            {
                t.Text = tText;
            }

            doki.Location = new Point(Rand.Next(0, doki.rWall), Rand.Next(0, doki.floor / 2));
            Dokies.Add(doki);
            doki.Show();
            FlowLayoutPanel p = new FlowLayoutPanel();

            p.Name          = "test";
            p.FlowDirection = FlowDirection.LeftToRight;
            p.Size          = new Size(this.fpAlive.ClientSize.Width - 25, 25);
            p.Controls.Add(t);

            Button b = new Button();

            b.Text = "Kill";
            if (justMonika)
            {
                b.Enabled = false;
            }
            p.Controls.Add(b);

            p.Disposed += (ss, ee) =>
            {
                this.fpAlive.Controls.Remove(p);
                t.Dispose();
                b.Dispose();
            };

            b.Click += (ss, ee) =>
            {
                p.Dispose();
            };

            b.Click += doki.DokiCloseHandle;

            this.fpAlive.Controls.Add(p);
        }
コード例 #12
0
        public async Task ImageFilter(string keyword = "")
        {
            if (processStop)
            {
                return;
            }
            flowPanel.Dispose();
            flowPanel = new FlowLayoutPanel
            {
                Size       = new Size(562, 272),
                Location   = new Point(14, 126),
                AutoScroll = true,
            };
            Controls.Add(flowPanel);

            FlowFavorite();

            integer     = 0;
            emoteString = new List <string>();
            pictureList = new List <PictureBox>();

            if (processStop)
            {
                return;
            }
            ImageGetting(keyword);
            label2.Text = $"{emoteString.Count} Search Results";
            label3.Text = $"{page + 1} / {emoteString.Count / paging + 1}";
            int emotesOnPage = Math.Min(paging, emoteString.Count - page * paging);

            for (int x = 0; x < emotesOnPage; x++)
            {
                if (processStop)
                {
                    break;
                }
                await Task.Run(() => ImageLoading(x));

                if (processStop)
                {
                    break;
                }
                flowPanel.Controls.Add(pictureList[x]);
                label4.Text = $"{integer} / {emotesOnPage} Loaded";
            }
        }
コード例 #13
0
 protected virtual void Dispose(bool disposing)
 {
     if (!disposed)
     {
         if (disposing)
         {
             //Удаляем элементы
             pnlMain.Dispose();
             pnlReglament_BottomLine.Dispose();
             lnklblRegion.Dispose();
             lnklblReglament.Dispose();
             lnklblShedule.Dispose();
             lnklblPeriod.Dispose();
         }
     }
     disposed = true;
 }
コード例 #14
0
ファイル: FormMenuBoard.cs プロジェクト: isaveu/DCCaffeKiosk
        /// <summary>
        /// 동적 카테고리와 동적 메뉴 전체 제거하기
        /// </summary>
        private void CategoriesAndMenusClearAll()
        {
            // panel_MenuPageLayout > FlowLayoutPanel > UCMenuButton

            // 메뉴 동적 콘트롤 제거
            int categoryCount = this.panel_MenuPageLayout.Controls.Count;

            while (this.panel_MenuPageLayout.Controls.Count > 0)
            {
                while (this.panel_MenuPageLayout.Controls[0].Controls.Count > 0)
                {
                    UCMenuButton control = this.panel_MenuPageLayout.Controls[0].Controls[0] as UCMenuButton;

                    // 메뉴 이벤트 제거
                    control.Click -= _menuButton_Click;

                    // 메뉴 객체 제거
                    this.panel_MenuPageLayout.Controls[0].Controls.RemoveAt(0);

                    // 메뉴 객체 릴리즈
                    control.Dispose();
                }

                FlowLayoutPanel flp = this.panel_MenuPageLayout.Controls[0] as FlowLayoutPanel;
                this.panel_MenuPageLayout.Controls.RemoveAt(0);
                flp.Dispose();
            }

            // 카테고리 동적 콘트롤 제거
            while (this.flowLayoutPanel_Category.Controls.Count > 0)
            {
                Control control = this.flowLayoutPanel_Category.Controls[0];

                // 카테고리 이벤트 제거
                control.Click -= _categoryButton_Click;

                // 카테고리 객체 제거
                this.flowLayoutPanel_Category.Controls.RemoveAt(0);

                // 카테고리 객체 릴리즈
                control.Dispose();
            }

            // 카테고리 페이지 맵핑 제거
            dicMenuPages.Clear();
        }
コード例 #15
0
        public void Delete(object sender, EventArgs e)
        {
            // Remove link to settings
            if (_setting != null)
            {
                _setting.linkedStats.Remove(this);
            }
            Program.windowStatus.indexStats.allStats.Remove(this);

            Program.windowStatus.Controls.Remove(index);
            Program.windowStatus.Controls.Remove(name);
            Program.windowStatus.Controls.Remove(delete);
            Program.windowStatus.Controls.Remove(panel);

            index.Dispose();
            name.Dispose();
            delete.Dispose();
            panel.Dispose();
        }
コード例 #16
0
ファイル: Form1.datapanel.cs プロジェクト: khiemnv/portal
        // The bulk of the clean-up code is implemented in Dispose(bool)
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // free managed resources
                m_reloadPanel.Dispose();
                m_sumPanel.Dispose();

                m_reloadBtn.Dispose();
                m_submitBtn.Dispose();
                m_status.Dispose();
                m_sumLabel.Dispose();
                m_sumTxt.Dispose();

                m_dataGridView.Dispose();

                appConfig.s_contentProvider.ReleaseDataContent(m_tblName);
            }
            // free native resources if there are any.
        }
コード例 #17
0
        private void FlowFavorite()
        {
            System.Collections.Specialized.StringCollection favorites = (System.Collections.Specialized.StringCollection)Properties.Settings.Default["Favorite"];
            if (favorites == null)
            {
                favorites = new System.Collections.Specialized.StringCollection();
            }
            if (favorites.Count < 1)
            {
                flowPanelFav.Size = new Size(562, 0);
                flowPanel.Size    = new Size(562, 272);
            }
            else
            {
                flowPanel.Size = new Size(562, 216);
                flowPanelFav.Dispose();
                flowPanelFav = new FlowLayoutPanel
                {
                    Size       = new Size(562, 54),
                    Location   = new Point(14, 344),
                    AutoScroll = true,
                };
                Controls.Add(flowPanelFav);

                foreach (string favorite in favorites)
                {
                    PictureBox picture = new PictureBox()
                    {
                        Name    = favorite,
                        TabStop = false,
                        Size    = new Size(48, 48),
                        Image   = GetImage(favorite, "f_"),
                    };
                    picture.SizeMode   = PictureBoxSizeMode.Zoom;
                    picture.Click     += buttonGenerated_Click;
                    picture.MouseMove += buttonGenerated_MouseMove;
                    flowPanelFav.Controls.Add(picture);
                }
            }
        }
コード例 #18
0
        public void Dispose()
        {
            if (_Header != null)
            {
                foreach (Control c in _Header.Controls)
                {
                    c.Dispose();
                }

                _Header.Dispose();
            }

            if (_Vbracket != null)
            {
                foreach (Control c in _Vbracket.Controls)
                {
                    c.Dispose();
                }

                _Vbracket.Dispose();
            }
        }
コード例 #19
0
    public void Dispose(TableLayoutPanel pan)
    {
        pan.Controls.Remove(hidden);
        pan.Controls.Remove(index);
        pan.Controls.Remove(posx);
        pan.Controls.Remove(posy);
        pan.Controls.Remove(fll);
        pan.Controls.Remove(fl);
        pan.Controls.Remove(fh);
        pan.Controls.Remove(fhh);
        pan.Controls.Remove(delete);

        hidden.Dispose();
        index.Dispose();
        posx.Dispose();
        posy.Dispose();
        fll.Dispose();
        fl.Dispose();
        fh.Dispose();
        fhh.Dispose();
        delete.Dispose();
    }
コード例 #20
0
        /// <summary>
        /// 载入消息
        /// </summary>
        /// <param name="sessionInfo"></param>
        private void LoadMessage(SessionInfo sessionInfo)
        {
            panelBody.Controls.Clear();

            FlowLayoutPanel flpMessage = new FlowLayoutPanel();

            flpMessage.Dock      = DockStyle.Fill;
            isStopRefreshMessage = true;

            panelBody.Controls.Add(flpMessage);
            sessionInfo.Componet = flpMessage;

            ThreadPool.QueueUserWorkItem(new WaitCallback((object _user) => {
                //实时刷新用户信息
                while (MessageRefreshStatus())
                {
                    sessionMessageTimes(sessionInfo);
                    Thread.Sleep(SystemParamters.MessageFrequency);
                }
            }), userID);

            ControlEventHandler panelClose = new ControlEventHandler((object sender, ControlEventArgs e) => {
                flpMessage.Dispose();
            });

            flpMessage.Disposed += new EventHandler((object sender, EventArgs e) => {
                //释放托管的消息实时刷新功能
                lock (isStopRefreshMessage)
                {
                    isStopRefreshMessage = false;
                }
                panelBody.ControlRemoved -= panelClose;
            });


            panelBody.ControlRemoved += panelClose;
        }
コード例 #21
0
        private void Update(EntrySettings settings)
        {
            var container = notesCtrl.Parent;

            if (sshButtons != null)
            {
                container.Controls.Remove(sshButtons);
                sshButtons.Dispose();
                sshButtons = null;
            }

            if (sshLabel == null)
            {
                sshLabel          = new Label();
                sshLabel.Location = notesLabelLocation;
                sshLabel.Width    = 70;
                sshLabel.Text     = "AutoGen:";
                container.Controls.Add(sshLabel);
            }

            sshButtons          = CreateButtons(settings);
            sshButtons.Location = new Point(notesLocation.X - 5, notesLocation.Y - 5);

            var lastBtn       = sshButtons.Controls[sshButtons.Controls.Count - 1] as Button;
            var buttonsHeight = lastBtn.Location.Y + lastBtn.Height;

            sshButtons.Height = buttonsHeight;

            notesLabel.Location = new Point(notesLabelLocation.X, notesLabelLocation.Y + buttonsHeight);
            notesCtrl.Location  = new Point(notesLocation.X, notesLocation.Y + buttonsHeight);
            notesCtrl.Height    = notesHeight - buttonsHeight;

            container.Controls.Add(sshButtons);
            container.ResumeLayout(false);
            container.PerformLayout();
        }
コード例 #22
0
ファイル: Form1.cs プロジェクト: robinli90/Misc_Applications
        private void flowLayoutPanel_DragDrop(object sender, DragEventArgs e)
        {
            //HarrProgressBar data = (HarrProgressBar)e.Data.GetData(typeof(HarrProgressBar));
            PB data = (PB)e.Data.GetData(typeof(PB));
            FlowLayoutPanel _destination = (FlowLayoutPanel)sender;
            FlowLayoutPanel _source      = (FlowLayoutPanel)data.Parent;

            Point p1 = _destination.PointToClient(new Point(e.X, e.Y));

            if (p1.Y > 0)
            {
                if (_destination == garbagePanel || _destination == TFLP)
                {
                    data.Dispose();
                    ExpanderApp.Expander ex = new ExpanderApp.Expander();
                    ex.Expand(); ex = new ExpanderApp.Expander();
                    ex = (Expander)_source.Parent;
                    ex.Collapse();
                    ex.Expand();

                    if (_source.Controls.Count <= 0)
                    {
                        if (_source.Parent.Controls.Count <= 2)
                        {
                            _source.Parent.Dispose();
                        }
                        else
                        {
                            _source.Dispose();
                        }
                    }
                    _destination.Invalidate();
                    _source.Invalidate();
                }
                else if (_source != _destination)
                {
                    // Add control to panel
                    _destination.Controls.Add(data);
                    //_destination.Width = _destination.Width - 8;
                    data.Size = new Size(_destination.Width - 2, data.Height);

                    // Reorder
                    Point p     = _destination.PointToClient(new Point(e.X, e.Y));
                    var   item  = _destination.GetChildAtPoint(p);
                    int   index = _destination.Controls.GetChildIndex(item, false);
                    _destination.Controls.SetChildIndex(data, index);

                    // Invalidate to paint!
                    if (_source.Controls.Count <= 0)
                    {
                        if (_source.Parent.Controls.Count <= 2)
                        {
                            _source.Parent.Dispose();
                        }
                        else
                        {
                            _source.Dispose();
                        }
                    }
                    _source.Invalidate();
                    Console.WriteLine(_destination.Parent.ToString());
                    ExpanderApp.Expander ex = new ExpanderApp.Expander();
                    ex = (Expander)_destination.Parent;
                    ex.Collapse();

                    ex.Expand(); ex = new ExpanderApp.Expander();
                    ex = (Expander)_source.Parent;
                    ex.Collapse();
                    ex.Expand();
                    _destination.Invalidate();
                    _source.Invalidate();
                }
                else
                {
                    // Just add the control to the new panel.
                    // No need to remove from the other panel,
                    // this changes the Control.Parent property.
                    Point p     = _destination.PointToClient(new Point(e.X, e.Y));
                    var   item  = _destination.GetChildAtPoint(p);
                    int   index = _destination.Controls.GetChildIndex(item, false);
                    _destination.Controls.SetChildIndex(data, index);


                    ExpanderApp.Expander ex = new ExpanderApp.Expander();
                    ex.Expand(); ex = new ExpanderApp.Expander();
                    ex = (Expander)_source.Parent;
                    ex.Collapse();
                    ex.Expand();
                    _destination.Invalidate();
                }
                FadeIn(TFLP, 1);
            }
            FadeIn(TFLP, 1);
            //garbagePanel.Visible = false;
        }
コード例 #23
0
        private void CreateTableOk_Click(object sender, EventArgs e)
        {
            TextBox[,] tableInputs    = new TextBox[(int)NoOfRows.Value, (int)NoOfCol.Value];
            CreateTableDialog.Visible = false;
            FlowLayoutPanel mainPanel = new FlowLayoutPanel();

            mainPanel.FlowDirection = FlowDirection.TopDown;
            DesignCanvas.Controls.Add(mainPanel);
            mainPanel.Location = new Point(100, 100);

            mainPanel.AutoSize  = true;
            mainPanel.BackColor = Color.FromArgb(40, 40, 40);
            mainPanel.ForeColor = Color.White;

            FlowLayoutPanel headingsPanel = new FlowLayoutPanel();

            headingsPanel.FlowDirection = FlowDirection.LeftToRight;
            headingsPanel.AutoSize      = true;
            headingsPanel.AutoScroll    = true;


            for (int i = 0; i < NoOfCol.Value; i++)
            {
                Label headings = new Label();
                headings.Width     = 100;
                headings.Text      = "<td>";
                headings.TextAlign = ContentAlignment.MiddleCenter;
                headingsPanel.Controls.Add(headings);
            }
            mainPanel.Controls.Add(headingsPanel);

            for (int i = 0; i < NoOfRows.Value; i++)
            {
                FlowLayoutPanel innerPanel = new FlowLayoutPanel();
                innerPanel.FlowDirection = FlowDirection.LeftToRight;
                innerPanel.AutoSize      = true;

                for (int j = 0; j < NoOfCol.Value; j++)
                {
                    tableInputs[i, j] = new TextBox();
                    innerPanel.Controls.Add(tableInputs[i, j]);
                }

                mainPanel.Controls.Add(innerPanel);
            }

            FlowLayoutPanel buttons = new FlowLayoutPanel();

            buttons.FlowDirection = FlowDirection.LeftToRight;
            buttons.AutoSize      = true;

            Button Ok = new Button();

            Ok.BackColor = Color.FromArgb(40, 40, 40);
            Ok.Text      = "OK";
            Ok.Location  = new Point(50, 200);
            Ok.Size      = new Size(116, 34);
            Ok.FlatStyle = FlatStyle.Flat;
            Ok.Click    += (s, er) =>
            {
                mainPanel.Visible = false;
                currentLayer      = noOfLayers;
                currentLayer++;
                noOfLayers++;

                layers[currentLayer] = new TableLayer(currentLayer, "table");
                for (int i = 0; i < NoOfRows.Value; i++)
                {
                    layers[currentLayer].addTr();

                    for (int j = 0; j < NoOfCol.Value; j++)
                    {
                        layers[currentLayer].getTr().addLi("td", (TableLayer)layers[currentLayer], TableTextInput);
                        layers[currentLayer].getTr().getLi().getDesign().Text = tableInputs[i, j].Text;
                        layers[currentLayer].getTr().getLi().getCode().getHTML().setValue(tableInputs[i, j].Text);
                        layers[currentLayer].getTr().getLi().getDesign().Font  = new Font("Times New Roman", 16);
                        layers[currentLayer].getTr().getLi().getDesign().Width = 15 * layers[currentLayer].getTr().getLi().getDesign().Text.Length;
                    }
                }

                /*layers[currentLayer].getTr().getPanel().Click += (s4, er4) => {
                 *
                 *  layers[currentLayer].setCurrentTr(layers[currentLayer].getPanel().getIndex());
                 *  MessageBox.Show(layers[currentLayer].getCurrentTr().ToString());
                 *
                 * };*/
                DesignCanvas.Controls.Add(layers[currentLayer].getPanel());

                HtmlCode.Text = writeCompleteHTML();
                mainPanel.Dispose();
            };

            Button Back = new Button();

            Back.BackColor = Color.FromArgb(40, 40, 40);
            Back.Text      = "BACK";
            //Ok.Location = new Point(150, 200);
            Back.Size      = new Size(116, 34);
            Back.FlatStyle = FlatStyle.Flat;
            Back.Click    += (s, er) =>
            {
                mainPanel.Visible         = false;
                CreateTableDialog.Visible = true;
            };

            buttons.Controls.Add(Ok);
            buttons.Controls.Add(Back);

            mainPanel.Controls.Add(buttons);
        }
コード例 #24
0
        private void addRow_Click(object sender, EventArgs e)
        {
            TextBox[]       columnInputs = new TextBox[(int)NoOfCol.Value];
            FlowLayoutPanel mainPanel    = new FlowLayoutPanel();

            mainPanel.FlowDirection = FlowDirection.TopDown;
            DesignCanvas.Controls.Add(mainPanel);
            mainPanel.Location  = new Point(100, 100);
            mainPanel.AutoSize  = true;
            mainPanel.BackColor = Color.FromArgb(40, 40, 40);
            mainPanel.ForeColor = Color.White;


            FlowLayoutPanel innerPanel = new FlowLayoutPanel();

            innerPanel.FlowDirection = FlowDirection.LeftToRight;
            innerPanel.AutoSize      = true;

            for (int j = 0; j < NoOfCol.Value; j++)
            {
                columnInputs[j] = new TextBox();
                innerPanel.Controls.Add(columnInputs[j]);
            }

            mainPanel.Controls.Add(innerPanel);

            FlowLayoutPanel buttons = new FlowLayoutPanel();

            buttons.FlowDirection = FlowDirection.LeftToRight;
            buttons.AutoSize      = true;

            Button Ok = new Button();

            Ok.BackColor = Color.FromArgb(40, 40, 40);
            Ok.Text      = "OK";
            Ok.Location  = new Point(50, 200);
            Ok.Size      = new Size(116, 34);
            Ok.FlatStyle = FlatStyle.Flat;
            Ok.Click    += (s, er) =>
            {
                mainPanel.Visible = false;


                layers[currentLayer].addTr();

                for (int j = 0; j < NoOfCol.Value; j++)
                {
                    layers[currentLayer].getTr().addLi("td", (TableLayer)layers[currentLayer], TableTextInput);
                    layers[currentLayer].getTr().getLi().getDesign().Text = columnInputs[j].Text;
                    layers[currentLayer].getTr().getLi().getCode().getHTML().setValue(columnInputs[j].Text);
                    layers[currentLayer].getTr().getLi().getDesign().Font  = new Font("Times New Roman", 16);
                    layers[currentLayer].getTr().getLi().getDesign().Width = 15 * layers[currentLayer].getTr().getLi().getDesign().Text.Length;
                }


                DesignCanvas.Controls.Add(layers[currentLayer].getPanel());
                layers[currentLayer].getPanel().Dock = DockStyle.Top;
                layers[currentLayer].getPanel().BringToFront();
                HtmlCode.Text = writeCompleteHTML();
                mainPanel.Dispose();
            };

            Button Back = new Button();

            Back.BackColor = Color.FromArgb(40, 40, 40);
            Back.Text      = "BACK";
            //Ok.Location = new Point(150, 200);
            Back.Size      = new Size(116, 34);
            Back.FlatStyle = FlatStyle.Flat;
            Back.Click    += (s, er) =>
            {
                mainPanel.Visible         = false;
                CreateTableDialog.Visible = true;
            };

            buttons.Controls.Add(Ok);
            buttons.Controls.Add(Back);

            mainPanel.Controls.Add(buttons);
        }
コード例 #25
0
        public void Dispose()
        {
            if (_WeightCatPanel != null)
            {
                foreach (Control x in _WeightCatPanel.Controls)
                {
                    x.Dispose();
                }

                _WeightCatPanel.Dispose();
            }


            if (_BeltFactorShape != null)
            {
                foreach (Control x in _BeltFactorShape.Controls)
                {
                    x.Dispose();
                }

                _BeltFactorShape.Dispose();
            }

            if (_PersonalDataPanel != null)
            {
                foreach (Control x in _PersonalDataPanel.Controls)
                {
                    x.Dispose();
                }

                _PersonalDataPanel.Dispose();
            }

            if (_BtnShowContData != null)
            {
                foreach (Control x in _BtnShowContData.Controls)
                {
                    x.Dispose();
                }

                _BtnShowContData.Dispose();
            }

            if (_AgeCatPanel != null)
            {
                foreach (Control x in _AgeCatPanel.Controls)
                {
                    x.Dispose();
                }

                _AgeCatPanel.Dispose();
            }

            if (_WeightCatPanel != null)
            {
                foreach (Control x in _WeightCatPanel.Controls)
                {
                    x.Dispose();
                }

                _WeightCatPanel.Dispose();
            }

            if (_ExactWeightShape != null)
            {
                foreach (Control x in _ExactWeightShape.Controls)
                {
                    x.Dispose();
                }

                _ExactWeightShape.Dispose();
            }

            if (_ContMainPanel != null)
            {
                foreach (Control x in _ContMainPanel.Controls)
                {
                    x.Dispose();
                }

                _ContMainPanel.Dispose();
            }
        }
コード例 #26
0
ファイル: TrayPopUpWindow.cs プロジェクト: th-eve/evemon
        /// <summary>
        /// Performs the custom layout.
        /// </summary>
        private void PerformCustomLayout()
        {
            // Remove controls and dispose them
            IEnumerable <Control> oldControls = MainFlowLayoutPanel.Controls.Cast <Control>().ToList();

            MainFlowLayoutPanel.Controls.Clear();
            foreach (Control ctl in oldControls)
            {
                ctl.Dispose();
            }

            IEnumerable <Character> characters = GetCharacters;

            // Add controls for characters
            if (Settings.UI.SystemTrayPopup.GroupBy == TrayPopupGrouping.Account &&
                Settings.UI.SystemTrayPopup.IndentGroupedAccounts)
            {
                List <ESIKey> prevAPIKeys = new List <ESIKey>();
                foreach (Character character in characters)
                {
                    OverviewItem  charPanel = GetOverviewItem(character);
                    List <ESIKey> apiKeys   = character.Identity.ESIKeys.ToList();

                    if (!apiKeys.Exists(apiKey => prevAPIKeys.Contains(apiKey)))
                    {
                        MainFlowLayoutPanel.Controls.Add(charPanel);
                        prevAPIKeys = apiKeys;
                    }
                    else
                    {
                        FlowLayoutPanel tempAccountGroupPanel = null;
                        try
                        {
                            tempAccountGroupPanel = new FlowLayoutPanel();
                            tempAccountGroupPanel.Controls.Add(charPanel);
                            tempAccountGroupPanel.AutoSize      = true;
                            tempAccountGroupPanel.AutoSizeMode  = AutoSizeMode.GrowAndShrink;
                            tempAccountGroupPanel.FlowDirection = FlowDirection.TopDown;
                            tempAccountGroupPanel.Padding       = new Padding(10, 0, 0, 0);

                            tempAccountGroupPanel.CreateControl();

                            FlowLayoutPanel accountGroupPanel = tempAccountGroupPanel;
                            tempAccountGroupPanel = null;

                            MainFlowLayoutPanel.Controls.Add(accountGroupPanel);
                        }
                        finally
                        {
                            tempAccountGroupPanel?.Dispose();
                        }

                        prevAPIKeys = apiKeys;
                    }
                }
            }
            else
            {
                MainFlowLayoutPanel.Controls.AddRange(characters.Select(GetOverviewItem).ToArray <Control>());
            }
        }
コード例 #27
0
ファイル: TrayPopUpWindow.cs プロジェクト: th-eve/evemon
        /// <summary>
        /// Creates a panel contains the warning message for accounts not in training.
        /// </summary>
        /// <param name="warningMessage"></param>
        /// <returns></returns>
        private static FlowLayoutPanel CreateAccountsNotTrainingPanel(string warningMessage)
        {
            // Create a flowlayout to hold the content
            FlowLayoutPanel warningPanel;
            FlowLayoutPanel tempWarningPanel = null;

            try
            {
                tempWarningPanel = new FlowLayoutPanel
                {
                    AutoSize     = true,
                    AutoSizeMode = AutoSizeMode.GrowAndShrink,
                    Margin       = new Padding(0, 0, 0, 2)
                };

                // Add a picture on the left with a warning icon
                if (!Settings.UI.SafeForWork)
                {
                    int portraitSize = Int32.Parse(Settings.UI.SystemTrayPopup.PortraitSize.ToString().Substring(1),
                                                   CultureConstants.InvariantCulture);

                    PictureBox tempPictureBoxWarning = null;
                    try
                    {
                        tempPictureBoxWarning          = new PictureBox();
                        tempPictureBoxWarning.Image    = SystemIcons.Warning.ToBitmap();
                        tempPictureBoxWarning.SizeMode = PictureBoxSizeMode.StretchImage;
                        tempPictureBoxWarning.Size     = new Size(portraitSize, portraitSize);
                        tempPictureBoxWarning.Margin   = new Padding(2);

                        PictureBox pbWarning = tempPictureBoxWarning;
                        tempPictureBoxWarning = null;

                        tempWarningPanel.Controls.Add(pbWarning);
                    }
                    finally
                    {
                        tempPictureBoxWarning?.Dispose();
                    }
                }

                // Adds a label to hold the message
                Label tempLabelMessage = null;
                try
                {
                    tempLabelMessage = new Label
                    {
                        AutoSize = true,
                        Text     = warningMessage
                    };

                    Label lblMessage = tempLabelMessage;
                    tempLabelMessage = null;

                    tempWarningPanel.Controls.Add(lblMessage);
                }
                finally
                {
                    tempLabelMessage?.Dispose();
                }

                tempWarningPanel.CreateControl();

                warningPanel     = tempWarningPanel;
                tempWarningPanel = null;
            }
            finally
            {
                tempWarningPanel?.Dispose();
            }

            return(warningPanel);
        }
コード例 #28
0
        public void chart_onClick(object sender, MouseEventArgs e)
        {
            Chart         chart   = (Chart)sender;
            HitTestResult results = chart.HitTest(e.X, e.Y);

            // Check to see if you clicked the chart itself.
            if (results.ChartElementType == ChartElementType.DataPoint)
            {
                // Reset each chart peice to default value.
                foreach (DataPoint point in chart.Series[0].Points)
                {
                    point["Exploded"] = "false";
                    point.BorderWidth = 0;
                }

                // 'Explode' the chart piece.
                // https://forums.asp.net/t/1549781.aspx?Explode+a+slice+of+a+pie+chart+microsoft+chart+controls+
                chart.Series[0].Points[results.PointIndex]["Exploded"] = "true";
                chart.Series[0].Points[results.PointIndex].BorderWidth = 3;
                chart.Series[0].Points[results.PointIndex].BorderColor = Color.Black;

                if (statPanel != null)
                {
                    statPanel.Dispose();
                }

                // re-center the chart.
                chart.Location = new Point(200, (container.Height - chart.Height) / 2);

                if (question > 0 && currentTab < 1)
                {
                    mainCurrentIndex = results.PointIndex;
                }

                // Generate tabs if chart values arn't total.
                if (question > 0)
                {
                    if (tabLayoutPanel == null)
                    {
                        generateTabs(container);
                    }
                }
                ;

                generateStatistics(chart, results.PointIndex);
            }

            // Check to see if you clicked outside of the chart.
            else if (results.ChartElementType == ChartElementType.PlottingArea)
            {
                // Reset the chart's position and state.
                foreach (DataPoint point in chart.Series[0].Points)
                {
                    point["Exploded"] = "false";
                    point.BorderWidth = 0;
                }

                if (statPanel != null)
                {
                    statPanel.Dispose();
                }

                chart.Location = new Point((container.Width - chart.Width) / 2, (container.Height - chart.Height) / 2);
            }
        }
コード例 #29
0
ファイル: Form1.cs プロジェクト: robinli90/Misc_Applications
 private void button4_Click(object sender, EventArgs e)
 {
     REF.Dispose();
 }