예제 #1
0
            private void ShowListBox()
            {
                if (!_isAdded || ListBoxPositionChange)
                {
                    control.Controls.Add(_listBox);


                    var cellRectangle = control.GetCellDisplayRectangle(control.SelectedCells[0].ColumnIndex, control.SelectedCells[0].RowIndex, true);

                    int offset = this.control.FindForm().Height - 25 - cellRectangle.Y;
                    if (offset > this.control.FindForm().Height / 2)
                    {
                        _listBox.Left = cellRectangle.Left;
                        _listBox.Top  = cellRectangle.Top + cellRectangle.Height;
                    }
                    else
                    {
                        _listBox.Left = cellRectangle.Left;
                        _listBox.Top  = cellRectangle.Top - _listBox.Height;
                    }

                    _isAdded = true;
                    ListBoxPositionChange = false;

                    _listBox.BringToFront();
                }
                _listBox.Visible = true;
            }
예제 #2
0
        private void OnTimerTick(object sender, EventArgs e)
        {
            if (this._showTimer != null)
            {
                if (!IsRun)
                {
                    return;
                }

                this._showTimer.Stop();
                if (null != _toolTipText && !string.IsNullOrWhiteSpace(_toolTipText.ToString()))
                {
                    //if (TooltipCellRowIndex ==  CurrentCellRowIndex && TooltipCellColumnIndex ==  CurrentCellColumnIndex)
                    //{

                    SizeF sizeF      = TextRenderer.MeasureText(this._toolTipText.ToString(), Oybab.ServicePC.Pattern.PaletteBlue.GetSelf().currentResourceFont);
                    float textLength = sizeF.Width;

                    if (krpdgList.RowCount > TooltipCellRowIndex && krpdgList.ColumnCount > TooltipCellColumnIndex && textLength > this.krpdgList[TooltipCellColumnIndex, TooltipCellRowIndex].Size.Width)
                    {
                        IsTooltipDisplayed = true;
                        ShowTime           = DateTime.Now;

                        Rectangle cellRect       = krpdgList.GetCellDisplayRectangle(TooltipCellColumnIndex, TooltipCellRowIndex, false);
                        Point     locationOnForm = krpdgList.FindForm().PointToClient(krpdgList.Parent.PointToScreen(krpdgList.Location));

                        string text = this._toolTipText.ToString();

                        if (text.Length > 1000)
                        {
                            this._toolTipText = text = text.Substring(0, 1000) + ".........";
                        }


                        _customTooltip.Show(text,
                                            form,
                                            cellRect.X + locationOnForm.X + 10,
                                            cellRect.Y + locationOnForm.Y + 25 - 10); // Duration: 5 seconds.
                        // }
                    }
                }
            }
        }