Ejemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Releases the unmanaged resources used by the <see cref="T:System.Windows.Forms.ListView"/> and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
        /// ------------------------------------------------------------------------------------
        protected override void Dispose(bool disposing)
        {
            Debug.WriteLineIf(!disposing, "****************** Missing Dispose() call for " + GetType().Name + ". ******************");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (m_imgList != null)
                {
                    m_imgList.Dispose();
                }
                if (m_timer != null)
                {
                    m_timer.Dispose();
                    m_timer = null;
                }
                if (m_tooltip != null)
                {
                    m_tooltip.Dispose();
                    m_tooltip = null;
                }
            }
            m_imgList = null;
            m_bv      = null;

            base.Dispose(disposing);
        }
Ejemplo n.º 2
0
        public bool EmptyValidate(Control ctl)
        {
            IRyanControl c = ctl as IRyanControl;

            _ValidateState = true;
            if (!c.AllowEmpty)
            {
                if ((c.RemoveSpace && ctl.Text.Trim() == "") || ctl.Text == "")
                {
                    c.EmptyMessage = "输入不能为空!";
                    ShowErrorMessage(ctl, c.EmptyMessage);
                    c.SelectAll();
                    //ctl.Focus();
                    _ValidateState = false;
                    return(false);
                }
                else
                {
                    if (_tooltip != null)
                    {
                        _tooltip.Dispose();
                    }
                }
            }
            else
            {
                if (_tooltip != null)
                {
                    _tooltip.Dispose();
                }
            }
            return(true);
        }
Ejemplo n.º 3
0
        private void OnTop_click(object sender, EventArgs e)
        {
            string text, setting;
            int textWidth;

            if (TopMost)
            {
                TopMost = false;
                text = "Window won't stay on top anymore";
                textWidth = 100;
                setting = OnTopMode.False;
            }
            else
            {
                TopMost = true;
                text = "Window will stay on top";
                textWidth = 60;
                setting = OnTopMode.True;
            }

            if (hisPanel != null)
                hisPanel.TopMost = TopMost;

            tip.Dispose();
            tip = new ToolTip();
            int yLoc = txtURL.Location.Y - (txtURL.Height);
            tip.Show(text, this, (this.Width / 2) - textWidth, yLoc, 2000);

            Utils.SaveConfig(Settings.OnTop, setting);
        }
Ejemplo n.º 4
0
 void ToolTipListBox_MouseLeave(object sender, EventArgs e)
 {
     if (currentToolTip != null)
     {
         currentToolTip.Hide(this);
         currentToolTip.Dispose();
     }
 }
Ejemplo n.º 5
0
 private void GitHubPage_MouseHover(object sender, EventArgs e)
 {
     DynamicToolTip.Dispose();
     DynamicToolTip              = new ToolTip();
     DynamicToolTip.ToolTipIcon  = ToolTipIcon.Info;
     DynamicToolTip.ToolTipTitle = "GitHub";
     DynamicToolTip.SetToolTip(GitHubPage, "Open the official GitHub project page");
 }
Ejemplo n.º 6
0
 private void BecomePatron_MouseHover(object sender, EventArgs e)
 {
     DynamicToolTip.Dispose();
     DynamicToolTip              = new ToolTip();
     DynamicToolTip.ToolTipIcon  = ToolTipIcon.Info;
     DynamicToolTip.ToolTipTitle = "Patreon";
     DynamicToolTip.SetToolTip(BecomePatron, "Click here to visit my Patreon page");
 }
Ejemplo n.º 7
0
        protected override void Dispose(bool disposing)
        {
            if (errorNoticeTooltip != null)
            {
                errorNoticeTooltip.Dispose();
            }

            base.Dispose(disposing);
        }
