private void OffsetUpDown_ValueChanged(object sender, EventArgs e) { airfoils[(int)IndexUpDown.Value].Transform.Position = new Vector3D(-1, 0, (double)-OffsetUpDown.Value / 10); DrawRegion.Invalidate(); }
private void ScaleUpDown_ValueChanged(object sender, EventArgs e) { airfoils[(int)IndexUpDown.Value].Transform.Scale = new Vector3D((double)ScaleUpDown.Value, (double)ScaleUpDown.Value, 1); DrawRegion.Invalidate(); }
private void new_btn_Click(object sender, EventArgs e) { if (doc1.DrawObjectList.Count > 0) { SaveOfNew save_form = new SaveOfNew(); save_form.StartPosition = FormStartPosition.CenterParent; switch (save_form.ShowDialog()) { case DialogResult.Yes: SaveFileDialog saveFile = new SaveFileDialog(); saveFile.Filter = "configuration (*.xml)|*.xml"; saveFile.InitialDirectory = ""; saveFile.Title = "存储文件"; saveFile.FileName = ""; SaveFile(saveFile); document.DrawObjectList.Clear(); DrawRegion.Invalidate(); break; case DialogResult.No: document.DrawObjectList.Clear(); DrawRegion.Invalidate(); break; } } }
/// <summary> /// Handle the color scheme change. /// </summary> private void ColorSchemeComboBox_SelectedIndexChanged(object sender, EventArgs e) { // Set the color scheme based on the combo box selection. colorScheme = (ColorScheme)colorSchemeCombo.SelectedItem; // Force re-draw. DrawRegion.Invalidate(); }
private void mirror_Click(object sender, EventArgs e) { if (Document.SelectedDrawObjectList.Count > 0) { Document.SelectedDrawObjectList[0].ObjectMirror(); DrawRegion.Invalidate(); } }
private void clw_Click(object sender, EventArgs e) { if (document.SelectedDrawObjectList.Count > 0) { document.SelectedDrawObjectList[0].RotateClw(); DrawRegion.Invalidate(); propertyGrid1.Refresh(); } }
/// <summary> /// Reset the zoom. /// </summary> private void ResetButton_Click(object sender, EventArgs e) { xMin = -2; xMax = 2; yMin = -2; yMax = 2; // Force re-draw. DrawRegion.Invalidate(); }
private void EnlargeAndShortenCanvas(int drawMulti) { int n = document.DrawObjectList.Count; for (int i = 0; i < n; i++) { document.DrawObjectList[i].DrawMultiFactor = drawMulti; } DrawRegion.Invalidate(); ChangeDrawRegionLoction(); }
private void ScaleTypeCombo_SelectedIndexChanged(object sender, EventArgs e) { // Set the scale type based on the combo box selection. ScaleType scaleType = (ScaleType)ScaleTypeCombo.SelectedItem; foreach (GameModel model in airfoils) { model.ScaleType = scaleType; } DrawRegion.Invalidate(); }
private void menuChooseAll_Click(object sender, EventArgs e) { document.SelectedDrawObjectList.Clear(); if (document.DrawObjectList.Count > 0) { foreach (BaseRailEle o in document.DrawObjectList) { document.SelectedDrawObjectList.Add(o); } } DrawRegion.Invalidate(); }
private void shorten_Click(object sender, EventArgs e) { if (DrawRegion.Width > drawregOrigSize.Width) { DrawRegion.Width -= (drawregOrigSize.Width * CONST_MULTI_FACTOR); DrawRegion.Height -= (drawregOrigSize.Height * CONST_MULTI_FACTOR); multiFactor = DrawRegion.Width / drawregOrigSize.Width; document.DrawMultiFactor = multiFactor; int n = document.DrawObjectList.Count; for (int i = 0; i < n; i++) { document.DrawObjectList[i].DrawMultiFactor = multiFactor; } DrawRegion.Invalidate(); ChangeDrawRegionLoction(); } }
/// <summary> /// Perform a simple zoom by dividing the view region in half. /// </summary> private void JuliaSet_MouseClick(Object sender, MouseEventArgs e) { // Convert mouse click screen coords to bounds coords. double boundsX = xMin + (e.X * xDelta); double boundsY = yMin + (e.Y * yDelta); // Zoom the bounds by a factor of 2. bounds /= 2; // Center view around that point. xMin = boundsX - (bounds / 2); xMax = boundsX + (bounds / 2); yMin = boundsY - (bounds / 2); yMax = boundsY + (bounds / 2); // Force re-draw. DrawRegion.Invalidate(); }
/// <summary> /// Handle the samples combo box item selected event. /// </summary> private void SamplesComboBox_SelectedIndexChanged(object sender, EventArgs e) { string sample = (string)sampleCombo.SelectedItem; // TODO: Create a string parser for this. if (sample == "-1.476 + 0i") { cReal = -1.476; cImag = 0; realUpDown.Value = (Decimal)cReal; imagUpDown.Value = (Decimal)cImag; } else if (sample == "-0.12 - 0.77i") { cReal = -0.12; cImag = -0.77; realUpDown.Value = (Decimal)cReal; imagUpDown.Value = (Decimal)cImag; } else if (sample == "-0.162 + 1.04i") { cReal = -0.162; cImag = 1.04; realUpDown.Value = (Decimal)cReal; imagUpDown.Value = (Decimal)cImag; } else if (sample == "-1.25 + 0i") { cReal = -1.25; cImag = 0; realUpDown.Value = (Decimal)cReal; imagUpDown.Value = (Decimal)cImag; } else if (sample == "0.11 + 0.6557i") { cReal = 0.11; cImag = 0.6557; realUpDown.Value = (Decimal)cReal; imagUpDown.Value = (Decimal)cImag; } // Force re-draw. DrawRegion.Invalidate(); }
/// <summary> /// Handle the zoom button click. /// </summary> private void ZoomButton_Click(object sender, EventArgs e) { if (clickCoord == null) { return; } // Determine the zoom factor in bounds coords. double factor = (xMax - xMin) * (double)zoomFactor.Value; // Center view around the click point. xMin = clickCoord.x - (factor / 2); xMax = clickCoord.x + (factor / 2); yMin = clickCoord.y - (factor / 2); yMax = clickCoord.y + (factor / 2); // Force redraw. DrawRegion.Invalidate(); }
private void pictureBox1_MouseUp(object sender, MouseEventArgs e) { if (pic1) { PictureBox pic = sender as PictureBox; Point pt_new_e = PicPtTrans(sender, e); if (0 < pt_new_e.X && DrawRegion.Size.Width > pt_new_e.X && 0 < pt_new_e.Y && DrawRegion.Size.Height > pt_new_e.Y) { BaseRailElement.StraightRailEle strRailEle = new BaseRailElement.StraightRailEle(); Point pt = new Point(pt_new_e.X, pt_new_e.Y); doc1.DrawObjectList.Add(strRailEle.CreatEle(pt, DrawRegion.Size, multiFactor)); doc1.SelectOne(strRailEle); DrawRegion.Invalidate(); propertyGrid1.SelectedObject = strRailEle; propertyGrid1.Invalidate(); } pic1 = false; } this.Cursor = System.Windows.Forms.Cursors.Default; }
private void open_Click(object sender, EventArgs e) { sProjectPath = ""; OpenFileDialog openFile = new OpenFileDialog(); openFile.Filter = "configuration (*.xml)|*.xml"; openFile.InitialDirectory = ""; openFile.Title = "open files"; openFile.FileName = ""; if (openFile.ShowDialog() == DialogResult.OK) { string projectpath = openFile.FileName; string sname = new FileInfo(projectpath).Name; Document = doc1; doc1.DrawObjectList.Clear(); DrawRegion.Top = 0; DrawRegion.Left = 0; DrawRegion.Width = drawregOrigSize.Width; DrawRegion.Height = drawregOrigSize.Height; drapIsDown = false; this.Cursor = System.Windows.Forms.Cursors.Default; try { FileStream fs = new FileStream(projectpath, FileMode.Open); XmlSerializer mySerializer = new XmlSerializer(typeof(DrawDoc)); doc1 = (DrawDoc)mySerializer.Deserialize(fs); fs.Close(); Document = doc1; } catch { MessageBox.Show("open error"); } } DrawRegion.Invalidate(); }
private void DrawRegion_MouseDown(object sender, MouseEventArgs e) { controlPoints.Add(new Vector3D(e.X, e.Y, 0)); DrawRegion.Invalidate(); }
private void Interactive_CheckedChanged(object sender, EventArgs e) { controlPoints.Clear(); DrawRegion.BackColor = System.Drawing.Color.White; DrawRegion.Invalidate(); }
/// <summary> /// Calculate the Julia set colors. /// </summary> private void CalculateButton_Click(object sender, EventArgs e) { // Force re-draw. DrawRegion.Invalidate(); }
private void copy_Click(object sender, EventArgs e) { doc1.Copy(); DrawRegion.Invalidate(); }
private void RotationUpDown_ValueChanged(object sender, EventArgs e) { airfoils[(int)IndexUpDown.Value].Transform.Rotation = (float)RotationUpDown.Value; DrawRegion.Invalidate(); }
private void delete_Click(object sender, EventArgs e) { doc1.Delete(); DrawRegion.Invalidate(); }
/// <summary> /// Generate the original NACA airfoil points. /// </summary> private void GenerateAirfoilPoints() { float x, c, yt, temp, ts, tt, tf, r, dycdx, theta; int naca, thick, camb, cambd, front; float mask; p = 0.0; t = 0.0; m = 0.0; naca = int.Parse(comboBox1.Text); mask = (float)naca; mask = (float)(mask / 100.0); front = naca / 100; mask = (float)((mask - front) * 100.0 + 0.001); thick = (int)mask; MT.Text = thick.ToString() + " %"; mask = (float)front; camb = front / 10; MXC.Text = camb.ToString() + " %"; mask = (float)(mask / 10.0); mask = (float)((mask - camb) * 10.0); cambd = (int)(mask + 0.01); t = (float)(thick / 100.0); DtMc.Text = cambd.ToString() + "0%"; t = (float)(thick / 100.0); p = (double)(cambd) / 10; m = (double)(camb) / 100.0; xl = new float[101]; yl = new float[101]; xu = new float[101]; yu = new float[101]; yc = new float[101]; c = (float)1.0; xl1 = 0; yl1 = 200; xu1 = 0; yu1 = 200; yc1 = 200; xc1 = 0; listBox1.Items.Clear(); for (i = 0; i <= 100; i++) { x = i; x = x / (float)100.0; temp = x / c; ts = temp * temp; tt = ts * temp; tf = tt * temp; yt = (float)(5.0 * t * c * (0.2969 * Math.Sqrt(temp) - 0.1260 * (temp) - 0.3516 * ts + 0.2843 * tt - 0.1015 * tf)); if (p < 0.00001) { yc[i] = (float)0.0; dycdx = (float)0.0; theta = (float)0.0; } else { if (x <= p * c) { yc[i] = (float)(m * (x / (p * p)) * (2.0 * p - x / c)); dycdx = (float)((2.0 * m) / (p * p) * (p - x / c)); } else { yc[i] = (float)(m * (c - x) / ((1 - p) * (1 - p)) * (1.0 + x / c - 2.0 * p)); dycdx = (float)((2.0 * m) / ((1 - p) * (1 - p)) * (p - x / c)); } theta = (float)Math.Atan(dycdx); } xl[i] = (float)(x + yt * Math.Sin(theta)); yl[i] = (float)(yc[i] - yt * Math.Cos(theta)); xu[i] = (float)(x - yt * Math.Sin(theta)); yu[i] = (float)(yc[i] + yt * Math.Cos(theta)); listBox1.Items.Add("XL[" + i + "]= " + xl[i] + " YL[" + i + "]= " + yl[i] + " XU[" + i + "]=" + xu[i] + " YU[" + i + "]= " + yu[i] + " YC[" + i + "]= " + yc[i]); } r = (float)(1.1019 * t * t); CRALE.Text = r.ToString(); DrawRegion.BackColor = System.Drawing.Color.White; DrawRegion.Invalidate(); initialized = true; }
private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { objectEvent.ChangePropertyValue(); DrawRegion.Invalidate(); }
private void addtext_Click(object sender, EventArgs e) { BaseRailElement.RailLabal railLalal = new RailLabal(); document.DrawObjectList.Add(railLalal.CreatEle(multiFactor)); DrawRegion.Invalidate(); }