|
Sir i fount the error in Program.cs in this line
Application.Run(new Form1());
Description:
{"Parameter is not valid."} {"Parameter is not valid."}
Source="System.Drawing"
Stack Trace
" at System.Drawing.FontFamily.GetName(Int32 language)\r\n at System.Drawing.FontFamily.get_Name()\r\n at System.Windows.Forms.Internal.WindowsFont.FromFont(Font font, WindowsFontQuality fontQuality)\r\n at System.Windows.Forms.Internal.WindowsGraphicsCacheManager.GetWindowsFont(Font font, WindowsFontQuality fontQuality)\r\n at System.Windows.Forms.TextRenderer.DrawText(IDeviceContext dc, String text, Font font, Rectangle bounds, Color foreColor, TextFormatFlags flags)\r\n at System.Windows.Forms.Label.OnPaint(PaintEventArgs e)\r\n at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)\r\n at System.Windows.Forms.Control.WmPaint(Message& m)\r\n at System.Windows.Forms.Control.WndProc(Message& m)\r\n at System.Windows.Forms.Label.WndProc(Message& m)\r\n at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.Run(Form mainForm)\r\n at BarcodeLabelGenerator.Program.Main() in E:\\DEMO VERSION\\BarcodeLabelGenerator\\BarcodeLabelGenerator\\Program.cs:line 18\r\n at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Threading.ThreadHelper.ThreadStart()"
|
|
|
|
|
Dixy wrote: Parameter is not valid
Dixy wrote: System.Drawing.FontFamily.GetName
This is where we started. Your font name is wrong.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Sir,
So how can i overcome from this problem.
as i have tried so many thing to solve this problem but its still there is no solution..
And i am using thia font
string[] fontNames = { "IDAutomationXC39M.ttf" };
|
|
|
|
|
Sir I am sending the code that i used and the error that comes
I am using this code to embded font:
class PrivateFonts<br />
{<br />
[DllImport("Gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]<br />
private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, int cbFont, int pdv, ref int pcFonts);<br />
public System.Drawing.Text.PrivateFontCollection GetFont(string[] FontResource)<br />
{<br />
string NameSpc = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name.ToString();<br />
System.IO.Stream FntStrm;<br />
System.Drawing.Text.PrivateFontCollection FntNc = new System.Drawing.Text.PrivateFontCollection();<br />
int i;<br />
for (i = 0; i <= FontResource.GetUpperBound(0); i++)<br />
{<br />
FntStrm = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(NameSpc + "." + FontResource[i]);<br />
byte[] ByteStrm = new byte[(int)FntStrm.Length];<br />
FntStrm.Read(ByteStrm, 0, Convert.ToInt32((int)FntStrm.Length));<br />
IntPtr FntPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(typeof(byte)) * ByteStrm.Length);<br />
System.Runtime.InteropServices.Marshal.Copy(ByteStrm, 0, FntPtr, ByteStrm.Length);<br />
FntNc.AddMemoryFont(FntPtr, ByteStrm.Length);<br />
Int32 pcFonts;<br />
pcFonts = 1;<br />
AddFontMemResourceEx(FntPtr, ByteStrm.Length, 0, ref pcFonts);<br />
System.Runtime.InteropServices.Marshal.FreeHGlobal(FntPtr);<br />
}<br />
return FntNc;<br />
}<br />
}
and using this code on button click:
string[] fontNames = {"IDAutomationXC39M.ttf"};<br />
PrivateFonts privateFonts = new PrivateFonts();<br />
System.Drawing.Text.PrivateFontCollection FntNc = privateFonts.GetFont(fontNames);<br />
labelBarcode.Font = new Font(FntNc.Families[0], 12);
But it shows error in Program.cs the error is
System.ArgumentException was unhandled
Message="Parameter is not valid."
Source="System.Drawing"
StackTrace:
at System.Drawing.FontFamily.GetName(Int32 language)
at System.Drawing.FontFamily.get_Name()
at System.Windows.Forms.Internal.WindowsFont.FromFont(Font font, WindowsFontQuality fontQuality)
at System.Windows.Forms.Internal.WindowsGraphicsCacheManager.GetWindowsFont(Font font, WindowsFontQuality fontQuality)
at System.Windows.Forms.TextRenderer.DrawText(IDeviceContext dc, String text, Font font, Rectangle bounds, Color foreColor, TextFormatFlags flags)
at System.Windows.Forms.Label.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Label.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at BarcodeLabelGenerator.Program.Main() in E:\DEMO VERSION\BarcodeLabelGenerator\BarcodeLabelGenerator\Program.cs:line 18
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
|
|
|
|
|
i want to show a mdi child form from another mdi child form....i wrote the code like this
private void btnEdit_Click(object sender, EventArgs e)
{
if (Mdi.adminFormIsup == true)
this.MdiParent.ActiveMdiChild.Close();
if (!Mdi.adminFormIsup)
{
MDIDiary.Update up = new Update(Uid);
up.MaximizeBox = false;
up.MinimizeBox = false;
up.ControlBox = false;
up.Size = new Size(1032, 800);
up.StartPosition = FormStartPosition.CenterParent;
up.Location = new Point(110, 110);
up.MdiParent = this.MdiParent;
up.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
up.Show();
Mdi.adminFormIsup = true;
}
}it is working but it is not showing the mdi parent FormBorder and its toolstripmenuitem...please someone help
|
|
|
|
|
Neetu Maheshwari,
Where do you create the "toolstripmenuitem" ?
Regards,
Gareth.
|
|
|
|
|
gareth111 wrote: Where do you create the "toolstripmenuitem" ?
what r u saying....i have created "toolstripmenuitem" in mdi parent form...but i want to display a mdi child form from another mdi child form.....it is working but not showing the mdi parent form border and its toolstripmenuitem...so please help
|
|
|
|
|
I am getting these two errors:
Error 2 error LNK2028: unresolved token (0A00007F) "extern "C" long __stdcall RegEnumKeyExW(struct HKEY__ *,unsigned long,wchar_t *,unsigned long *,unsigned long *,wchar_t *,unsigned long *,struct _FILETIME *)" (?RegEnumKeyExW@@$$J232YGJPAUHKEY__@@KPA_WPAK212PAU_FILETIME@@@Z) referenced in function "public: void __clrcall BuildPatch::findRegPatch(void)" (?findRegPatch@BuildPatch@@$$FQAMXXZ) FormSearchFile.obj FormSearchFile
Error 6 error LNK2019: unresolved external symbol "extern "C" long __stdcall RegQueryValueExW(struct HKEY__ *,wchar_t const *,unsigned long *,unsigned long *,unsigned char *,unsigned long *)" (?RegQueryValueExW@@$$J224YGJPAUHKEY__@@PB_WPAK2PAE2@Z) referenced in function "public: void __clrcall BuildPatch::checkRegValues(struct HKEY__ *,wchar_t * const,wchar_t * const)" (?checkRegValues@BuildPatch@@$$FQAMXPAUHKEY__@@QA_W1@Z) FormSearchFile.obj FormSearchFile
Do I have to link some library files to the linker for the code to run??
How do I know which .lib files??
Som
|
|
|
|
|
First issue you have is that this is the C# forum, and C# does not use a linker. Were you looking for the C++ forum, or have you spammed the entire site ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
looks like I have posted in the wrong forum..
I was lokking for C++ forums..
Anyways, I will post it there..
If anybody knows the answer, it would be appreciated..
Som
|
|
|
|
|
MSDN is the place to search to find out what libs you need for specific C API calls. They tell you at the bottom what header you need, and what lib.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Hi,
Kindly let me know that, is there any Date Difference method in c#?
or
will I have to use subtract?
Thank you in advance
(Riaz)
|
|
|
|
|
u can just subtract the dates
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
This[^] might help you in future. Or a good book.
Subtracting one DateTime from another returns a TimeSpan object.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Been really plugging your article, haven't you?
Just kidding, of course.
Cheers,
Vikram.
Zeppelin's law: In any Soapbox discussion involving Stan Shannon, the probability of the term "leftist" or "Marxist" appearing approaches 1 monotonically.
Harris' addendum: I think you meant "monotonously".
Martin's second addendum: Jeffersonian... I think that should at least get a mention.
|
|
|
|
|
Sadly, I find the article more and more useful....
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello friends
in my windows form , there is a listbox which gets filled on the form load event.
on the button click event, the item selected in the listbox is deleted from the database and message box appears telling that the this item has been removed from the database
the problem is that I want that after the messagebox is closed, the list box should be refreshed now holding the items that are now currently in the databse and the item I have just deleted should not appear in the listbox.
How will I achieve this?
Looking forward for ur kind suggestions on the problem.
Thanks
Sadaf
|
|
|
|
|
Clear the contents of the listbox and fill it again. You can also just remove the item you have just deleted but in that case listbox won't contain any items that have been added after your programs startup and will contain items that have been deleted by other users.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
re-populate the list box again from the Database. thats the safest way I think
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
Hi,
I want the screenshot of current running application of client machine or any machine that is in LAN.
How can it be possible?
Regards,
sjs4u
modified on Monday, March 17, 2008 3:45 AM
|
|
|
|
|
as for my point of view first you should look into the mechanism of how to take a screen shot on your local machine. If you're successful in that you can then think of using Sockets and all that stuff to get the screen shot of a machine over LAN.
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
So How to get the snapshot of current application which is running on local machine?
|
|
|
|
|
what have done so far for your RnD. I'vent done anything like that myself. and I'm sure you havent also so how far have u gone for your RnD
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
How i can write text on image, using the color pallete of index image like tif,so resulting jpg have text color same like image.Regards,adnan
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|