Why can't my GetManifestResourceStream find my image? - vb.net

I'm currently attempting to layer several images into a single composite, built from several body face pieces for a player's portrait.
Usually for grabbing images from the resources and putting them into a picturebox/etc I'd simply ".Image = My.Resources.ResourceManager.GetObject(filename)".
However I need to transfer to a Bitmap, which doesn't accept objects. I've found the below code from a couple of google results, but the file is bugging out as "Value of null is not valid for 'stream' ", and the pHead is "Nothing". As such I'm presuming the code can't find the file.
The break is causing on the final line of the below code.
Any help or simpler alternatives would be much welcome.
Dim GenderText As String = ""
Select Case ListCharacter(ActiveChar).Gender
Case eGender.Male : GenderText = "masc"
Case eGender.Female : GenderText = "fem"
End Select
Dim Prefix As String = ""
Dim Suffix As String = ".png"
Dim myAsm As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly()
' Load Head Image
' e.g. prt_fem_head_1_white.png
Dim headImageName As String = "prt_" & GenderText & "_head_" & CharApp.HeadStyle & "_" & CharApp.SkinColour
Dim pHead As Bitmap = New Bitmap(myAsm.GetManifestResourceStream(Me.GetType, headImageName & Suffix))
ps. Also bugs out with/without the suffix.
Edit #1;
I've found the prefix required, as far as I can tell, to the whereabouts of the resources root. However, that still isn't working to any variation.
Edit #2;
I've double checked the resource location via its properties.
"C:\Users\CLEO\Documents\Visual Studio 2015\Projects\Storytime\Storytime\Resources\prt_fem_head_1_white.png"

Solved. I changed the code out for a simpler one I found in my Resources Designer code. The below is very raw and needs tidying, but this is how I was able to make several images build into one picturebox.
' Load Face
Dim PortraitLocation As New Point(573, 51)
Dim CharApp As New Character.cAppearance : CharApp = ListCharacter(ActiveChar).Appearance
' Dim pHead, pEyes, pNose, pMouth, pBase, pHair As New PictureBox
Dim FaceCanvas As New PictureBox
Dim GenderText As String = ""
Select Case ListCharacter(ActiveChar).Gender
Case eGender.Male : GenderText = "masc"
Case eGender.Female : GenderText = "fem"
End Select
Dim resourceCulture As Global.System.Globalization.CultureInfo
Dim headImageName As String = "prt_" & GenderText & "_head_" & CharApp.HeadStyle & "_" & CharApp.SkinColour
Dim obj As Object = My.Resources.ResourceManager.GetObject(headImageName, resourceCulture)
Dim phead As Bitmap = CType(obj, System.Drawing.Bitmap)
Dim eyesImageName As String = "prt_" & GenderText & "_eyes_" & CharApp.EyeStyle & "_" & CharApp.SkinColour
Dim obj2 As Object = My.Resources.ResourceManager.GetObject(eyesImageName, resourceCulture)
Dim pEyes As Bitmap = CType(obj2, System.Drawing.Bitmap)
Dim noseImageName As String = "prt_" & GenderText & "_nose_" & CharApp.NoseStyle & "_" & CharApp.SkinColour
Dim obj3 As Object = My.Resources.ResourceManager.GetObject(noseImageName, resourceCulture)
Dim pNose As Bitmap = CType(obj3, System.Drawing.Bitmap)
Dim mouthImageName As String = "prt_" & GenderText & "_mouth_" & CharApp.MouthStyle & "_" & CharApp.SkinColour
Dim obj4 As Object = My.Resources.ResourceManager.GetObject(mouthImageName, resourceCulture)
Dim pMouth As Bitmap = CType(obj4, System.Drawing.Bitmap)
Dim hairImageName As String = "prt_" & GenderText & "_hair_" & CharApp.HairStyle & "_" & CharApp.HairColour
Dim obj5 As Object = My.Resources.ResourceManager.GetObject(hairImageName, resourceCulture)
Dim pHair As Bitmap = CType(obj5, System.Drawing.Bitmap)
Dim bodyImageName As String = "prt_" & GenderText & "_body_" & CharApp.SkinColour
Dim obj6 As Object = My.Resources.ResourceManager.GetObject(bodyImageName, resourceCulture)
Dim pBody As Bitmap = CType(obj6, System.Drawing.Bitmap)
Dim g As Graphics = Graphics.FromImage(pBody)
g.DrawImage(phead, 0, 0)
g.DrawImage(pEyes, 0, 0)
g.DrawImage(pNose, 0, 0)
g.DrawImage(pMouth, 0, 0)
g.DrawImage(pHair, 0, 0)
With FaceCanvas
.Location = PortraitLocation
.Size = New Size(50, 50)
.Image = pBody
.BackColor = Color.Transparent
End With
Me.Controls.Add(FaceCanvas)