Ejemplo n.º 8
0
 public static void DisplayTooltip(string text, IWin32Window parent, int durationSeconds = 0)
 {
     if (tt != null)
     {
         tt.Dispose();
     }
     tt = new ToolTip();
     tt.InitialDelay = 0;
     tt.Show(string.Empty, parent);
     tt.Show(text, parent, durationSeconds * 1000);
 }
        private void TreeViewImage_MouseClick(object sender, MouseEventArgs e)
        {
            string   noArgumentsMessage = "[No arguments to display]";
            Point    mouseLocation      = new Point(e.X, e.Y);
            NodeIcon selectedIcon       = GetMatchingNodeIcon(mouseLocation);

            if (selectedIcon != null)
            {
                if (_currentToolTip != null)
                {
                    _currentToolTip.Hide(treeViewImage);
                    _currentToolTip.Dispose();
                    _currentToolTip = null;
                }

                string text = string.Empty;
                if (selectedIcon is TreeNodeIcon)
                {
                    TreeNodeIcon treeIcon = selectedIcon as TreeNodeIcon;
                    text = FormatText(treeIcon.Node.Arguments);
                    if (string.IsNullOrEmpty(text))
                    {
                        text = noArgumentsMessage;
                    }

                    text = treeIcon.Node.OperationName + Environment.NewLine + text;
                }
                else if (selectedIcon is MemoNodeIcon)
                {
                    MemoNodeIcon memoIcon = selectedIcon as MemoNodeIcon;
                    text = FormatText(memoIcon.Node.Arguments);
                    if (string.IsNullOrEmpty(text))
                    {
                        text = noArgumentsMessage;
                    }

                    text = memoIcon.Node.OperationName + Environment.NewLine + text;
                }

                text = text.Trim();

                int numberOfLines = text.Count(c => c == '\r') + 1;

                _currentToolTip           = new ToolTip();
                _currentToolTip.IsBalloon = true;
                _currentToolTip.Show(
                    text,
                    treeViewImage,
                    selectedIcon.Left + selectedIcon.Width - 25,
                    selectedIcon.Top - 44 - 13 * numberOfLines);
                _toolTipMouseLocation = mouseLocation;
                _currentNodeIcon      = selectedIcon;
            }
        }
 private void saveButton_Click(object sender, EventArgs e)
 {
     if (!ValidToSave())
     {
         this.DialogResult = DialogResult.None;
     }
     else
     {
         SaveSubscription();
         InvalidParamToolTip.Dispose();
     }
 }
Ejemplo n.º 11
0
 private void textBox1_Enter(object sender, EventArgs e)
 {
     if (tt != null)
     {
         tt.Dispose();
     }
     tt = new ToolTip();
     tt.InitialDelay = 0;
     tt.IsBalloon    = false;
     tt.Show(string.Empty, textBox1);
     tt.UseAnimation = true;
     tt.Show("Фильтр\nИспользуйте ; для фильтрации нескольких параметров\nПример: Зона;12;используется ", textBox1, 0);
 }
Ejemplo n.º 12
0
 public void Hide()
 {
     if (_pb != null)
     {
         _pb.Visible = false;
     }
     if (_pbox != null)
     {
         _pbox.Visible = false;
     }
     if (_tip != null)
     {
         _tip.Dispose();
     }
 }
Ejemplo n.º 13
0
        public SwizzleUI()
        {
            InitializeComponent();
            m_tt = new ToolTip();

            m_btn_help.Click += (s, a) =>
            {
                SwizzleHelpUI.Show();
            };
            m_edit_source.TextChanged += (s, a) =>
            {
                UpdateUI();
            };
            m_edit_output.TextChanged += (s, a) =>
            {
                UpdateUI();
            };
            m_edit_test.TextChanged += (s, a) =>
            {
                UpdateUI();
            };
            Shown    += (s, a) => UpdateUI();
            Disposed += (s, a) =>
            {
                m_tt.Dispose();
            };
        }
Ejemplo n.º 14
0
 public void ShowToolTip(Control control, string text)
 {
     if (tp != null)
     {
         tp.Dispose();
     }
     tp              = new ToolTip();
     tp.UseFading    = true;
     tp.UseAnimation = true;
     tp.IsBalloon    = true;
     tp.ShowAlways   = true;
     if (string.IsNullOrEmpty(control.Text.Replace(".", "").Trim()))
     {
         tp.Show(text, control, 0, -control.Height - 11, 5000);
     }
 }
Ejemplo n.º 15
0
 public void Cleanup()
 {
     if (m_invalidParamToolTip != null)
     {
         m_invalidParamToolTip.Dispose();
     }
 }
