ondraw

How To Handle NM_CUSTOMDRAW event to retrieve List items

南楼画角 提交于 2021-02-08 10:30:34
问题 I'm working on a win32/MFC project. I have a custom CListCtrl control that I must to add, from time to time, some strings of characters. I absolutely need to perform some manipulations on items dynamically added to my CListCtrl. Ultra-Basically, I need to: Detect adding of single elements; Retrieve _single items_ IMMEDIATELY AFTER(ideally, shortly after InsertItem() invocation); Store values of single items in a map, which I will use to perform other manipulations. I thought about doing this

onDraw() is not called in custom View

≯℡__Kan透↙ 提交于 2021-01-29 09:47:43
问题 For an app I am developing, I want to graph the results from a pedometer. The pedometer uses a service to measure the amount of steps someone makes in the background. I have a custom view called DrawView, in which I want to draw my results. I call the drawPoint method from my service whenever a step is measured. Then from my drawPoint method I try to call onDraw() using invalidate() . According to my logs, drawPoint is being called but onDraw() is not. So my question is: Why is onDraw() not

用自定TextView画个尺子

限于喜欢 提交于 2021-01-23 00:27:44
实现结果 步骤: 1、自定义类继承TextView,重写Ondraw()方法 2、主方法不做更改 3、布局文件添加tv。条目为自定义类的路径 代码如下: 自定义类: public class Ruler extends TextView { public Ruler(Context context) { super(context); init(); } public Ruler(Context context, AttributeSet attrs) { super(context, attrs); init(); } public Ruler(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } // 初始化,设置控件的位置 private void init() { setGravity(Gravity.BOTTOM); } /** * 实现该方法,“画出”自己想实现的画, 该方法无须手动调用,系统绘制该控件时,会自行调用该方法 * * @Override */ protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint paint = new Paint();

Custom View not drawing properly

心已入冬 提交于 2020-01-17 02:51:06
问题 I am making an Android game which has a board with some squares (similar to a chess board). Each square has some colors and I made a custom View class in which I overrided the onDraw() method in order to draw the square in the way I want to. Each square is composed of four triangles, as you can see in the next picture, in which a board with 3x3 squares is shown: https://dl.dropboxusercontent.com/u/48529299/Impossible%20Puzzle/ic_launcher.png Each triangle can be of one of three colors: purple

Android - Touch to erase portions of foreground ImageView to expose background View

你离开我真会死。 提交于 2020-01-16 11:27:26
问题 So I've been struggling with this for a better part of a day. Suppose I have a custom ImageView that I want to overlay over a background View (both within a RelativeLayout), which when touched, it erases portions of the View's source bitmap like an erase tool in MS Paint, exposing the View below it. I've checked pretty much all of the threads (like this one) and they suggest to use PorterDuff SRC Mode in the Paint object as well as creating a Canvas out out the ARGB_8888 shadow copy of the

Android Path addArc in canvas between two points

谁都会走 提交于 2020-01-15 04:29:28
问题 I'm trying to draw an arc in android. In IOS, it's really easy to do it with this method [path addArcWithCenter: radius: startAngle: endAngle: clockwise:] In android, I have 3 points (the center of my circle, and the two points I want to draw an arc between) : Point center = new Point(..., ...); Point p1 = new Point(..., ...); Point p2 = new Point(..., ...); int radius = (int) Math.sqrt(Math.pow(p1.x - center.x, 2) + Math.pow(p1.y - center.y, 2)); But how can I use the Path.addArc method to

Override DrawItem of ComboBox

与世无争的帅哥 提交于 2020-01-11 14:11:56
问题 I changed the highlight color of various of the controls, and I am planning to make more changes. So I though is better to create my own controls and reuse them instead of making the changed for each and every one of them. I created a new user control, and inherited from System.Windows.Forms.ComboBox . The problem is I cannot find a way to override onDraw like I would for onClick . So how I would go and override it? Here is the code I used for each control onDraw event public void

OnDraw() is not fired, nothing is drawn in surfaceView - Android

只愿长相守 提交于 2020-01-11 06:20:13
问题 HI! I have a surfaceView inside a horizontal scrollview that I want to fill with images with a onDraw() call. However, nothing is drawn. I have a class in which the drawing is done from the thread CanvasThread. public class PanelChart extends SurfaceView implements SurfaceHolder.Callback { private CanvasThread canvasthread ; public PanelChart(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub getHolder().addCallback(this); canvasthread = new

Delay in calling onDraw()

给你一囗甜甜゛ 提交于 2020-01-05 08:53:55
问题 I am writing a code which requires to update a UI multiple times within a second to display an animation .But after calling invalidate the onDraw() method gets called after around 100ms and hence the number of times the screen is repainted is reduced to only 4 or 5 times a second. I want to know as to what exactly causes the time difference between the invalidate() command and the calling of onDraw method. Is there any way I can reduce the delay so that my animation can be smooth?? Thanks in

Animation at a specified rate using canvas / Ondraw

不羁的心 提交于 2020-01-05 03:48:05
问题 In my Android app, I am trying to show letters one by one with a short delay between each, while also playing a sound for each letter. I have everything working, and the sounds play with the correct delay, but the text always prints to the screen far too fast. The canvas seems to be updated even when i am not specifically invalidating the view. Here is what I have so far - I also tried a variant of this based on the "snake" example and had the same results... any help would be appreciated!