paint

Dotted line separator with custom thickness

柔情痞子 提交于 2019-12-03 15:46:10
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. Raghunandan You can use stroke width, android:width="3dp" snapshot Stroke WIDTH must be smaller than the size HEIGHT. (Stroke width is the width of the line. Size height is the height of

How do I get the image paint/paintComponent generates?

心不动则不痛 提交于 2019-12-03 15:41:18
I have a quick question. How do I get the image generated by a JComponent.paint or paintComponent? I have a JComponent which I use as a 'workspace' and where I have overwritten the paintComponent method to my own. The thing is that my workspace JComponent also has children which has their own paintComponent methods. So when Swing renders my workspace component, it renders the workspace graphics and then its childrens'. However, I want to get the image my workspace component generates (which includes the workspace graphics and the children's graphics). How do I do that? I tried to call the

Android canvas fill background color (Canvas application)

三世轮回 提交于 2019-12-03 14:39:26
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; int center_y = height/2; // prepare a paint mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeWidth(5

Canvas' drawLine and drawRect not including end position?

时间秒杀一切 提交于 2019-12-03 10:37:36
To my surprise I've just discovered that drawLine and drawRect don't include the ending position, i.e.: canvas.drawLine(100, 100, 100, 100, paint); or RectF rect = new RectF(100, 100, 100, 100); canvas.drawRect(rect, paint); won't draw anything. My paint is defined as follows: Paint paint = new Paint(); paint.setAntiAlias(false); paint.setStyle(Paint.Style.FILL); return paint; I've tried defining my paint as FILL_AND_STROKE, but it wouldn't help. Android's drawPaint() javadoc don't even list the stopX and stopY params! So, if I want to draw a vertical line that goes exactly from beginY to endY

Android how to draw paint in free hand in MapView using overlay?

a 夏天 提交于 2019-12-03 10:08:47
问题 In my app Draw paint in free hand on Map view but searching lot of information finally got from rectangle shape draw on mapview but i want in place of rectangle draw free hand like zigzag how to change my code Any help please.. MapOverlay.java public class MapOverlay extends Overlay { private float x1,y1,x2,y2; private GeoPoint p1=null,p2=null; private MapExampleActivity mv = null; private Paint paint = new Paint(); private Path path = new Path(); private boolean isUp = false; //constructor

DrawText on imageview

主宰稳场 提交于 2019-12-03 08:59:54
I tried to write the text in this way but it does not work and I do not understand where I'm wrong. mImageView.buildDrawingCache(); Bitmap bmap = mImageView.getDrawingCache(); Canvas c = new Canvas (bmap); Paint paint = new Paint(); paint.setColor(Color.RED); paint.setStyle(Style.FILL); paint.setTextSize(20); c.drawText("Some Text", 0, 25, paint); I tried several times but the display can not display any text. I have to make sure that this image is then saved with the written text. thanks Here is the simple example how to draw text on ImageView: MainActivity.java package com.exmple.imagetest;

Win32: Does a window have the same HDC for its entire lifetime?

有些话、适合烂在心里 提交于 2019-12-03 08:18:17
Am i allowed to use a DC outside of a paint cycle? Is my window's DC guaranteed to be valid forever? i'm trying to figure out how long my control's Device Context (DC) is valid. i know that i can call: GetDC(hWnd); to get the device context of my control's window, but is that allowed? When Windows sends me a WM_PAINT message, i am supposed to call BeginPaint / EndPaint to properly acknowledge that i've painted it, and to internally clear the invalid region: BeginPaint(hWnd, {out}paintStruct); try //Do my painting finally EndPaint(hWnd, paintStruct); end; But calling BeginPaint also returns me

DataGridView White Space After Last Column Header

孤街醉人 提交于 2019-12-03 07:42:58
I'm trying to mimic what every other tabular view does with the DataGridView control, but I can't seem to get the headers correct. I want a blank header to the right of all headers, that does not move, and is not actually a header. Is there a way to paint the default header along the top? Basically, this is my problem: Try this Dim dt As New DataTable() dt.Columns.Add("a") dt.Columns.Add("b") dt.Rows.Add(dt.NewRow()) dt.Rows.Add(dt.NewRow()) dt.Rows.Add(dt.NewRow()) dt.Rows.Add(dt.NewRow()) dt.Rows.Add(dt.NewRow()) dt.Rows.Add(dt.NewRow()) dt.Columns.Add(" ") dt.AcceptChanges() DataGridView1

creating clickable “buttons” c++

可紊 提交于 2019-12-03 07:39:17
hey i am trying to basically just make a button in my little console application which can be pressed. here's a snippet of what i use to get the cursor location if (GetKeyState(VK_LBUTTON) < 0) { { POINT p; if (GetCursorPos(&p)) { cout<<"\nSCREEN\nx coord->"; cout<<p.x; cout<<"\ny coord->"; cout<<p.y; } SetConsoleTitle("paint"); HWND hWnd; hWnd = FindWindow(NULL, "paint"); if (ScreenToClient(hWnd, &p)); { cout<<"\n\nWINDOW\nx coord->"; cout<<p.x; cout<<"\ny coord->"; cout<<p.y; } int pwx; int pwy; pwx=p.x; pwy=p.y; this just prints the mouse coords relative to the screen and to the window to

Android custom brush pattern/image

本秂侑毒 提交于 2019-12-03 07:25:33
I have an 8x8 Image. (bitmap - can be changed) What I want to do is be able to draw a shape, given a Path and Paint object onto my SurfaceView . At the moment all I can do is fill the shape with solid colour. How can I draw it with a pattern. In the image you can see the brush pattern (The cross). It can be anything from a cross to a donut or an elf. How would I go about drawing this pattern background. I also eventually want to apply colours to it. So far, my theory is to create a clip area of the shape, and tile the bitmaps until area is covered, but this is extreme overkill in processing.