Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#15 Use standard widgets

open
nobody
5
2007-12-18
2007-12-18
Luiz Antonio
No

Switch that <-> text in the thumbnail size for a standard spinner widget.

Discussion

  • Luiz Antonio
    Luiz Antonio
    2007-12-18

    Logged In: YES
    user_id=1942972
    Originator: YES

    I came up with this. It'll loose the mouse movement functionality, but will gain the built-in features such as responding to the scroll weel and accepting values typed in the box.

    public class MainForm : System.Windows.Forms.Form {
    ...
    private NumericUpDown thumbnailSizeSpinner;
    ...
    }

    private void InitializeComponent() {
    ...
    //the code inside this method was created by the visual editor
    this.thumbnailSizeSpinner = new System.Windows.Forms.NumericUpDown();
    this.groupBox1.Controls.Add(this.thumbnailSizeSpinner);
    //
    // thumbnailSizeSpinner
    //
    this.thumbnailSizeSpinner.Location = new System.Drawing.Point(140, 65);
    this.thumbnailSizeSpinner.Maximum = new decimal(new int[] {
    270,
    0,
    0,
    0});
    this.thumbnailSizeSpinner.Minimum = new decimal(new int[] {
    70,
    0,
    0,
    0});
    this.thumbnailSizeSpinner.Name = "thumbnailSizeSpinner";
    this.thumbnailSizeSpinner.Size = new System.Drawing.Size(48, 18);
    this.thumbnailSizeSpinner.TabIndex = 18;
    this.thumbnailSizeSpinner.Value = new decimal(new int[] {
    80,
    0,
    0,
    0});
    this.thumbnailSizeSpinner.ValueChanged += new System.EventHandler(this.thumbnailSizeSpinner_ValueChanged);
    ((System.ComponentModel.ISupportInitialize)(this.thumbnailSizeSpinner)).EndInit();
    ...
    }

    #region "spinner"
    private void thumbnailSizeSpinner_ValueChanged(object sender, EventArgs e) {
    BrushCanvas.changeFixSize((int) thumbnailSizeSpinner.Value);
    repaint();
    oldValue = (int) thumbnailSizeSpinner.Value;
    }
    #endregion

    private void launchPainting() {
    //the 2 lines below must be commented
    //this.textBox1.Enabled=false;
    //this.label2.Enabled=false;
    staticsCollector.panelwidth = this.previewCanvas2.ClientSize.Width - BrushCanvas.fix_W/2 - 5;
    PaintProcess paintProcess;
    paintProcess = new PaintProcess(m_EventStopThread, m_EventThreadStopped, this);
    paintProcess.painta();
    }