316 questions
1
vote
2
answers
80
views
java drawString vertically
I am trying to paint in paintComponent strings vertically within a given rectangle, so that the text beginning is at the vertical edge of the rectangle.
My idea is to rotate the text around its center....
0
votes
0
answers
171
views
How can I render text at 50% opacity with drawStringWithShadow() in Minecraft 1.7.10?
I am developing an addon mod that introduces some custom swords that keep track of a killstreak. I want to draw some text on screen that fades out after a few seconds. I can get the text to ...
1
vote
1
answer
418
views
using powershell windows forms create a listview with Multi Line Headers
I need a listview that can support a Column header with two lines of text.
I have spent a lot of time trying to use add_DrawColumnHeader to create that 2nd line.
I have no issues creating it in c# but ...
2
votes
1
answer
723
views
I want to use custom font size in Flutter Image.drawString
This is about Flutter, Dart, Image, specifically drawString function.
First of all, what I am trying to do is watermark the picture taken with the text (product name). I mean not just placing text ...
0
votes
1
answer
79
views
DrawPath doesn't return a correct shape when the corners are rounded
I'm trying to draw a rectangle with rounded corners. But when I print the layout there's a problem with the lines like the image below:
while the image that I need to print is this:
This is the part ...
0
votes
1
answer
219
views
Is it possible to make the string drawn on screen stable while moving the mouse cursor (using C#)?
I'm trying to draw a string on the screen (attached to the mouse cursor) using C#, and the string value and its location change with the mouse movement.
The problem here is when hovering the mouse, ...
3
votes
1
answer
329
views
Graphics.DrawString doesn't draw last SPACE chars?
The string is "Hello World " with 10 SPACE chars in the end, but Graphics.DrawString in Right Alignment omits all of SPACE chars, it just draws "Hello World" only.
...
-1
votes
1
answer
1k
views
How to use custom color in DrawString?
I want to use an RGB color instead of default color of C#, but I have no idea how.
e.Graphics.DrawString("Order Summary",
new Font("Roboto", 15, FontStyle.Bold),
Brushes....
0
votes
1
answer
68
views
When I try to place a string using pictureBox with a transparent background, I get ugly white pixels around my string. How to solve this problem?
I removed backColor from the form and added a pictureBox. After that I'm trying to draw a string. But It looks really ugly with these white pixels. Could y'all help me, please?
Here is a screenshot of ...
0
votes
1
answer
3k
views
I want to use custom font in Flutter Image.drawString
This is about Flutter, Dart, Image, specifically drawString function.
First of all, what I am trying to do is watermark the picture taken with the address and time.
I mean not just placing text over ...
1
vote
0
answers
383
views
C# DrawString is Adding Outline or Drop Shadow to Certain Fonts at Certain Sizes
I'm using C# DrawString to draw text on an image background which is output as a TIFF for printing.
For some fonts at some sizes, the DrawString method is adding a border around the text. Both of ...
0
votes
1
answer
182
views
Drawing with drawString doesn't look good
The result of drawString with the same font and size in java
The appearance is different when drawn with the same font and size in a painter (or word). Drawing with drawstring in java doesn't look ...
1
vote
0
answers
982
views
C# DrawString with StringFormatFlags: How to Flip Vertical Orientation?
I'm drawing strings on an image and saving it as a TIFF. I need to orient the text like this:
desired output
I'm using this code to create the string format:
formatFlags = (StringFormatFlags.NoClip | ...
1
vote
1
answer
980
views
how do I center align drawstring bmp from text input in picturebox c#
I'm a beginner writing a simple windows desktop form app with a textbox that user types into and then clickbutton converts that text into a bitmap that is shown in a picturebox (that is only 96 x 64 ...
0
votes
1
answer
618
views
How to owner draw a TreeView Node to show two lines of text
I am trying to figure out a way to use the StringFormat class to add new line to a given TreeNode text. For example, the string ID1:123456, ID2:789000, can be split by comma and insert a newline in ...
4
votes
0
answers
825
views
How to convert Unicode text into a Bitmap
I need to convert a text containing Unicode chars into a Bitmap that could have a transparent background as well.
I found and tried different posts like this, this, or this, but no one seems to work ...
2
votes
1
answer
826
views
Draw a String with a specific angle degree in line
I'm drawing a graph with two points of each point having a line with a weight.
for example graph: point "15" to point "16" line with the weight of 1.872 and point "16" to ...
0
votes
0
answers
78
views
VB.NET WinForms: DrawString does not center, despite using Stringformat.Center
I'm trying to draw my text in the center of my (test) rectangle.
my (simplified) code:
Sub Main()
Using x As New Form1()
x.ShowDialog()
End Using
End Sub
Imports System.Drawing
...
1
vote
1
answer
295
views
Get the position where drawn text is truncated by GraphicsPath.DrawString
I have a couple of methods that draw outlined text. The details of this are unimportant, but it serves to illustrate the problem:
(source code from Graphics DrawPath produces unexpected results when ...
1
vote
1
answer
94
views
How can I make drawString faster in Windows 10?
My ancient application leans heavily on drawString. It's at least 20 times slower in Windows 10. Are there ways to speed up drawing text in Windows? The following code illustrates the difference.
...
1
vote
1
answer
121
views
Difference between html font size and c# DrawString font
I am trying to do the following: user uses some html page where he can upload images and also add text. This is the app for apparel company. So basically we have a t-shirt background picture and we ...
0
votes
0
answers
338
views
GDI changes my Font to MS Sans Serif, if code is executed in Non-UI-Application
I have a method which generates images using DrawString(). If I call this method on every machine I tested from any program with an UI or from Console-App every thing is fine. The image shows the ...
0
votes
1
answer
459
views
String won't display using drawString()
I'm writing a simple Trivia game and I ran into a problem where the question string won't display
In my frame I'm using border layout with "new game" and "end game" on the bottom (...
0
votes
0
answers
309
views
Java Swing and .drawString - Can you right justify text with drawString?
I have looked around the site and did not find the answer to my question. So any help is appreciated.
I want to use drawString to write individual text strings that each end at the same distance from ...
0
votes
1
answer
1k
views
Drawing text on image not working with Graphics2D
I am running into some issues while wanting to write some text on an image.
As I looked, it could be done with following code:
package asd;
import java.awt.Color;
import java.awt.Font;
import java....
5
votes
1
answer
1k
views
gdi+ - Graphics.MeasureString either too wide or too narrow
I'm using the System.Drawing library in C# to measure a string's size:
SizeF size = gfx.MeasureString("Hello", myFont);
However, this returns a size with a bit of spacing around the text. ...
2
votes
1
answer
114
views
C# Win7 and Win2019 Convert text to image gives blur, not clear [closed]
I have a C# programm, that convert Text to Image by using GDI+ method Graphics.DrawString
On my machine with Windows 7 it works good
see example image here:
But on the Windows Server 2019 it creates ...
0
votes
0
answers
970
views
VB.net, What's the best way to display text on screen, OUTSIDE of main form, and remains visible even when form is minimized?
To give an example of what I mean, external FPS counters, that overlay the entire screen or overlay a certain window, it allows for users to click through it, stays visible, and doesn't have a main ...
4
votes
1
answer
776
views
Graphics.DrawString() method throws GDI+ exception when the string length is too long
The below code block which throws
System.Runtime.InteropServices.ExternalException: 'A generic error occurred in GDI+.
exception when the string passed to draw is too long.
public partial class ...
0
votes
1
answer
150
views
Poor performance with drawString from Graphics library
I'm making a 2D card game. In it I have a custom font uses drawString from the Graphics library to draw it in with custom color and size. Problem is that this seems incredibly unoptimized. I can't ...
4
votes
1
answer
58
views
Redraw strings in CardLayout
I have made a game using CardLayout and have one JPanel for the leaderboard. In leaderboard, I read two files (one with names, one with times), sort them and draw the top 5 fastest times like this:
...
0
votes
0
answers
58
views
How to make DrawString work for negative y scale factor?
Working on a private stock chart where I use a rendering rectangle with an origin at lower left and inverted y axis, scale factor y is negative. Y axis ticks render nicely but drawing text (drawstring)...
0
votes
1
answer
871
views
WPF Write Text to Image and send to Printer
i want to create a little image containing a logo and multiple lines of text and send it directly to a printer. However im having trouble with textquality.
Currently im creating a Bitmap and render ...
1
vote
3
answers
99
views
Display many text in same windows java
I want to display many text in the same windows but only the last text is displayed, there is my 2 class :
import Test.Graph;
import javax.swing.JFrame;
public class InterfaceGraphique extends JFrame ...
1
vote
1
answer
210
views
How to draw a right-aligned string which does not fit completely in surrounding rectangle
Rectangle Location = new Rectangle(X , Y, W, H);
var TextFormat = new StringFormat() { Alignment = StringAlignment.Far };
string Text = "RRRR1234567890123456789012345678901234567890RRRR";
e.Cache....
0
votes
1
answer
19k
views
How to draw any text using drawString() in Java
I'm getting into graphical stuff in Java and want to display text. As I've read, drawString() is the standard method for this. My code to draw the string is:
import java.awt.*;
import javax.swing.*;
...
0
votes
0
answers
448
views
PrintDocument baseline printing and line spacing
I have an app that prints very small labels.
One thing I have noticed is that the printing (using DrawString with a rectangle) aligns text based on the TOP of the font ascender size. So when there ...
0
votes
1
answer
587
views
Graphis.DrawString always uses the default font
I have a project in which I create an image with rotated text around an invisible circle.
The drawing in itself is working just fine. However, it seems that no matter the font I use, I always get the ...
0
votes
0
answers
270
views
DrawString Quality Different Between PictureBox and Bitmap
I needed to write text left-to-right but each character rotated 90 degrees counter clock wise so that on a print out it would look like the text is written vertically top-to-bottom like this:
To ...
2
votes
3
answers
2k
views
C# Rotated DrawString from Right Corner
I am trying to draw text on an image from top right corner towards the bottom left corner. My code mess up the positioning of drawstring. so far this code drawing like this but I need help to draw ...
0
votes
1
answer
89
views
How to prevent "drawstring" from being removed?
private void Side_pictureBox_Paint(object sender, PaintEventArgs e)
{
if (doubleclicked == true)
{
Side_pictureBox.Refresh();
for (int ...
0
votes
1
answer
439
views
How can I change the direction text flows in a drawstring?
I'm making a label printing thing for a candy shop in C#. The label printer stock is narrow and tall, like a portrait style format so I'm printing using
System.Drawing.StringFormat drawFormat = new ...
0
votes
0
answers
335
views
Add Google font on DrawString in a rectangle over an image
i got a request to change the Font family of a string that im drawing on a rectangle and after in an image , my question is : How? , i know how to add a custom font on the html but this time im ...
3
votes
1
answer
1k
views
Create rectangle for the string that can be resized and center positioned
At first, I used drawString and GraphicsPath.AddString to draw outlined/solid text in the pictureBox. I can change it's font size, style and font-family but I realized that I won't be able to resized/...
0
votes
0
answers
225
views
GdipDrawString not properly displaying text
I'm new to GDI+ and am trying to modify a program so that it draws a black rectangle over a specified object and then display text describing what the covered object is. I've been able to get the ...
1
vote
1
answer
3k
views
How can I draw multi-colored text using graphics class on panel?
I want to draw the following text on panel:
It is a multi-colored text.
I found this article about drawing multicolored text.
I replaced characters with words but it doesn't work.
(I use FillPath/...
2
votes
2
answers
2k
views
Drawing a text in the middle of an ellipse
I have an application which at some point draws many circles on a Panel control. Then I want to name each circle (just a letter and a number). And I want the text to be centered, to make it look nice. ...
0
votes
1
answer
358
views
Printing on the x-axis: start position not exact - is there a value/function for the x-axis?
I have got an issue with
e.Graphics.DrawString(TextToPrint, Font, Brush, New RectangleF(StartPositionX, StartPositionY, Width, Height))
Let's say I want to print "Hello World" in Arial-20pt at 25mm ...
0
votes
1
answer
2k
views
Margin in VB.NET printing
I am trying to print a receipt on 58mm thermal printing with the use of vb.net and Graphics.DrawString of vb.net but it is leaving some space at the beginning.
I have also tried by giving the x ...
2
votes
0
answers
482
views
Drawstring custom font working in a TextBox control but not working in a Form Paint event
I created a simple WinForm Form and tested a custom font file.
Basically I just add several chinese characters (which do not exist) to
a existing font file.
Strange thing is that the font only works ...