draw

Draw a fill rectangle dynamically on screen in C#

我的未来我决定 提交于 2019-12-11 09:27:18
问题 I would like to draw a fill rectangle dynamically on my screen, with an opacity at 0.1. The problem is that when i move the mouse, the previous rectangles aren't clear. This is the drawing methods. private void OnMouseDown(object sender, MouseEventArgs e) { isMouseDown = true; x = e.X; y = e.Y; g = this.selectorForm.CreateGraphics(); } private void OnMouseMove(object sender, MouseEventArgs e) { if (!isMouseDown) return; this.selectorForm.Invalidate(); g.FillRectangle(brush, this.getRectangle

Drawing a line in a class which extends "Activity'

拜拜、爱过 提交于 2019-12-11 08:09:00
问题 I have an ImageView loading a picture in my Activity and want to draw some lines on it. It seems like I'm not able to overlay the lines I draw onto the ImageView. If I create a new class (myPainter) which extends 'View', hook myPainter.onDraw() and then setContentView(mp) in onCreate() from the activity, all I get are the drawn lines. My ImageView is gone from onCreate(). How do I get the ImageView and lines to show up in the same layout? I'm also Override'ing onTouch() for the ImageView so I

Snipping tool laggy highlighter

不想你离开。 提交于 2019-12-11 07:35:15
问题 I trying to create a highlighter in C# Winforms. Most of the code i used is here Highlight effect like snipping tool But when i try to draw too fast it lags. Not sure what i'm doing wrong. Here is what i have tried. private void pictureBox1_Paint(object sender, PaintEventArgs e) { Bitmap bmp = (Bitmap)pictureBox1.Image; using (Graphics g = Graphics.FromImage(pictureBox1.Image)) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.CompositingQuality = System.Drawing

customize UIPageControl dots

不羁的心 提交于 2019-12-11 07:01:16
问题 I'm currently trying to customize the UIPageControl so it will fit my needs. However I seem to be having a problem when implementing some logic in the draw What I want to do is to be able to user IBInspectable variables to draw out the UIPageControl however those seem to still be nil when the draw method is being called and when I try to implement my logic in the awakeFromNib for instance it won't work. What I did so far is the following class BoardingPager: UIPageControl { @IBInspectable var

Android studio doesn't draw button correctly

点点圈 提交于 2019-12-11 06:48:14
问题 In my Android studio project I have a fragment with constraint layout inside. Here is XML. <android.support.constraint.ConstraintLayout android:id="@+id/pinLayout" android:layout_width="match_parent" android:layout_height="250dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/topLayout"> <android.support.constraint.ConstraintLayout android:layout_width="0dp" android

Panel with auto scroll redraw

*爱你&永不变心* 提交于 2019-12-11 06:20:20
问题 I have form that programmatically add a panel in it; For each task coming in to my program, I add a label and progress bar to panel which have 30 pixel Y added to previous Y position. But when panel get scrolls sometimes when want to scroll down, positions multiplied and not in their exact position. Remember, I checked and written Y positions to console and saw that Y position is ok, but panel does not show it correctly I think problem is for panel draw method, but don't know how to fix it.

Not drawing under the mouse in “Processing”

我们两清 提交于 2019-12-11 05:46:14
问题 I want to draw at one place by dragging the mouse and have the line drawn at 3 places around the center of canvas, including one under the cursor itself. I am using following code which does draw 3 lines but none of them is under the mouse cursor: void setup(){ size(300, 300); } void draw() { translate(width/2, height/2); if(mousePressed) for(int i=0; i<3; i++){ line(width/2 -mouseX, height/2 -mouseY, width/2 -pmouseX, height/2 -pmouseY); rotate(2*PI/3); }} How can I correct this code so that

How to draw on a photo IMMEDIATELY after taking it, THEN save to storage

别等时光非礼了梦想. 提交于 2019-12-11 05:12:21
问题 I have searched around and found a few different solutions to this problem but none of them are really what I am looking for. I am developing an app that lets the user take an image by opening the camera via a MediaStore.ACTION_IMAGE_CAPTURE Intent as so... Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); And then saves the image with File photo = new File(Environment.getExternalStorageDirectory(), titleOfPhoto + ".jpg"); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo

How do I draw a text in openGL/java?

≯℡__Kan透↙ 提交于 2019-12-11 03:45:36
问题 I need to draw a String in Arial, lets say "hello world", on the window (the game uses openGL). But I have no idea how to draw text using openGL. I have searched but have found nothing that I understand. So I basically need to draw a Arial string on the screen in openGL in java. 回答1: Take a look at TextRendrer , Its in the first few links on a google search 回答2: You could also use slick if you're using lwjgl - http://slick.cokeandcode.com/ It's very easy to use, you simply create a unicode

Why isn't the “rectangle” that I want to draw on my Qt widget showing up?

瘦欲@ 提交于 2019-12-11 03:32:42
问题 I basically want to display a rectangle on a dialog window widget. Using another question as reference, I tried to adapt the framework of using a QLabel and painting to it (the process overall seems overly complicated). I started by making a member in the dialog box's class: QLabel* label; In the constructor of the dialog box: label = new QLabel(this); label->setGeometry(20, 50, 50, 100); Just to try and make it work, I gave the dialog box a button to make the "rectangle" created with the