protected override void DrawItemCore(ControlGraphicsInfoArgs info, BaseListBoxViewInfo.ItemInfo itemInfo, ListBoxDrawItemEventArgs e) { base.DrawItemCore(info, itemInfo, e); Sample.CustomCheckedListBoxViewInfo.CustomCheckedItemInfo customInfo = itemInfo as Sample.CustomCheckedListBoxViewInfo.CustomCheckedItemInfo; if (customInfo == null) { return; } Rectangle rec = new Rectangle(itemInfo.Bounds.Location, new Size(itemInfo.Bounds.Width, lineWidth)); Color lineColor = ((CustomCheckedListBoxViewInfo)info.ViewInfo).DragDropLineColor; if (customInfo.IsOverLine) { if (customInfo.Index == 0) { rec.Height++; } e.Cache.FillRectangle(lineColor, rec); } if (customInfo.IsUnderLine) { rec.Offset(0, itemInfo.Bounds.Height - lineWidth); if (customInfo.Index == ((CustomCheckedListBoxViewInfo)info.ViewInfo).ItemCountAccessMethod() - 1) { rec.Height++; } e.Cache.FillRectangle(lineColor, rec); } }
private void listBoxControl1_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button != System.Windows.Forms.MouseButtons.Left) { return; } ListBoxControl edit = sender as ListBoxControl; BaseListBoxViewInfo vi = edit.GetViewInfo() as BaseListBoxViewInfo; BaseListBoxViewInfo.ItemInfo ii = vi.GetItemInfoByPoint(e.Location) as BaseListBoxViewInfo.ItemInfo; if (ii == null) { return; } string fileName = listBoxControl1.SelectedItem.ToString(); switch ((ModelType)xtraTabControl1.SelectedTabPageIndex) { case ModelType.All: Gloab.AllData = ModelFile.ReadModel <AllEntity>(fileName, ModelType.All); setAllDataToControl(); break; case ModelType.Gas: UserControl1 u1 = xtraTabControl2.SelectedTabPage.Controls[0] as UserControl1; int index = Gloab.AllData.GasList.FindIndex(c => c.GasID == u1.GasID); Gloab.AllData.GasList[index] = ModelFile.ReadModel <GasEntity>(fileName, ModelType.Gas); Gloab.AllData.GasList[index].GasID = u1.GasID; u1.BindGas(); //gridControl2.DataSource = Gloab.AllData.GasList; gridControl2.RefreshDataSource(); break; //case ModelType.Weather: // break; case ModelType.Normal: Gloab.AllData.Normal = ModelFile.ReadModel <NormalParamEntity>(fileName, ModelType.Normal); Gloab.AllData.NormalList = Gloab.AllData.Normal.ConvertToNormalList(); SetNormalToControl(); break; case ModelType.Serial: Gloab.AllData.Serial = ModelFile.ReadModel <SerialEntity>(fileName, ModelType.Serial); SetSerialParamToPage(Gloab.AllData.Serial); break; default: break; } }
/// <summary> /// Handles the MouseDown event of the _lbcTracks control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e"> /// The <see cref="System.Windows.Forms.MouseEventArgs" /> instance containing the event data. /// </param> private void _lbcTracks_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { //select the item under the mouse BaseListBoxViewInfo vi = _lbcTracks.GetViewInfo() as BaseListBoxViewInfo; BaseListBoxViewInfo.ItemInfo ii = vi.GetItemInfoByPoint(e.Location); if (ii != null) { _lbcTracks.SelectedIndex = ii.Index; Text = ii.Index.ToString(); } } }
private void listBoxControl1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { ListBoxControl edit = sender as ListBoxControl; BaseListBoxViewInfo vi = edit.GetViewInfo() as BaseListBoxViewInfo; BaseListBoxViewInfo.ItemInfo ii = vi.GetItemInfoByPoint(e.Location) as BaseListBoxViewInfo.ItemInfo; if (ii != null) { edit.SelectedIndex = ii.Index; listMenu.Show(Cursor.Position); } else { listMenu.Hide(); } } }
/// <summary> /// Перегружаемый метод прорисовки /// </summary> protected override void DrawItemCore(ControlGraphicsInfoArgs info, BaseListBoxViewInfo.ItemInfo itemInfo, ListBoxDrawItemEventArgs e) { base.DrawItemCore(info, itemInfo, e); var customInfo = itemInfo as CustomCheckedListBoxViewInfo.CustomCheckedItemInfo; if (customInfo == null) { return; } var rec = new Rectangle(itemInfo.Bounds.Location, new Size(itemInfo.Bounds.Width, LineWidth)); var lineColor = ((CustomCheckedListBoxViewInfo)info.ViewInfo).DragDropLineColor; if (itemInfo.Index == 0) { var font = new Font(itemInfo.PaintAppearance.Font.FontFamily, itemInfo.PaintAppearance.Font.Size, FontStyle.Bold); info.Graphics.FillRectangle(Brushes.Lavender, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); e.Graphics.DrawString(itemInfo.Text, font, Brushes.Black, e.Bounds.X, e.Bounds.Y + 2); } if (customInfo.IsOverLine) { if (customInfo.Index == 0) { rec.Height++; } info.Graphics.FillRectangle(info.Cache.GetSolidBrush(lineColor), rec); } if (!customInfo.IsUnderLine) { return; } rec.Offset(0, itemInfo.Bounds.Height - LineWidth); if (customInfo.Index == ((CustomCheckedListBoxViewInfo)info.ViewInfo).ItemCountAccessMethod() - 1) { rec.Height++; } info.Graphics.FillRectangle(info.Cache.GetSolidBrush(lineColor), rec); }
protected override void DrawItemCore(ControlGraphicsInfoArgs info, BaseListBoxViewInfo.ItemInfo itemInfo, ListBoxDrawItemEventArgs e) { base.DrawItemCore(info, itemInfo, e); MRUComboBoxEditPopupListBoxViewInfo viewInfo = info.ViewInfo as MRUComboBoxEditPopupListBoxViewInfo; if (viewInfo == null) { return; } MRUComboBoxEditPopupListBox popupListBox = viewInfo.Owner as MRUComboBoxEditPopupListBox; if (popupListBox == null) { return; } MRUComboBoxEdit comboBox = popupListBox.OwnerEdit as MRUComboBoxEdit; if (comboBox == null) { return; } if (itemInfo.Index == comboBox.Properties.LineItemIndex) { Color borderColor = NativeVista.IsVista ? SystemColors.ControlDark : SystemColors.InactiveBorder; using (Pen pen = new Pen(borderColor)) { e.Graphics.DrawLine(pen, new Point(e.Bounds.Left, e.Bounds.Bottom - 2), new Point(e.Bounds.Right, e.Bounds.Bottom - 2)); e.Graphics.DrawLine(pen, new Point(e.Bounds.Left, e.Bounds.Bottom), new Point(e.Bounds.Right, e.Bounds.Bottom)); } } }
protected override void DrawItemCore(ControlGraphicsInfoArgs info, BaseListBoxViewInfo.ItemInfo itemInfo, ListBoxDrawItemEventArgs e) { itemInfo.State = DrawItemState.None; ((CheckedListBoxViewInfo.CheckedItemInfo)itemInfo).CheckArgs.CheckStyle = CheckStyles.Radio; base.DrawItemCore(info, itemInfo, e); }