Related

Chrome DevTools SetTimeZoneOverRideCommand cannot change system time

I have problem using Chrome DevTools SetTimeZoneOverrideCommand according to IP timezone.
But when I check in Whoer.net still shows is system time.
In here have 3 problem:
I using in selenium proxy is Rotate Proxy so is that posiible maintain same proxy by usin other function to check IP?
SetTimeZoneOverride cannot change spoof my system same as IP timezone time.
In Whoer.net is that possible change that DNS route
Imports System
Imports System.IO
Imports System.Text.RegularExpressions
Imports OpenQA.Selenium
Imports OpenQA.Selenium.Chrome
Imports Zu.ChromeDevTools
Module Program
Sub Main(args As String())
Console.WriteLine("Current IP: " & GetCurrentIP())
Dim browser_option As New ChromeOptions
Dim NewUAC As String = Random_UAC()
browser_option.AddArgument("user-agent=" & NewUAC)
browser_option.AddArgument("--window-size=800,600")
browser_option.AddArgument("--incognito")
browser_option.AddArgument("--disable-infobars")
browser_option.AddArgument("--disable-blink-features=AutomationControlled")
Dim Proxy As New Proxy With {
.Kind = ProxyKind.Manual,
.IsAutoDetect = False,
.HttpProxy = "p.webshare.io:9999",
.SslProxy = "p.webshare.io:9999"}
browser_option.Proxy = Proxy
Dim driverService = ChromeDriverService.CreateDefaultService
driverService.HideCommandPromptWindow = True
Dim browser As New ChromeDriver(driverService, browser_option)
browser.Navigate.GoToUrl("https://whoer.net")
Dim CurrentIP As String
Dim sHTML As String = browser.PageSource
CurrentIP = Mid(sHTML, sHTML.IndexOf("<strong data-clipboard-target=" & Chr(34) & ".your-ip" & Chr(34) & " class=" & Chr(34) & "your-ip" & Chr(34) & ">") + 59, 20)
CurrentIP = Regex.Match(CurrentIP, "\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b").ToString
Threading.Thread.Sleep(5000)
Console.WriteLine("Changed IP: " & CurrentIP)
Console.WriteLine("Current Loc: " & Get_TimeZone_GeoLocation(CurrentIP))
Dim CurrentGeo() As String
CurrentGeo = Get_TimeZone_GeoLocation(CurrentIP).Split(",")
Dim ChromeGeoLocation As New Zu.ChromeDevTools.Emulation.SetGeolocationOverrideCommand
ChromeGeoLocation.Latitude = CurrentGeo(0)
ChromeGeoLocation.Longitude = CurrentGeo(1)
ChromeGeoLocation.Accuracy = 1
Dim ChromeTimeZone As New Zu.ChromeDevTools.Emulation.SetTimezoneOverrideCommand
ChromeTimeZone.TimezoneId = CurrentGeo(2)
browser.Navigate.GoToUrl("https://whoer.net")
End Sub
Function GetCurrentIP() As String
Dim DetectAddress As String = "https://whoer.net"
Dim CurrentIP As String
Dim objHttpRequest As System.Net.HttpWebRequest
Dim objHttpResponse As System.Net.HttpWebResponse
Dim objProxy As New System.Net.WebProxy
objHttpRequest = System.Net.HttpWebRequest.Create(DetectAddress)
objHttpResponse = objHttpRequest.GetResponse
Dim objStrmReader As New StreamReader(objHttpResponse.GetResponseStream)
Dim sHTML As String
sHTML = objStrmReader.ReadToEnd()
CurrentIP = Mid(sHTML, sHTML.IndexOf("<strong data-clipboard-target=" & Chr(34) & ".your-ip" & Chr(34) & " class=" & Chr(34) & "your-ip" & Chr(34) & ">") + 59, 20)
CurrentIP = Regex.Match(CurrentIP, "\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b").ToString
Return CurrentIP
End Function
Function Get_TimeZone_GeoLocation(ByVal CurrentIP As String) As String
Dim DetectAddress As String = "http://ip-api.com/csv/" & CurrentIP
Dim CurrentLocation As String
Dim objHttpRequest As System.Net.HttpWebRequest
Dim objHttpResponse As System.Net.HttpWebResponse
objHttpRequest = System.Net.HttpWebRequest.Create(DetectAddress)
objHttpResponse = objHttpRequest.GetResponse
Dim objStrmReader As New StreamReader(objHttpResponse.GetResponseStream)
Dim sHTML As String
sHTML = objStrmReader.ReadToEnd()
Dim sHTML_Item() As String
sHTML_Item = sHTML.Split(",")
CurrentLocation = sHTML_Item.Length
Dim latitude, longitude, timezone As String
latitude = sHTML_Item(7)
longitude = sHTML_Item(8)
timezone = sHTML_Item(9)
CurrentLocation = latitude & "," & longitude & "," & timezone
Return CurrentLocation
End Function
Function Random_UAC() As String
Dim strUACs As String = IO.File.ReadAllText("UAC_List.txt")
Dim strUAC_Split As String()
strUAC_Split = strUACs.Split(vbCrLf)
Dim n As Integer = strUAC_Split.Length
Dim RandomUAC As Integer
RandomUAC = Math.Ceiling(Rnd() * n) - 1
'Console.WriteLine(RandomUAC & " - " & strUAC_Split(RandomUAC))
Return strUAC_Split(RandomUAC)
End Function
End Module

