drawing

How to redraw or refresh in OnRender?

强颜欢笑 提交于 2019-12-18 13:32:22
问题 I want to draw something dynamically. Following code shows my OnRender. I'm setting DrawItem somewhere in my program where I need it. But when I'm calling DrawItem =5; what do I have to call, so that OnRender gets called? protected override void OnRender(DrawingContext drawingContext) { switch (DrawItem) { case 1: //Draw Item break; case 2: //Draw Item break; case 3: //Draw Item break; case 4: //Draw Item break; case 5: //Draw Item break; } base.OnRender(drawingContext) } public int DrawItem

How to draw a lines between points and pull those points?

强颜欢笑 提交于 2019-12-18 13:19:14
问题 I want to draw the lines between points on the view, and then pull those points upto desired positions even the shape will change. i know how to draw the line between two points canvas.drawLine(10, 10, 90, 10, paint); by using this i can draw the lines between points. EDIT : here i am attaching image for clear explanation, from Paul answer now i am able to draw the lines between points, still have the problem of pulling points... 回答1: Here's how it's done. Suppose you have your points, make

Firefox Mousemove event.which

别说谁变了你拦得住时间么 提交于 2019-12-18 12:52:12
问题 I'm writing an HTML5 canvas drawing app, and I need to be able to tell whether or not the left mouse button is pressed down during a mousemove event. On Chrome, this works: if (event.which == 1) { <do stuff> } But in FireFox, event.which always is 1, no matter whether or not the button is pressed. How can I detect whether the mouse button is pressed during a mousemove event? 回答1: In short, you can't. MDN, for example, explains: When a mouse button event occurs, a number of additional

Firefox Mousemove event.which

二次信任 提交于 2019-12-18 12:52:05
问题 I'm writing an HTML5 canvas drawing app, and I need to be able to tell whether or not the left mouse button is pressed down during a mousemove event. On Chrome, this works: if (event.which == 1) { <do stuff> } But in FireFox, event.which always is 1, no matter whether or not the button is pressed. How can I detect whether the mouse button is pressed during a mousemove event? 回答1: In short, you can't. MDN, for example, explains: When a mouse button event occurs, a number of additional

Android TextureView / Drawing / Painting Performance

流过昼夜 提交于 2019-12-18 12:07:54
问题 I am attempting to make a drawing/painting app using TextureView on Android. I want to support a drawing surface of up to 4096x4096 pixels, which seems reasonable for my minimum target device (which I use for testing) which is a Google Nexus 7 2013 which has a nice quad core CPU and 2GB memory. One of my requirements is that my view must be inside of a view that allows it to be zoomed in and out and panned, which is all custom code I have written (think UIScrollView from iOS). I've tried

How to erase previous drawing on Canvas?

自闭症网瘾萝莉.ら 提交于 2019-12-18 11:45:26
问题 I have a background image (a map) on which I need to regularly draw the you-are-here icon. I use Canvas to draw the icon on top of the map. Assuming that the drawing process is triggered on button click (see code below), how can I erase the previous drawing? private void displayUserPos(Point userPos) { Bitmap marker = BitmapFactory.decodeResource(getResources(), R.drawable.ic_yah); canvas.drawBitmap(marker, (float)userPos.getX(), (float)userPos.getY(), null); imgView.setImageBitmap(fmOverlay)

Drawing outside of column area in listview column header

吃可爱长大的小学妹 提交于 2019-12-18 08:50:08
问题 Is it possible to ownerdraw the entire column header section of a listview? (including the region to the right of the column headers)? ListView is in Details View. An answer here indicates that the remaining space can be drawn along with the last column header: http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.windowsforms/topic32927.aspx But it does not seem to work at all - nothing is drawn outside header area. The proposed solution is based on drawing outside of the

Drawing outside of column area in listview column header

荒凉一梦 提交于 2019-12-18 08:50:04
问题 Is it possible to ownerdraw the entire column header section of a listview? (including the region to the right of the column headers)? ListView is in Details View. An answer here indicates that the remaining space can be drawn along with the last column header: http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.windowsforms/topic32927.aspx But it does not seem to work at all - nothing is drawn outside header area. The proposed solution is based on drawing outside of the

How to draw custom rounded rectangles in java?

北城以北 提交于 2019-12-18 07:17:15
问题 I know how to draw a rounded rectangle but I want to define roundness for each corner separately and draw something like the image below : 回答1: There's probably a few ways to achieve this, but the easiest I can think of would be to, as Andrew has already hinted, would be to define your own Shape import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.geom.Path2D; import javax.swing.JFrame;

WPF canvas drawing with Graphics

廉价感情. 提交于 2019-12-18 07:08:37
问题 I'd like to ask if there is any possibility to draw on WPF Canvas with some kind of a Graphics type providing methods like: DrawLine, DrawPath etc.. (as it was in .NET 2). I know there's a lot of stuff like storyboards etc.. but I'm planning to do all the drawing in code behind and to have just 1 Canvas in WPF without any child elements . Do you think it is a good idea? will it be smooth ? 回答1: I'd like to ask if there is any possibility to draw on WPF Canvas with some kind of a Graphics type