Ejemplo n.º 16
0
 private bool ValidateRequiredTextBox()
 {
     foreach (TextBox t in this.ListValidator.OrderBy(r => r.TabIndex).ToList())
     {
         if (string.IsNullOrEmpty(t.Text.Trim()))
         {
             tt.Dispose();
             tt = new ToolTip
             {
                 ToolTipTitle = "提示!",
                 AutoPopDelay = 5000,
                 InitialDelay = 1000,
                 ReshowDelay  = 500,
                 ShowAlways   = true,
                 ToolTipIcon  = ToolTipIcon.Warning,
                 IsBalloon    = true
             };
             tt.SetToolTip(t, "NoText!");
             this.tt.Show("请填写信息", t, 5000);
             t.Focus();
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 17
0
        private void ShowToolTip(string regionName)
        {
            tt?.Dispose();
            tt           = new ToolTip();
            tt.BackColor = Color.LightYellow;
            string value = "";

            foreach (var row in output)
            {
                if (row.Key == regionName)
                {
                    value = (row.Value == -1)? output_text_value_blank:row.Value.ToString();
                    break;
                }
            }
            int tag = -1;

            tt.Tag = tag;
            string k = "";

            if (int.TryParse(value, out tag))
            {
                tt.Tag = tag;
                k      = "Koeficient: ";
            }
            tt.SetToolTip(canvas, regionName.ToUpper() + Environment.NewLine + k + value);
            tt.OwnerDraw = true;
            tt.Popup    += new PopupEventHandler(tooltip_Popup);
            tt.Draw     += new DrawToolTipEventHandler(toolTip_Draw);
        }
Ejemplo n.º 18
0
 /// <summary></summary>
 protected override void Dispose(bool disposing)
 {
     Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType() + ". ****** ");
     if (disposing && !IsDisposed)
     {
         if (m_buttons != null)
         {
             for (int i = 0; i < m_buttons.Count; i++)
             {
                 m_buttons[i].Dispose();
             }
             m_buttons.Clear();
         }
         if (m_toolTip != null)
         {
             m_toolTip.Dispose();
         }
         if (components != null)
         {
             components.Dispose();
         }
     }
     m_buttons = null;
     m_toolTip = null;
     base.Dispose(disposing);
 }
Ejemplo n.º 19
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_defaultFont != null)
         {
             _defaultFont.Dispose();
         }
         if (_glassDownImg != null)
         {
             _glassDownImg.Dispose();
         }
         if (_glassHotImg != null)
         {
             _glassHotImg.Dispose();
         }
         if (_toolTip != null)
         {
             _toolTip.Dispose();
         }
     }
     _defaultFont  = null;
     _glassDownImg = null;
     _glassHotImg  = null;
     _toolTip      = null;
     base.Dispose(disposing);
 }
Ejemplo n.º 20
0
        private void panelMap_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                currentXY.X = e.X / CELL_WIDTH;
                currentXY.Y = e.Y / CELL_WIDTH;
                char a = 'A';
                a += (char)currentXY.X;
                labelSelectedX.Text = a.ToString();
                labelSelectedY.Text = (currentXY.Y + 1).ToString();
            }
            else if (e.Button == MouseButtons.Right)
            {
                if (toolTip != null)
                {
                    toolTip.Dispose();
                }
                char letter = 'A';
                letter += (char)((e.X / CELL_WIDTH));
                String text = letter + ((e.Y / CELL_WIDTH) + 1).ToString();
                if (mapa[0][0].TerrainName != null)
                {
                    toolTip = new ToolTip();
                    text   += '\n' + mapa[e.Y / CELL_WIDTH][e.X / CELL_WIDTH].TerrainName;
                    text   += '\n' + mapa[e.Y / CELL_WIDTH][e.X / CELL_WIDTH].listStepsString();
                }

                toolTip = new ToolTip();

                toolTip.Show(text, panelMap, e.X, e.Y - 20, 1000);
            }
        }
