/// <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); }
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(); } } }