paint

Painting custom background of parent and parent children in C#

↘锁芯ラ 提交于 2019-12-06 00:32:52
I am trying to use this tutorial so that I can have a transparent button. It works fine for the main background, but it doesn't draw over the other children. If I use BringToFront() it then doesn't have the other child's drawing where it should be. I have started to get around it by adding this to the code: foreach (Control child in Parent.Controls) { if(child != this) { InvokePaintBackground(child, pea); InvokePaint(child, pea); } } And although I get some of what I want, it's in the wrong location (on the left instead of in the middle where it shoudl be) and the shapes which are drawn in the

How to create Paint-like app with XNA?

微笑、不失礼 提交于 2019-12-05 22:26:35
The issue of programmatically drawing lines using XNA has been covered here . However, I want to allow a user to draw on a canvas as one would with a drawing app such as MS Paint. This of course requires each x and/or y coordinate change in the mouse pointer position to result in another "dot" of the line being drawn on the canvas in the crayon color in real time. In the mouse move event, what XNA API considerations come into play in order to draw the line point by point? Literally, of course, I'm not drawing a line as such, but rather a sequence of "dots". Each "dot" can, and probably should,

java applet paint method trouble

江枫思渺然 提交于 2019-12-05 19:57:54
In code I am calling repaint() method from init() method but Output is not as per I expect. I called repaint() method 10 times but It called paint() only once(See Screenshot of O/P). Am I making any mistake. please help me. Thanks code import java.awt.*; import java.applet.Applet; /* <applet code="test" height=300 width=300> </applet> */ public class test extends Applet { int x,y; public void init() { x=5; y=10; for(int i=1;i<10;i++) { System.out.println("From init "+i); x+=(i*2); y+=(i*3); repaint(); } } public void paint(Graphics g) { System.out.println("Paint"); g.drawLine(50,50,x,y); } }

Java 1.5 JOptionPane paint bug when using panel message/workaround?

自作多情 提交于 2019-12-05 17:54:41
I have a JOptionPane with a custom message panel in it, in an application targeted for Java 1.5. The panel contains, among other things, a JTextField. Every 20 invocations or so, nothing in the dialog gets painted (not even the OK/Cancel buttons). If I drag the dialog off the screen and back again to force a repaint, the components are visible as expected, and apart from the painting problem, the components respond fine. Here is the smallest example I could get to exhibit this bug: public class BugTest { public static void main(String args[]) { SwingUtilities.invokeLater(new Runnable() {

In CoreGraphics drawing how can I keep the point of overlap from being darker than the rest of the line?

本秂侑毒 提交于 2019-12-05 16:56:39
My app uses core graphics for custom finger paint drawing. I allow the user to change the alpha of the line and a new line is continuously drawn on touches moved. When I make the alpha lower than 1.0 the point of overlap is darker than the rest of the line. I know why this occurs but how can I stop this? Kris Van Bael I suppose you want a single stroke not to darken itself, but still to darken previous strokes (that's how most painting apps work). For this to work, you need two views/buffers, one for the 'current background' and one for the current stroke. Merge the latter with the background

Why is my c# paint method running out of memory?

只谈情不闲聊 提交于 2019-12-05 12:18:36
I'm new to c#, and trying to learn by writing some simple apps to get familiar with the syntax and .NET library. The most recent miniproject I took on is a polar clock like the one found here . One of the problems I noticed early on was that the app would constantly "flicker", which really took away from the presentation, so I read online about how to implement a double buffer, which eliminated this problem, but may or may not have something to do with the problem. Here is my onPaint method; it is called every 33ms (~30 FPS) by a timer control. Most of the rest of the app is simply handlers

Java repaint not working correctly

对着背影说爱祢 提交于 2019-12-05 09:59:15
i use the java repaint method , it repaints, but the update is only seen when I either click on the canvas or resize the panel. How can I fix this ? What causes it? You need to call the method revalidate(). This forces the layout manager to update / repaint all its components. repaint() isn't actually repainting, it's just requesting a repaint of the component. Marc Kirschner It may be helpful to simply grab the Graphics object from the component you wish to paint. Then just invoke a paint method on the Graphics object. For example: g = component.getGraphics(); draw(g); 来源: https:/

Android Paint setShadowLayer() ignores color of its Paint

我的梦境 提交于 2019-12-05 03:36:12
I'm trying to create a Bitmap programmatically and am finding drawing a shadowed Rect is ignoring the color arg passed in. I've simplified things down to this case - the code just draws a rotated blue square which is supposed to have a grey shadow, but the shadow is always blue: main.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#fff" android:padding="40dp" > </LinearLayout> RotateRectShadowActivity.java

Dotted line separator with custom thickness

妖精的绣舞 提交于 2019-12-05 00:33:43
问题 I have a dotted line separator <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"> <!-- #17b851 #C7B299 --> <stroke android:color="#9e9c85" android:dashWidth="10px" android:dashGap="10px" /> </shape> Right now its barely visible. How can I make it thick . I tried giving android:height="2px" & android:dashHeight="5px" but it didnt work. 回答1: You can use stroke width, android:width="3dp" snapshot 回答2: Stroke WIDTH must

Android canvas fill background color (Canvas application)

旧时模样 提交于 2019-12-04 23:04:36
问题 By having the following codes, I have some questions. public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView( new View(this) { Paint mPaint = new Paint(); @Override protected void onDraw(Canvas canvas) { // TODO Auto-generated method stub super.onDraw(canvas); int width = this.getWidth(); int height = this.getHeight(); int radius = width > height ? height/2 : width/2; int center_x = width/2;