paint

Can you increase line thickness when using Java Graphics for an applet? I don't believe that BasicStroke works [duplicate]

倖福魔咒の 提交于 2019-12-09 14:45:52
问题 This question already has answers here : Java2D: Increase the line width (2 answers) Closed 6 years ago . I am having trouble adjusting line thickness. Can I do that in Graphics or do i have to do it in Graphics2D? If so, how do I alter the program to make it run? Thanks! import java.applet.Applet; import java.awt.*; public class myAppletNumberOne extends Applet { public void paint (Graphics page) { //Something here??? } } 回答1: Yes you have to do it in Graphics2D, but that's hardly an issue,

Canvas' drawLine and drawRect not including end position?

天大地大妈咪最大 提交于 2019-12-09 08:21:59
问题 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

PaintCode - move object on the path

别来无恙 提交于 2019-12-09 07:41:30
I would like draw a curved line and attach an object to it. Is it possible to create fraction (from 0.0 to 1.0) which makes move my object on the path? When fraction is 0 then object is on the beginning, when 0.5 is on half way and finally when is on 1.0 it is at the end. Of course i want a curved path, not a straight line :) Is it possible to do in PaintCode? If you need it only as a progress bar , it is possible in PaintCode. The trick is to use dashed stroke with very large Gap and then just change the Dash . Then just attach a Variable and you are done. Edit: Regarding the discussion under

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

与世无争的帅哥 提交于 2019-12-09 06:28:52
问题 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);

DataGridView White Space After Last Column Header

心不动则不痛 提交于 2019-12-09 06:12:38
问题 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: 回答1: 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

Drawing an overlay on top of an application's window

假装没事ソ 提交于 2019-12-09 05:18:51
问题 I want to be able to paint on top of my application's window so that I can annotate all the widgets with some extra diagnostic information, similar to the CSS developer tools in Firefox (eg add widget classes, styles, highlight borders etc). I can walk the widget tree and extract the relevant information, but the question is how can I overlay all the application windows with this information? One way would be to override my QMainWindow 's paint event, but this has to be done for all top level

WinAPI C++: Reprogramming Window Resize

风格不统一 提交于 2019-12-08 23:37:26
问题 I have a window, and I want to implement the borders as resizing borders, like any other window. Taking in suggestions from comments and answers, I have rewritten my code. For WM_GETMINMAXINFO I have: MINMAXINFO *min_max = reinterpret_cast<MINMAXINFO *>(lparam); min_max->ptMinTrackSize.x = MINX; min_max->ptMinTrackSize.y = MINY; MINX and MINY are the minimum size I want the window to be. For WM_NCHITTEST I have: RECT wnd_rect; int x, y; GetWindowRect (window, &wnd_rect); x = GET_X_LPARAM

Window's content disappears when minimized

末鹿安然 提交于 2019-12-08 19:35:56
问题 I have a simple class that draws a line when mouse dragging or a dot when mouse pressing(releasing). When I minimize the application and then restore it, the content of the window disappears except the last dot (pixel). I understand that the method super.paint(g) repaints the background every time the window changes, but the result seems to be the same whether I use it or not. The difference between the two of them is that when I don't use it there's more than a pixel painted on the window,

Draw Rectangle which change size w.r.t different android screen size

試著忘記壹切 提交于 2019-12-08 11:53:58
问题 I want to draw a rectangle using canvas which change its size with different screen size. That means it increase of decrease its size with screen ratio. I use the following code: float scale = getContext().getResources().getDisplayMetrics().density; canvas.drawRect(leftX-20*scale, leftY-20*scale, rightX+20*scale, rightY, mPaint); But it does not change its size in different screen. What can I do? 回答1: The problem is in getContext().getResources().getDisplayMetrics().density; it wil give you

JPanel listeners and threads issues

主宰稳场 提交于 2019-12-08 11:40:37
问题 Here is the code for displaying circles with varying radius on a panel inside a frame with a given delay rate, but the code is showing the final output not the intermediate stages i.e., the circles are not appearing one by one but all the circles are coming at once as a final output. There may be some errors related to button action listeners and panel threads. The code is taking initial circle radius and the total number of iterations (the total number of circles to be displayed), radius of