FOnline Development > Tools
TempGraphic
Wipe:
Silly result of even more silly bet; i was supposed to create graphics for 20 inventory items in less than hour, so i did it like a typical slacker. Program name speaks for itself, don't expect much... ;)
http://rotators.fodev.net/wipe/TempGraphic.zip
https://github.com/rotators/fo2238/tree/master/Tools/TempGraphic/
I'll be amazed if anyone will find it useful
JovankaB:
Very nice! I used it to create avatar.
Interface is intuitive, I found no bugs. I recommend it to everyone.
davrot:
Isn't Jovanka amazing? :-*
Gob:
I converted your program to VB.NET, here is the code. I hope you don't mind.
--- Code: ---Imports System
Imports System.Drawing
Imports System.Data
Imports System.Deployment
Imports System.Drawing.Imaging
Imports System.Windows.Forms
Namespace TempGraphic
End Namespace
Partial Public Class frmMain
Inherits Form
Public Sub New()
MyBase.New()
InitializeComponent()
Me.CreateImage("")
End Sub
Private Sub CreateImage(ByVal text As String)
Dim lines() As String = text.Split(New String() {"" & vbCrLf}, StringSplitOptions.RemoveEmptyEntries)
If ((lines.Length > 0) _
AndAlso (lines.Length < 4)) Then
Dim font As Font = New Font("Tahoma", 8, FontStyle.Bold)
Dim bmp As Bitmap = New Bitmap(1, 1)
Dim w As Integer = 0
Dim g As Graphics = Graphics.FromImage(bmp)
For Each line As String In lines
Dim tmpsize As SizeF = g.MeasureString(line, font, 90)
If (tmpsize.Width > w) Then
w = CType(tmpsize.Width, Integer)
End If
Next
bmp = New Bitmap((w + 10), (25 _
+ ((lines.Length - 1) _
* (lines.Length > 1))))
Dim x As Integer = 1
Do While (x < bmp.Width)
Dim y As Integer = 1
Do While (y < bmp.Height)
If (((x = 1) _
OrElse (y = 1)) _
OrElse ((x _
= (bmp.Width - 1)) _
OrElse (y _
= (bmp.Height - 1)))) Then
bmp.SetPixel(x, y, Color.White)
Else
bmp.SetPixel(x, y, Color.FromArgb(104, 36, 96))
End If
y = (y + 1)
Loop
x = (x + 1)
Loop
Dim l As Integer = 0
For Each line As String In lines
g.DrawString(line, font, Brushes.White, 5, (5 _
+ (l * 15)))
l = (l + 1)
Next
Me.pictureBox1.Image = CType(bmp, Image)
Me.button1.Enabled = True
Else
Me.pictureBox1.Image = Nothing
Me.button1.Enabled = False
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
If Me.pictureBox1 IsNot Nothing Then
Dim result As DialogResult = Me.saveFileDialog1.ShowDialog()
If result = DialogResult.OK Then
Me.pictureBox1.Image.Save(Me.saveFileDialog1.FileName, ImageFormat.Png)
End If
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles textBox1.TextChanged
Dim self As TextBox = DirectCast(sender, TextBox)
Me.CreateImage(self.Text)
End Sub
End Class
--- End code ---
The only thing I wasn't able to do is make the text show in the picture.
K-9:
Link is dead :-\
Navigation
[0] Message Index
[#] Next page
Go to full version