graphics

save a graphics object to a varbinary db column c#

北城余情 提交于 2019-12-13 05:27:45
问题 Using c#, I created a blank picture box control and a graphics object. I instantiated the graphics object by pictureBoxControl.CreateGraphics(). I allow the user to then draw on the picture box with the mouse. I'm trying to save the graphics object to a varbinary column in the database, but I can't figure that out. Can somebody please help? 来源: https://stackoverflow.com/questions/35181621/save-a-graphics-object-to-a-varbinary-db-column-c-sharp

Java graphics2d: text field

假装没事ソ 提交于 2019-12-13 05:19:00
问题 I searched for many topics but did not find any with a concrete answer. I need a field data input on the Graphics2D (like the JTextField or TextField ). Does anyone know how I can create this component? Or put a text field ( Component ) in Graphics2D ? Thank you! 回答1: Not really sure what you are asking for, but here is some code that will add a text field to a panel when you double click. You can then add text to the text field. import java.awt.*; import java.awt.event.*; import javax.swing.

Drawing a single large image with the graphics card in a custom control

女生的网名这么多〃 提交于 2019-12-13 05:15:12
问题 Simply put, I'm trying to draw an image (2560x2048) that is supposed to be zoomed / draged and such but the performance is very bad, because it flickers everytime I move it. I use a custom control to be able to drag the image to a new position and zoom in and out, which means it have to be flexible and fast. So, what is the easiest and best way to just draw a single image with the graphics card? Without having to initialize a thousand directX objects just for one simple purpose. Overall, the

Java panel/frame graphic not working

末鹿安然 提交于 2019-12-13 05:13:37
问题 I am trying to make a game of life simulation using Java Graphics but when a run my code the left one third of the screen is grey.I want the whole screen to be white with black squares representing living squares. I am confused about all the java containers/panels and frames. Here's my code: public class ConwayGame { static JPanel panel; static JFrame frame; public static void main(String[] args) throws InterruptedException{ int [][] array = new int [40][40]; /* * Set the pattern for Conway's

Java sprite falling?

风流意气都作罢 提交于 2019-12-13 05:10:25
问题 Sorry, I did not know how to word the title well. But I am making a Java game where you have a paddle at the bottom of your screen and you can move it left and right in order to avoid falling asteroids. I have the paddle working, but I do not know how to make a falling asteroid. The asteroid will just be a rectangle for now. I also would like to be able to adjust the speed and how many asteroids fall. Here is my code: public class Main extends Applet implements KeyListener, MouseListener {

DrawEllipse: Ellipse goes outside of the Bitmap size

牧云@^-^@ 提交于 2019-12-13 05:07:03
问题 I want to draw a circle with DrawEllipse on a specified Bitmap , with the same size of the Bitmap, but the result is that the circle appears clipped at the edges. Why this problem? Bitmap layer = new Bitmap(80, 80); using (Graphics g = Graphics.FromImage(layer)) { using (Pen p = new Pen(Color.Black, 4)) { g.DrawEllipse(p, new Rectangle(0, 0, layer.Width, layer.Height)); } } pictureBox3.Size = new Size(100, 100); pictureBox3.Image = layer; 回答1: By default a Pen has a PenAlignment.Center. This

How to reset graphics with paintComponent on transparent JFrame?

好久不见. 提交于 2019-12-13 04:58:49
问题 Usually when I want to make animation, I reset all the graphic screen by drawing rectangle: @Override public void paintComponent(Graphics g) { g.setColor(Color.white); g.fillRect(0,0,1000,1000); // now im drawing the animation on empty screen } After I drawed the Rect I can draw the animation on empty screen so the animation will move instead of spread. Right now I want to draw animation on Transparent JFrame. How can I empty the component from Precedings drawings, and still keep the JFrame

How to paint over a JPanel?

和自甴很熟 提交于 2019-12-13 04:47:25
问题 I (A novice programmer) am trying to paint an oval over a JPanel. I am trying to use the method paint. However, it requires a Graphics argument. I get a NullPointerException when I include my Graphics as a argument because it is null, but I do not know how else to paint the oval. I tried repaint instead but nothing happened. Any help would be appreciated. Here is my main class: public class Checkers extends JPanel{ public static final int BOARDSQUARES = 8; public static final int BOARDSIZE =

Drawing event draws two object

别说谁变了你拦得住时间么 提交于 2019-12-13 04:46:58
问题 Program has only this code. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click PictureBox1.Image = PictureBox2.Image Dim g As Graphics = Graphics.FromImage(PictureBox1.Image) g.DrawEllipse(New Pen(Color.MediumOrchid, 5), 30, 30, 30, 30) g.Dispose() PictureBox1.Refresh() PictureBox2.Refresh() End Sub Before clicking PictureBox1 is emtpty and PictureBox2 has a white image. After clicked PictureBox1 and PictureBox2 both have ellipse. I think program uses one image

How do I change the size of a rectangle while painting a histogram?

随声附和 提交于 2019-12-13 04:42:50
问题 Actually I am new to java gui, and here I want to change the rectangle height whenever we put something in text field and press button, but I don't know how to do it, actually I checked in a ton of sited but I couldn't find an easy way.Actually I can't find how to change rectangle size that is inside paintComponent inside the MyPanel class. (The logic for height change is how many vowels capital and small,and consonents and other things are there in string) import java.awt.*; import javax