How to get file's path created by this code?

I'm using this code to save files in my app
Dim filePath = String.Format("image{0:yyyyMMddHHmmss}.png", DateTime.Now)
PictureBox1.Image.Save(IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), (filePath)))
So now I have a textbox1 and I want to show the path of last saved image in it
how?
Regards,,,,
What I've done in the past is generate the path in one step and then use the generated variable to do the saving and to display.
So instead of:
Dim filePath = String.Format("image{0:yyyyMMddHHmmss}.png", DateTime.Now)
PictureBox1.Image.Save(IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), (filePath)))
Try:
'Generate the Path
Dim path As String = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), String.Format("image{0:yyyyMMddHHmmss}.png", DateTime.Now))
'Save using the generated path
PictureBox1.Image.Save(path)
'Display the path
textbox1.Text = path
Thanks all I've done it successfully `
Dim filename As String = String.Format("image{0:yyyyMMddHHmmss}.png", DateTime.Now)
Dim filePath1 = (IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), (filename)))
Dim filePath2 = (IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), ("RMSS")))
If IO.Directory.Exists(IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), (" RMSS"))) = True Then
TextBox1.Text = filePath1
TextBox2.Text = filePath2 & "\" & filename
PictureBox1.Image.Save(filePath1)
My.Computer.FileSystem.MoveFile(TextBox1.Text, TextBox2.Text, True)
Else
TextBox1.Text = filePath1
TextBox2.Text = filePath2 & "\" & filename
PictureBox1.Image.Save(filePath1)
My.Computer.FileSystem.MoveFile(TextBox1.Text, TextBox2.Text, True)
End If

Crystal Reports Missing Parameter Values