Ejemplo n.º 21
0
        private void Initialize(TreeListCell cell)
        {
            if (inner != null)
            {
                inner.Dispose();
            }

            var font = cell.Column.Font ?? cell.Column.TreeList.Font;

            size         = TextRenderer.MeasureText(cell.Text, font);
            size.Height += 8;
            size.Width  += 6;

            inner = new ToolTip();
            inner.ToolTipTitle = "dfdsafafd";
            inner.OwnerDraw    = true;
            inner.Popup       += (o, e) =>
            {
                e.ToolTipSize = size;
            };

            inner.Draw += (o, e) =>
            {
                var flags = TextFormatFlags.VerticalCenter;
                var r     = e.Bounds;
                r.Offset(3, 0);
                using (var br = new LinearGradientBrush(e.Bounds, Color.White, Color.LightGray, 90))
                {
                    e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds);
                }

                e.DrawBorder();
                TextRenderer.DrawText(e.Graphics, cell.Text, font, r, Color.Black, flags);
            };
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }

            _closeTimer.Dispose();

            this.Icon.Dispose();
            this.Icon = null;

            _iconPrev.Dispose();
            _iconInbox.Dispose();
            _iconNext.Dispose();

            if (_PictureOpen != null)
            {
                _PictureOpen.Image.Dispose();
            }

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


            base.Dispose(disposing);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
                foreach (ToolTip tt in toolTips)
                {
                    tt.Dispose();
                }
                if (titleTip != null)
                {
                    titleTip.Dispose();
                }
                foreach (DayLabel dl in dayLabels)
                {
                    dl.Dispose();
                }
                foreach (Label dnl in dayNameLabels)
                {
                    dnl.Dispose();
                }
//				titleBar.Dispose();
//				calFont.Dispose();
//				dayFont.Dispose();
//				selectedDayFont.Dispose();
            }
            base.Dispose(disposing);
        }
Ejemplo n.º 24
0
 public void Dispose()
 {
     if (_tooltip != null)
     {
         _tooltip.Dispose();
     }
 }
Ejemplo n.º 25
0
 protected override void OnTextChanged(EventArgs e)
 {
     base.OnTextChanged(e);
     if (m_tooltip != null)
     {
         m_tooltip.Dispose();                    // 如果tooltip已经存在则销毁
     }
     if (!EmptyValidate(this.Text))
     {
         return;
     }
     if (!RegexExpressionValidate(this.Text))
     {
         return;
     }
 }
Ejemplo n.º 26
0
 private void PedigreeCreature_Disposed(object sender, EventArgs e)
 {
     _ttMonospaced.RemoveAll();
     _ttMonospaced.Dispose();
     _tt.RemoveAll();
     _tt.Dispose();
 }
Ejemplo n.º 27
0
        public static void SetToolTip(Control ctr, string tip)
        {
            ToolTip toolTip = new ToolTip();

            toolTip.SetToolTip(ctr, tip);
            ctr.Disposed += (sender, e) => toolTip.Dispose();
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Removes any and all tooltips for a control
        /// </summary>
        /// <param name="control"></param>
        public static void RemoveToolTip(Control control)
        {
            ToolTip T = ToolTips[control.Name];

            T.Dispose();
            ToolTips.Remove(control.Name);
        }
Ejemplo n.º 29
0
        public CodeLookupUI(Dictionary <string, string> values)
        {
            InitializeComponent();
            Values = values.Select(x => new Pair(x.Key, x.Value)).ToList();
            m_src  = new BindingSource {
                DataSource = Values, AllowNew = true, Sort = "Key"
            };
            m_tt = new ToolTip();

            // Lookup table
            m_grid.AutoGenerateColumns = false;
            m_grid.Columns.Add(new DataGridViewTextBoxColumn {
                Name = "Code", HeaderText = "Code", DataPropertyName = "Key", FillWeight = 1
            });
            m_grid.Columns.Add(new DataGridViewTextBoxColumn {
                Name = "Value", HeaderText = "Value", DataPropertyName = "Value", FillWeight = 2
            });
            m_grid.DataError += (s, a) => a.Cancel = true;
            m_grid.DataSource = m_src;

            // Export
            m_btn_export.ToolTip(m_tt, "Export the code/value list to file");
            m_btn_export.Click += (s, a) => ExportCodeLookupList();

            // Import
            m_btn_import.ToolTip(m_tt, "Import code/value pairs from file");
            m_btn_import.Click += (s, a) => ImportCodeLookupList();

            Disposed += (s, a) =>
            {
                m_tt.Dispose();
            };
        }
Ejemplo n.º 30
0
 public void Dispose()
 {
     if (toolTip != null)
     {
         toolTip.Dispose();
         toolTip = null;
     }
 }