private void btnSegment_CheckedChanged(object sender, EventArgs e) { if (btnSegment.Checked) { _shapeMode = ShapeMode.Segment; } }
public MiniPaint() { InitializeComponent(); this.MouseDown += MiniPaint_MouseDown; this.MouseMove += MiniPaint_MouseMove; this.MouseUp += MiniPaint_MouseUp; this.Paint += MiniPaint_Paint; _bm = new Bitmap(this.Width, this.Height); _grs = Graphics.FromImage(_bm); _currColor = Color.Black; _currShapeMode = ShapeMode.LINE; //Giảm hiện tượng rung cho form this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); //Thêm vào item cho comboBox InitComboBoxSize(); _font = new Font("Arial", 13); //Khởi tạo danh sách Bitmap dsBitmap = new List <Bitmap>(); dsT = new List <Bitmap>(); _currPosition = 0; }
} // форма объекта // загрузчики моделей из файлов // public static _3dsReader boxReader; //private static _3dsReader chamferBoxReader = new _3dsReader("models/ChamferBox.3DS"); // public static _3dsReader sphereReader; public Model(ModelPoint[] points, ushort[] indices, ShapeMode shape) { this.points = points; this.indices = indices; Shape = shape; InitializeVBO(); }
private void btnRectangle_CheckedChanged(object sender, EventArgs e) { if (btnRectangle.Checked) { _shapeMode = ShapeMode.Rectangle; } }
private void btnCircleFromCenter_CheckedChanged(object sender, EventArgs e) { if (btnCircleFromCenter.Checked) { _shapeMode = ShapeMode.CircleFromCenter; } }
private void btnZoom_CheckedChanged(object sender, EventArgs e) { if (btnZoom.Checked) { _shapeMode = ShapeMode.Zoom; } }
private static IShape BuildCurrentShape(ShapeMode mode, RealPoint startPoint, RealPoint endPoint) { IShape output = null; switch (mode) { case ShapeMode.Rectangle: output = new PolygonRectangle(startPoint, endPoint.X - startPoint.X, endPoint.Y - startPoint.Y); break; case ShapeMode.Circle: output = new Circle(new Segment(startPoint, endPoint).Barycenter, startPoint.Distance(endPoint) / 2); break; case ShapeMode.CircleFromCenter: output = new Circle(startPoint, startPoint.Distance(endPoint)); break; case ShapeMode.Segment: output = new Segment(startPoint, endPoint); break; case ShapeMode.Line: output = new Line(startPoint, endPoint); break; } return(output); }
/// <summary> /// 図形モードの閉じるときのイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ModeDialog_FormClosing(object sender, FormClosingEventArgs e) { ShapeModeDialog2 modeDialog = (ShapeModeDialog2)sender; m_modeDialog = modeDialog; m_shapeMode = (ShapeMode)Properties.Settings.Default.SHAPE_MODE_INDEX; //初期化 for (int i = 0; i < TsmiShapeMode.DropDownItems.Count; i++) { ToolStripMenuItem item = TsmiShapeMode.DropDownItems[i] as ToolStripMenuItem; item.Checked = false; } //チェックを付ける switch (m_shapeMode) { case ShapeMode.Circle: TsmiCircle.Checked = true; break; case ShapeMode.Square: TsmiSquare.Checked = true; break; case ShapeMode.StraightLine: TsmiStraightLine.Checked = true; break; } }
public VertigoContext(ShapeMode shapeMode = ShapeMode.SDF, IDrawCallBatcher batcher = null, MaterialPool materialPool = null) { if (batcher == null) { batcher = new DefaultDrawCallBatcher(); } if (materialPool == null) { materialPool = DefaultMaterialPool; } this.defaultShapeMode = shapeMode; this.renderTextures = new Stack <RenderTexture>(); this.renderCalls = new StructList <RenderCall>(); this.renderTexturesToRelease = new LightList <RenderTexture>(); this.batcher = batcher; this.materialPool = materialPool; this.stateStack = new Stack <VertigoState>(); this.position = Vector3.zero; this.rotation = Quaternion.identity; this.scale = Vector3.one; this.shapeGenerator = new ShapeGenerator(); this.geometryGenerator = new GeometryGenerator(); this.geometryCache = new GeometryCache(); }
/// <summary> /// 図形モードをクリックしたとき /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnShapeMode_Click(object sender, EventArgs e) { m_modeDialog = new ShapeModeDialog2(); if (m_modeDialog.ShowDialog() == DialogResult.OK) { m_shapeMode = (ShapeMode)Properties.Settings.Default.SHAPE_MODE_INDEX; } for (int i = 0; i < TsmiShapeMode.DropDownItems.Count; i++) { ToolStripMenuItem item = TsmiShapeMode.DropDownItems[i] as ToolStripMenuItem; item.Checked = false; } //チェックを付ける switch (m_shapeMode) { case ShapeMode.Circle: TsmiCircle.Checked = true; break; case ShapeMode.Square: TsmiSquare.Checked = true; break; case ShapeMode.StraightLine: TsmiStraightLine.Checked = true; break; } }
/// <summary> /// 画面がロードされたとき /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainForm_Load(object sender, EventArgs e) { //リサイズ出来ないようにする this.MaximumSize = this.Size; this.MinimumSize = this.Size; //ペンの色の初期化 Properties.Settings.Default.PEN_COLOR = Color.Black; m_shapeMode = ShapeMode.StraightLine; Properties.Settings.Default.PEN_BOLD = 2; m_image = new Bitmap(PbCanvas.Width, PbCanvas.Height); TsmiStraightLine.Checked = true; //イベントハンドラ登録 PbCanvas.MouseDown += new MouseEventHandler(PbCanvas_MouseDown); PbCanvas.MouseUp += new MouseEventHandler(PbCanvas_MouseUp); PbCanvas.MouseMove += new MouseEventHandler(PbCanvas_MouseMove); //ショートカット設定 TsmiNew.ShortcutKeys = Keys.Control | Keys.N; TsmiOpen.ShortcutKeys = Keys.Control | Keys.O; TsmiSave.ShortcutKeys = Keys.Control | Keys.S; TsmiSaveAs.ShortcutKeys = Keys.Control | Keys.Shift | Keys.S; TsmiPrint.ShortcutKeys = Keys.Control | Keys.P; TsmiFinish.ShortcutKeys = Keys.Control | Keys.F; }
public static void Rectangle( this RenderContext context, ShapeMode mode, Vector2 position, Size size, Color color ) => context.Rectangle(mode, position, size.Width, size.Height, color);
private void btnText_Click(object sender, EventArgs e) { frmText frm = new frmText(); frm.ShowDialog(); _currShapeMode = ShapeMode.TEXT; }
public static void Circle( this RenderContext context, ShapeMode mode, Vector2 position, float radius, Color color ) => context.Circle(mode, position.X, position.Y, radius, color);
private void btnLine_CheckedChanged(object sender, EventArgs e) { if (btnLine.Checked) { _shapeMode = ShapeMode.Line; } }
public static void Rectangle( this RenderContext context, ShapeMode mode, Vector2 position, float width, float height, Color color ) => context.Rectangle(mode, position.X, position.Y, width, height, color);
public static void Triangle( this RenderContext context, ShapeMode mode, Vector2 a, Vector2 b, Vector2 c, Color color ) => context.Triangle(mode, a.X, a.Y, b.X, b.Y, c.X, c.Y, color);
public static void Ellipse( this RenderContext context, ShapeMode mode, Vector2 position, Vector2 radii, float rotation, Color color ) => context.Ellipse(mode, position.X, position.Y, radii.X, radii.Y, rotation, color);
public static void Arc( this RenderContext context, ShapeMode mode, Vector2 position, float radius, float startAngle, float endAngle, Color color ) => context.Arc(mode, position.X, position.Y, radius, startAngle, endAngle, color);
private void btDrawEllipse_Click(object sender, EventArgs e) { pen = new Pen(_currLeftColor, _currPenSize); _currShapeMode = ShapeMode.DRAWELLIPSE; this.btDrawLine.FlatStyle = FlatStyle.Standard; this.btDrawRect.FlatStyle = FlatStyle.Standard; this.btDrawEllipse.FlatStyle = FlatStyle.Flat; this.btFillRect.FlatStyle = FlatStyle.Standard; this.btFillEllipse.FlatStyle = FlatStyle.Standard; }
/// <summary> /// 円モード(メニュー) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TsmiCircleMode_Click(object sender, EventArgs e) { m_shapeMode = ShapeMode.Circle; for (int i = 0; i < TsmiShapeMode.DropDownItems.Count; i++) { ToolStripMenuItem item = TsmiShapeMode.DropDownItems[i] as ToolStripMenuItem; item.Checked = false; } TsmiCircle.Checked = true; }
private void btFillEllipse_Click(object sender, EventArgs e) { sb = new SolidBrush(_currLeftColor); _currShapeMode = ShapeMode.FILLELLIPSE; this.btDrawLine.FlatStyle = FlatStyle.Standard; this.btDrawRect.FlatStyle = FlatStyle.Standard; this.btDrawEllipse.FlatStyle = FlatStyle.Standard; this.btFillRect.FlatStyle = FlatStyle.Standard; this.btFillEllipse.FlatStyle = FlatStyle.Flat; }
private void btnSquare_Click(object sender, EventArgs e) { if (btnFill.Checked) { _currShapeMode = ShapeMode.FILLSQUARE; } else { _currShapeMode = ShapeMode.DRAWSQUARE; } }
private void btnEclipse_Click(object sender, EventArgs e) { if (btnFill.Checked) { _currShapeMode = ShapeMode.FILLELLIPSE; } else { _currShapeMode = ShapeMode.DRAWELLIPSE; } }
private void btnRectangle_Click(object sender, EventArgs e) { if (btnFill.Checked) { _currShapeMode = ShapeMode.FILLRECTANGLE; } else { _currShapeMode = ShapeMode.DRAWRECTANGLE; } }
private void btnCircle_Click(object sender, EventArgs e) { if (btnFill.Checked) { _currShapeMode = ShapeMode.FILLCIRCLE; } else { _currShapeMode = ShapeMode.DRAWCIRCLE; } }
private void SetShapeMode(ShapeMode shapeMode) { if (shapeMode == ShapeMode.Rectangle) { this.ItemTemplate = this.RectangleIndicatorTemplate; } else { this.ItemTemplate = this.EllipseIndicatorTemplate; } }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { pnlPaint.BackgroundImage = null; pnlPaint.BackColor = Color.White; shapes.Clear(); selectedShape = null; resizeShape = null; cbbDashStyle.SelectedIndex = 0; nmrSize.Value = 1; zoom = 1f; currentShape = CurrentShape.NoDrawing; mode = ShapeMode.NoFill; isCtrPress = isDrawBezier = isDrawPolygon = isMouseDown = isMouseSelect = isMovingShape = false; UncheckButton(); pnlPaint.Invalidate(); }
/// <summary> /// Display a helix handle. /// </summary> /// <returns>A new helix with any modifications applied.</returns> /// <param name="baseId">Base identifier. Each handle has its own unique hash based off this value.</param> /// <param name="helix">Helix.</param> /// <param name="origin">Origin.</param> /// <param name="orientation">Orientation.</param> /// <param name="scale">Scale.</param> /// <param name="color">Color.</param> /// <param name="divisions">Divisions.</param> /// <param name="fillMode">Fill mode.</param> /// <param name="shapeMode">Shape mode.</param> private static Helix DoHelixHandle( int baseId, Helix helix, Vector3 origin, Quaternion orientation, Vector3 scale, Color color, int divisions, FillMode fillMode, ShapeMode shapeMode ) { // early out if the scale is too small if (scale.sqrMagnitude < s_RequiredMinHandleChange) { Debug.LogWarning("Scale vector for helix handle is too close to 0. Handle is disabled"); return(null); } // create copy of helix helix = new Helix(helix); // store the handle matrix Matrix4x4 oldMatrix = Handles.matrix; Handles.matrix *= Matrix4x4.TRS(origin, orientation, scale); // set the helix handle's color Color oldColor = Handles.color; Handles.color = color; // validate the number of divisions divisions = Mathf.Max(1, divisions); // create a handle to adjust length DoHelixLengthHandle(baseId, helix); // next, create handles for the twist curve DoHelixTwistHandles(baseId, helix); // next, create handles for the width curve DoHelixWidthHandles(baseId, helix); // draw lines to visualize the helix DrawHelix(helix, divisions, fillMode, shapeMode); // reset handle color Handles.color = oldColor; // reset handle matrix Handles.matrix = oldMatrix; // return result return(helix); }
private void CmbShapeMode_SelectedIndexChanged(object sender, EventArgs e) { btnSelect.PerformClick(); if (cmbShapeMode.SelectedIndex == 0) { mode = ShapeMode.NoFill; EnableButtons(); trkLineWidth.Enabled = true; cmbDashMode.Enabled = true; } else if (cmbShapeMode.SelectedIndex == 1) { mode = ShapeMode.Fill; trkLineWidth.Enabled = false; btnLine.Enabled = btnCurve.Enabled = btnBezier.Enabled = false; cmbDashMode.Enabled = false; } }
public static extern int imaqDrawShapeOnImage(IntPtr dest, IntPtr source, Rect rect, DrawMode mode, ShapeMode shape, float newPixelValue);
private void _SetShape(ShapeMode mode) { if (mode != _currentShapeMode) { _currentShapeMode = mode; switch (mode) { case ShapeMode.DC: _driver.SendCommandRequest(":SOUR:FUNC:SHAP DC"); break; case ShapeMode.Pulse: _driver.SendCommandRequest(":SOUR:FUNC:SHAP PULS"); break; default: break; } } }
protected void BeginShape(ShapeMode mode = ShapeMode.Polygon) { beginMode = (BeginMode) Enum.Parse(typeof (BeginMode), mode.ToString()); verticies.Clear(); }