I am running the version of crystal that comes with Visual Studio 2010. I have a report that has three sub reports. There are parameters that are passed from the main report to the sub-reports. I am able to run the report in the development environment by clicking on Main Report Preview.
The problem is when I try to execute it at run time. I get the error “Missing parameter values”. I need some hints as to how to debug this problem. The error doesn’t tell you which parameter is the problem or which sub-report is involved.
Any hint will be appreciated.
I am editing this to respond to some of the questions. I am using subreports links which is where I think the problem might be. In the pass by fiddling with the settings I was able to get it to work. It seems like it was just trial and error.
I am posting a portion of the code here based on the request in the comments
Public Function GetReportOutput(iDatabaseIndicator As eDatabaseIndicatorEnum, ReportName As String, ReportOutputtype As eReportOutputtype, ReportParameters As System.Collections.Generic.List(Of clsReportParam)) As clsReturn Implements IsvcEDReports.GetReportOutput
Dim l_crRep As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim l_clsReturn As clsReturn = New clsReturn
Dim l_ExportFormatType As ExportFormatType
Dim l_strReport As String = ""
Dim l_strReportName As String = ""
Dim l_strOutputFile As String = ""
Dim l_strFullPathName As String = ""
Dim l_strReportOutputPath As String = ConfigurationManager.AppSettings.Get(IIf(ConfigurationManager.AppSettings.Get("Environment") = 1, "ReportOutputPath_Dev", "ReportOutputPath_Prod"))
Dim l_strReportPath As String = ConfigurationManager.AppSettings.Get(IIf(ConfigurationManager.AppSettings.Get("Environment") = 1, "ReportPath_Dev", "ReportPath_Prod"))
Dim l_udtReport As CrystalDecisions.CrystalReports.Engine.ReportDocument = Nothing
Dim l_intCount As Integer = 0
Dim l_fsReturn As FileStream = Nothing
Dim l_binFilestream As BinaryReader = Nothing
Dim l_bytFile As Byte() = Nothing
Dim l_expOptions As New CrystalDecisions.Shared.ExportOptions
Dim l_expExcFmtOptions As New CrystalDecisions.Shared.ExcelFormatOptions
Dim l_tblParameters As New DataTable("Parameters")
Dim l_aryParams(1)
Dim udtSubReport As ReportDocument
Dim udtSubReportOpened As ReportDocument
Try
iDatabaseIndicator = iDatabaseIndicator
InitDataController(iDatabaseIndicator)
m_strReport = (l_strReportPath & "\" & ReportName)
l_strReportName = ReportName
l_strReport = m_strReport
l_strOutputFile = Regex.Replace(ReportName, " ", "_") & "_" & Format(Now(), "MMddyyyy_hhmmss")
m_strOutputFilename = l_strOutputFile
With l_crRep
.Load(l_strReport, CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault)
If .IsLoaded Then
For Each udtSubReport In .Subreports
udtSubReportOpened = .OpenSubreport(udtSubReport.Name)
SetDatabase(udtSubReportOpened, False)
SetParameters(udtSubReportOpened, ReportParameters, False)
Next
SetDatabase(l_crRep)
SetParameters(l_crRep, ReportParameters)
Select Case ReportOutputtype
'Case eReportOutputtype.rptOutputType_RPT
' l_strOutputFile = l_strOutputFile & ".rpt"
' l_ExportFormatType = ExportFormatType.CrystalReport
Case eReportOutputtype.rptOutputType_XLS
l_strOutputFile = l_strOutputFile & ".xls"
'ReportOutputFile = ReportOutputFile & ".xls"
With l_expExcFmtOptions
.ExcelConstantColumnWidth = 125
.ExcelUseConstantColumnWidth = True
End With
With l_expOptions
.ExportFormatOptions = l_expExcFmtOptions
End With
l_ExportFormatType = ExportFormatType.Excel
Case eReportOutputtype.rptOutputType_PDF
l_strOutputFile = l_strOutputFile & ".pdf"
' ReportOutputFile = ReportOutputFile & ".pdf"
l_ExportFormatType = ExportFormatType.PortableDocFormat
Case eReportOutputtype.rptOutputType_DOC
l_strOutputFile = l_strOutputFile & ".doc"
' ReportOutputFile = ReportOutputFile & ".doc"
l_ExportFormatType = ExportFormatType.WordForWindows
Case eReportOutputtype.rptOutputType_CSV
l_strOutputFile = l_strOutputFile & ".csv"
' ReportOutputFile = ReportOutputFile & ".csv"
l_ExportFormatType = ExportFormatType.CharacterSeparatedValues
Case eReportOutputtype.rptOutputType_TXT
l_strOutputFile = l_strOutputFile & ".txt"
' ReportOutputFile = ReportOutputFile & ".txt"
l_ExportFormatType = ExportFormatType.Text
Case eReportOutputtype.rptOutputType_XML
l_strOutputFile = l_strOutputFile & ".xml"
' ReportOutputFile = ReportOutputFile & ".xml"
l_ExportFormatType = ExportFormatType.Xml
End Select
.ExportToDisk(l_ExportFormatType, l_strReportOutputPath & "\" & l_strOutputFile)
It crashes on the last line .ExportToDisk ...
I solved this problem, It was the hint from heringer that gave me the clue. I am passing 6 parameters to the main report but two of them are only used by the a sub-report not the main reports itself. I was defining these without the leading "#". I figured this out by display the parameters as I passed them in my code.
I was also able to look at an old report that was working and saw that I needed the at signs.
Bob

Load Image files from folder

I have a checked list box and a thumbnail area to display them where I am trying to load only images from a specific folder and need to display in thumbnails area but the problem is there is a thumbs.db file which is also being added to the checked list box which I don't need it.
So how do I actually load only the image files without the thumbs.db file.
Here is my code:
Private Sub LoadProjectToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LoadProjectToolStripMenuItem.Click
Using ofdlg As New Windows.Forms.OpenFileDialog
ofdlg.DefaultExt = "trk"
ofdlg.Filter = "Project|*.trk"
ofdlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
If ofdlg.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim SaveData As New gCanvasData
Using objStreamReader As New StreamReader(ofdlg.FileName)
Dim x As New XmlSerializer(GetType(gCanvasData))
SaveData = CType(x.Deserialize(objStreamReader), gCanvasData)
objStreamReader.Close()
End Using
With SaveData
'gTSSizer_gAZoom.Value = 100
GCanvas1.ImageXYReset()
GCanvas1.Image = .Image
GCanvas1.gAnnotates = .gAnnotates
GCanvas1.RebuildAll()
GCanvas1.AssembleBitmap()
End With
Dim fullpath As String
fullpath = Application.StartupPath + "\" & System.IO.Path.GetFileNameWithoutExtension(ofdlg.FileName) + "\"
For Each fi As FileInfo In New DirectoryInfo(fullpath).GetFiles
CheckedListBox1.Items.Add(Application.StartupPath + "\" & System.IO.Path.GetFullPath(ofdlg.FileName))
For i As Integer = 0 To CheckedListBox1.Items.Count - 1
CheckedListBox1.SetItemChecked(i, True)
ThumbControl1.AddFolder(fullpath, True)
Next i
Next
End If
End Using
End Sub
Either filter it inside of the For Each Loop:
For Each fi As FileInfo In New DirectoryInfo(fullpath).GetFiles
If Not {".jpg", ".png", ".bmp"}.Contains(fi.Extension) Then Continue For
' ...
Next
or do it in the GetFiles:
DirectoryInfo(fullpath).GetFiles(".jpg")
Found the solution at last:
Dim fullpath As String
fullpath = Application.StartupPath & "\" & System.IO.Path.GetFileNameWithoutExtension(ofdlg.FileName) + "\"
Dim FileDirectory As New IO.DirectoryInfo(fullpath)
Dim FileJpg As IO.FileInfo() = FileDirectory.GetFiles("*.jpg")
Dim FileGif As IO.FileInfo() = FileDirectory.GetFiles("*.gif")
Dim FileBmp As IO.FileInfo() = FileDirectory.GetFiles("*.bmp")
For Each File As IO.FileInfo In FileJpg
CheckedListBox1.Items.Add(File.FullName)
Dim str As String
str = Directory.GetCurrentDirectory() & "\" & "Backup\"
Next
For Each File As IO.FileInfo In FileGif
CheckedListBox1.Items.Add(File.FullName)
Dim str As String
str = Directory.GetCurrentDirectory() & "\" & "Backup\"
Next
For Each File As IO.FileInfo In FileBmp
CheckedListBox1.Items.Add(File.FullName)
Dim str As String
str = Directory.GetCurrentDirectory() & "\" & "Backup\"
Next
For i As Integer = 0 To CheckedListBox1.Items.Count - 1
CheckedListBox1.SetItemChecked(i, True)
Next i
Change DirectoryInfo(fullpath).GetFiles to DirectoryInfo(fullpath).EnumerateFiles() And add a search pattern for the image file extensions you want. http://msdn.microsoft.com/en-us/library/dd383574.aspx

How to Display a Bmp in a RTF control in VB.net

I Started with this C# Question
I'm trying to Display a bmp image inside a rtf Box for a Bot program I'm making.
This function is supposed to convert a bitmap to rtf code whis is inserted to another rtf formatter srtring with additional text. Kind of like Smilies being used in a chat program.
For some reason the output of this function gets rejected by the RTF Box and Vanishes completly. I'm not sure if it the way I'm converting the bmp to a Binary string or if its tied in with the header tags
lb.SelectedRtf = FormatText(build.ToString, newColor)
'returns the RTF string representation of our picture
Public Shared Function PictureToRTF(ByVal Bmp As Bitmap) As String
'Create a new bitmap
Dim BmpNew As New Bitmap(Bmp.Width, Bmp.Height, Imaging.PixelFormat.Format24bppRgb)
Dim gr = Graphics.FromImage(BmpNew)
gr.DrawimageUnscaled(Bmp, 0, 0)
gr.dispose()
Dim stream As New MemoryStream()
BmpNew.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp)
Dim bytes As Byte() = stream.ToArray()
Dim str As String = BitConverter.ToString(bytes, 0).Replace("-", String.Empty)
'header to string we want to insert
Using g As Graphics = Main.CreateGraphics()
xDpi = g.DpiX
yDpi = g.DpiY
End Using
Dim _rtf As New StringBuilder()
' Calculate the current width of the image in (0.01)mm
Dim picw As Integer = CInt(Math.Round((Bmp.Width / xDpi) * HMM_PER_INCH))
' Calculate the current height of the image in (0.01)mm
Dim pich As Integer = CInt(Math.Round((Bmp.Height / yDpi) * HMM_PER_INCH))
' Calculate the target width of the image in twips
Dim picwgoal As Integer = CInt(Math.Round((Bmp.Width / xDpi) * TWIPS_PER_INCH))
' Calculate the target height of the image in twips
Dim pichgoal As Integer = CInt(Math.Round((Bmp.Height / yDpi) * TWIPS_PER_INCH))
' Append values to RTF string
_rtf.Append("{\pict\wbitmap0")
_rtf.Append("\picw")
_rtf.Append(Bmp.Width.ToString)
' _rtf.Append(picw.ToString)
_rtf.Append("\pich")
_rtf.Append(Bmp.Height.ToString)
' _rtf.Append(pich.ToString)
_rtf.Append("\wbmbitspixel24\wbmplanes1")
_rtf.Append("\wbmwidthbytes40")
_rtf.Append("\picwgoal")
_rtf.Append(picwgoal.ToString)
_rtf.Append("\pichgoal")
_rtf.Append(pichgoal.ToString)
_rtf.Append("\bin ")
_rtf.Append(str.ToLower & "}")
Return _rtf.ToString
End Function
Public Function FormatText(ByVal data As String, ByVal newColor As fColorEnum) As String
data = System.Net.WebUtility.HtmlDecode(data)
data = data.Replace("|", " ")
Dim reg As New Regex("\$(.[0-9]+)\$")
If reg.IsMatch(data) Then
Dim meep As String = Regex.Match(data, "\$(.[0-9]+)\$").Groups(1).ToString
Dim idx As Integer = Convert.ToInt32(meep)
Dim img As String = Fox2RTF(idx)
If img IsNot Nothing Then data = Regex.Replace(data, "\$(.[0-9]+)\$", img)
End If
Dim myColor As System.Drawing.Color = fColor(newColor)
Dim ColorString = "{\colortbl ;"
ColorString += "\red" & myColor.R & "\green" & myColor.G & "\blue" & myColor.B & ";}"
Dim FontSize As Integer = cMain.ApFont.Size
Dim FontFace As String = cMain.ApFont.Name
FontSize *= 2
Dim test As String = "{\rtf1\ansi\ansicpg1252\deff0\deflang1033" & ColorString & "{\fonttbl{\f0\fcharset0 " & FontFace & ";}}\viewkind4\uc1\fs" & FontSize.ToString & data & "\par}"
Return "{\rtf1\ansi\ansicpg1252\deff0\deflang1033" & ColorString & "{\fonttbl{\f0\fcharset0 " & FontFace & ";}}\viewkind4\uc1\fs" & FontSize.ToString & data & "\cf0 \par}"
End Function
Private Function Fox2RTF(ByRef Img As Integer) As String
Dim shape As New FurcadiaShapes(Paths.GetDefaultPatchPath() & "system.fsh")
Dim anims As Bitmap() = Helper.ToBitmapArray(shape)
' pic.Image = anims(Img)
Return PictureToRTF.PictureToRTF(anims(Img))
End Function
Never found the Soultion I was hoping for with this.. But I did find a work around http://www.codeproject.com/Articles/30902/RichText-Builder-StringBuilder-for-RTF