drawing

Draw a Fill Rectangle with low opacity

橙三吉。 提交于 2020-01-10 00:41:35
问题 I a have a PictureBox with a picture in a Windows Form application in C# language.I want draw a FillRectangle in some location of picturebox.but i also need to see picture of picture box.how can i draw this rectangle with low opacity to see image of picturebox ? 回答1: Do you mean: using (Graphics g = Graphics.FromImage(pb.Image)) { using(Brush brush = new SolidBrush(your_color)) { g.FillRectangle(brush , x, y, width, height); } } or you can use Brush brush = new SolidBrush(Color.FromArgb(alpha

Drawing semi-transparent lines on mouse movement in HTML5 canvas

倾然丶 夕夏残阳落幕 提交于 2020-01-09 10:48:59
问题 I'm trying to let users specify an area by painting over it with a "paint" tool that draws semi-transparent lines on a canvas. Its purpose is specifying a "mask" for an image that will be drawn below on the canvas. This is what I tried so far: var canvas = document.getElementById('canvas'); var ctx = canvas.getContext('2d'); var canvasPos = canvas.getBoundingClientRect(); var dragging = false; drawImage(); $(canvas).mousedown(mouseDown); $(canvas).mouseup(mouseUp); $(canvas).mousemove

how to stop flickering C# winforms

别等时光非礼了梦想. 提交于 2020-01-09 01:32:06
问题 I have a program that is essentially like a paint application. However, my program has some flickering issues. I have the following line in my code (which should get rid of flickering - but doesn't): this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true); my code(minus the super and sub classes for the shapes is as follows: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System

how to stop flickering C# winforms

有些话、适合烂在心里 提交于 2020-01-09 01:30:07
问题 I have a program that is essentially like a paint application. However, my program has some flickering issues. I have the following line in my code (which should get rid of flickering - but doesn't): this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true); my code(minus the super and sub classes for the shapes is as follows: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System

How to make star shape with bezier path in ios?

烂漫一生 提交于 2020-01-07 09:23:17
问题 I am working with Bezier path and making simple shapes with it. What is the process for making a star shape using Bezier paths? 回答1: Try this path: //// Star Drawing UIBezierPath* starPath = [UIBezierPath bezierPath]; [starPath moveToPoint: CGPointMake(45.25, 0)]; [starPath addLineToPoint: CGPointMake(61.13, 23)]; [starPath addLineToPoint: CGPointMake(88.29, 30.75)]; [starPath addLineToPoint: CGPointMake(70.95, 52.71)]; [starPath addLineToPoint: CGPointMake(71.85, 80.5)]; [starPath

Resizing drawlines on a paint event

坚强是说给别人听的谎言 提交于 2020-01-07 09:22:25
问题 I've seen few questions about this problem, I tried every solution but none of them worked for my case. My code is working; this image shows what happens when I click on Draw button. I need to zoom on that drawing.Is it possible to code something like autocad feature "zoom/extent"? Pen myPen = new Pen(Color.Black); int centerpointx, centerpointy; private void pictureBoxDraw_Paint(object sender, PaintEventArgs e) { centerpointx = pictureBoxDraw.Size.Width/2; centerpointy = pictureBoxDraw.Size

Resizing drawlines on a paint event

 ̄綄美尐妖づ 提交于 2020-01-07 09:22:19
问题 I've seen few questions about this problem, I tried every solution but none of them worked for my case. My code is working; this image shows what happens when I click on Draw button. I need to zoom on that drawing.Is it possible to code something like autocad feature "zoom/extent"? Pen myPen = new Pen(Color.Black); int centerpointx, centerpointy; private void pictureBoxDraw_Paint(object sender, PaintEventArgs e) { centerpointx = pictureBoxDraw.Size.Width/2; centerpointy = pictureBoxDraw.Size

Printing new pages with e.HasMorePages

风格不统一 提交于 2020-01-07 06:56:20
问题 I'm a little confused how I can use the HasMorePages property. I'm trying to print some page more depending by the YPosition method, but it causes an infinite loop of printing pages. This is my code: private float YPosition() { return this.TopMargin + ((float)this.LinesCount * this.Font.GetHeight(this.Graphics) + (float)this.ImagesHeight); } private void TicketPrintPage(object sender, PrintPageEventArgs e) { e.Graphics.PageUnit = GraphicsUnit.Millimeter; this.Graphics = e.Graphics; foreach

how to make a fast NOT anti-aliasing HTML5canvas basic drawing function?

为君一笑 提交于 2020-01-07 04:15:27
问题 I trying to do an anti-aliasing drawing function in canvas. Thanks to all the super answers on this site about canvas and aliasing. here's the demo: https://jsfiddle.net/garciaVvV/eu34c8sy/12/ here's the line js: function lineXY(mouseX, mouseY, mouseXX, mouseYY){ var x0= mouseX; var y0= mouseY; var x1= mouseXX; var y1= mouseYY; var coordinatesArray = []; // Translate coordinates // Define differences and error check var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); var sx = (x0 < x1) ?

Writing Name Using Bezier Curves In C#

蓝咒 提交于 2020-01-06 16:44:31
问题 I have to make a program that uses C# Generated Graphics to make a replica of my name that I wrote in cursive. Twist is, I have to use Bezier Curves. I've already called a function to make Bezier Curves using 4 points and a gravity concept. My question to you is, What would be the easiest way to make around 10 curves. Here is my function for a Bezier Curve. public static void bezierCurve( Graphics g, double p1x, double p1y, double p2x, double p2y, double p3x, double p3y, double p4x, double