Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/01/12 15:15:22 (12 years ago)
Author:
abeham
Message:

#1614

  • Fixed plugin dependencies
  • Updated GQAP view
  • Changed instances infrastructure
    • Changed interface types into classes
    • Removed the library specific instance classes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/ToolTipComboBox.cs

    r7523 r7538  
    2929
    3030    private ComboBoxState comboBoxState = ComboBoxState.Normal;
    31     private bool mouseOver = false;
    3231
    3332    public ToolTipComboBox()
     
    3635      SetStyle(ControlStyles.UserPaint, true);
    3736      InitializeComponent();
    38       DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
     37      DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
    3938      DropDownStyle = ComboBoxStyle.DropDownList;
    40     }
    41 
    42     protected override void OnMeasureItem(MeasureItemEventArgs e) {
    43       base.OnMeasureItem(e);
    44       string text = GetItemText(Items[e.Index]);
    45       if (string.IsNullOrEmpty(text)) text = "test";
    46       var rect = TextRenderer.MeasureText(text, Font);
    47       e.ItemHeight = rect.Height - 2;
    48       e.ItemWidth = rect.Width;
    4939    }
    5040
     
    7262        } else {
    7363          using (var b = new SolidBrush(ForeColor)) {
    74             Rectangle r = e.Bounds;
    75             r.Offset(0, 1);
    76             e.Graphics.DrawString(GetItemText(Items[e.Index]), Font, b, r);
     64            var rect = new Rectangle(2, 4, Size.Width - 2, Size.Height - 4);
     65            e.Graphics.DrawString(GetItemText(Items[e.Index]), Font, b, rect);
    7766          }
    7867        }
     
    8473      base.OnPaint(e);
    8574      if (Enabled == false) comboBoxState = ComboBoxState.Disabled;
    86       Rectangle clip = Bounds; // using e.ClipRectangle leads to strange behavior when maximizing/unmaximizing, just redraw the entire region all the time
    87       clip.Offset(-clip.X, -clip.Y); // x and y need to be 0
     75      Rectangle clip = new Rectangle(new Point(0, 0), Size);
     76      clip.Inflate(0, 1);
    8877      if (VisualStyleInformation.IsSupportedByOS && VisualStyleInformation.IsEnabledByUser) {
    8978        PushButtonState pb_State = PushButtonState.Normal;
     
    10998        ComboBoxRenderer.DrawDropDownButton(e.Graphics, r, comboBoxState);
    11099      }
    111       Rectangle rect = clip;
    112       rect.Inflate(-2, -4);
    113       rect.Offset(1, 0);
     100      var rect = new Rectangle(2, 4, Size.Width - 2, Size.Height - 4);
    114101      if (SelectedIndex > -1 && Items.Count > 0) {
    115102        using (var b = new SolidBrush(ForeColor)) {
     
    141128    protected override void OnMouseEnter(EventArgs e) {
    142129      base.OnMouseEnter(e);
    143       mouseOver = true;
    144130      if (comboBoxState == ComboBoxState.Normal) {
    145131        comboBoxState = ComboBoxState.Hot;
     
    158144    protected override void OnMouseLeave(EventArgs e) {
    159145      base.OnMouseLeave(e);
    160       mouseOver = false;
    161146      if (comboBoxState == ComboBoxState.Hot) {
    162147        comboBoxState = ComboBoxState.Normal;
     
    167152    protected override void OnMouseDown(MouseEventArgs e) {
    168153      base.OnMouseDown(e);
    169       comboBoxState = ComboBoxState.Pressed;
    170       Invalidate();
     154      if (e.Button == MouseButtons.Left) {
     155        comboBoxState = ComboBoxState.Pressed;
     156        Invalidate();
     157      }
    171158    }
    172159
Note: See TracChangeset for help on using the changeset viewer.