|
mrsuman wrote: how to use css in windows applications (C#).
Windows applications don't use CSS. It's for web applications.
|
|
|
|
|
I HAVE USED THIS CODE TO ADD FONT TO MY PROJECT:
Code is inside this link:
http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_22687174.html?sfQueryTermInfo=1+%22c+net%22+ad+applic+file+font+ttf[^]
BUT IT SOME TIME GIVE THIS ERROR
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 BarcodeLabelPrinter.Program.Main() in E:\BarcodeLabelPrinter\BarcodeLabelPrinter\Program.cs:line 17
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()
-------------------------------------------
LINE WHERE THIS ERROR OCCURS
Application.Run(new MainForm());
THIS IS LINE 17 OF PROGRAM.CS
--------------------------------------------
THIS ERROR OCCURS ONLY SOME TIME NOT EVERY TIME WHILE RUNNING APPLICATION....
AND I DID NOT UNDERSTAND THIS ERROR PLEASE HELP ME
|
|
|
|
|
Hello,
this code is with asp.net with VB.Net:
(if items Is nothing then return 0)
but i couldn't write this code with C#.
i'm new to programming...please help me.
thank you.
Hoda
|
|
|
|
|
if (items == null) return 0;
|
|
|
|
|
if(Items==null) return 0;
|
|
|
|
|
Is there a class or method that gets how much memory an object is using? Why I want to is if an object is using more than X ammount of memory, then I'll try to figure out how to make it use less.
Thanks.
|
|
|
|
|
|
CLR Profiler[^] is a very handy program when it comes to memory profiling .NET applications, try it out!
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi guys, In my parent class I have a context menu with 3 times and in the drived class i am adding two more items in the contextmenu. They do get added up and working but what i want is that i want to show drvied class items on the top in the context menu. Is that even possible. Thanks
|
|
|
|
|
|
Hi All,
I'm just creating a Background worker to fill a datatable from an SQLCE database but i'm having trouble then passing that from the DoWork eventEventHandler to the WorkerCompleted event hander on the GUI thread in order to bind it to the datagrid ...
Can anyone advise on that?
TIA,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Use the Result property of DoWorkEventArgs and RunWorkerCompletedEventArgs classes to pass and retrieve result.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Oh my ... thanks very much for this info!!
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Glad to help you
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
I am using the PrintPreviewDialog to display reports created via a class that inherits the PrintDocument. I have no problem displaying the reports, but I would also like to be able to capture any keystrokes the user makes while the preview dialog has the focus; in particular I want to be able to capture the escape key. Unfortunately even though I have added handlers for the PreviewKeyDown, KeyDown, KeyPress, and KeyUp events of the print preview dialog, my class still does not capture any of the keystroke events in the print preview dialog. Does anyone know of a way I can capture keystroke events for the print preview dialog?
Thank you...
|
|
|
|
|
Well, I have an answer to my own question. If anyone is curious, I went ahead and created another class that inherits the PrintPreviewDialog, and by using that class to perform the preview functions I am able to capture keystrokes on the preview form, including escape, from within that class.
I would prefer not to have to create another class but if that is what is needed, I will live.
|
|
|
|
|
Hi,
Any points will be greatly appreciated.
Code shippet, etc..
Thanks.
|
|
|
|
|
There isn't too much to it. Here is a small sample class. It should be named something like WebServiceListner.asmx
Hope this gets you started.
Hogan
<br />
using System;<br />
using System.Data;<br />
using System.Web;<br />
using System.Collections;<br />
using System.Web.Services;<br />
using System.Web.Services.Protocols;<br />
using System.ComponentModel;<br />
<br />
public class Class1<br />
{<br />
[WebService(Namespace = "http://your.url.here.com/")]<br />
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]<br />
[ToolboxItem(false)]<br />
public class Class1: System.Web.Services.WebService<br />
{<br />
[WebMethod]<br />
public string WebServiceMethod(string xmlData)<br />
{<br />
return "";<br />
}<br />
}<br />
}<br />
|
|
|
|
|
Thank you.
That is exactly what I had in mind.
|
|
|
|
|
hello
can i set the location of the open/Save filedialog box
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
Yes you can. Use the InitialDirectory property.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
hello
hey i mean the place of the dialog in the screen
10x
dghdfghdfghdfghdgh
|
|
|
|
|
|
Hi!
i'm having some trouble with message queing.
to check if the queue exists I use MessageQueue.Exists(queueAddress) and the address is "machine.domain\queueName"
everything works fine when using this on a machine within the domain. but on a machine outside the domain Exists returns false.
i read that msmq uses windows authentication. my best guess is that this "false" is due to this beeing outside the domain security issue..
is there any workaround? passing some credentials or sth?
btw. it's a public transactional queue
thanks for any help!
life is study!!!
|
|
|
|
|
Hi,
I'm trying to build a generic Tree structure. The structure is based around parent node objects that are connected with edge object to its children node objects, everything starting from a root node object. The structure is contained in a tree object. For increased usability there is also a separate edge-connector object that stores each child- and parent node with its edge object.
Each node object contains a node element object and each edge object contains a edge element object, which are represented as respectively the generic types N and E.
To calculate the cost of traversing all edges to the leaf nodes, I've implemented a call from the tree object method GetEdgeElementsCost() that access the method int GetCost(TreeNode<N, E> ChildNode) of the generic type E through the implementation of an interface. There seem however to be something wrong with this approach as I keep getting errors when I try to compile.
I got the following errors:
Error 1 The type 'N' cannot be used as type parameter 'N' in the generic type or method 'WindowsFormsTestApplication1.TreeNode<N,E>'. There is no boxing conversion or type parameter conversion from 'N' to 'WindowsFormsTestApplication1.INodeElement'.
Error 2 The type 'E' cannot be used as type parameter 'E' in the generic type or method 'WindowsFormsTestApplication1.TreeNode<N,E>'. There is no boxing conversion or type parameter conversion from 'E' to 'WindowsFormsTestApplication1.IEdgeElement<N,E>'.
Here is an extract of the code:
public interface IEdgeElement<N, E>
{
int GetCost(TreeNode<N, E> ChildNode);
}
public interface INodeElement
{
}
public class Tree<N, E>
where N : INodeElement
where E : IEdgeElement<N, E>
{
private List<EdgeConnector<N, E>> _EdgeList;
public Tree()
{
_EdgeList = new List<EdgeConnector<N, E>>();
}
public int GetEdgeElementsCost()
{
int cost = 0;
for (int i = 0; i < this._EdgeList.Count; i++)
{
cost = cost + this._EdgeList[i].Edge.Element.GetCost(this._EdgeList[i].ChildNode);
}
return cost;
}
}
public class EdgeConnector<N, E>
where N : INodeElement
where E : IEdgeElement<N, E>
{
private TreeEdge<N, E> _Edge = null;
private TreeNode<N, E> _ChildNode = null;
public TreeEdge<N, E> Edge
{
get
{
return _Edge;
}
set
{
_Edge = value;
}
}
public TreeNode<N, E> ChildNode
{
get
{
return _ChildNode;
}
set
{
_ChildNode = value;
}
}
}
public class TreeEdge<N, E>
where N : INodeElement
where E : IEdgeElement<N, E>
{
private E _Element;
public TreeEdge(E Element)
{
this._Element = Element;
}
public E Element
{
get
{
return this._Element;
}
}
}
public class TreeNode<N, E>
where N : INodeElement
where E : IEdgeElement<N, E>
{
}
Anyone who knows how to solve this problem?
Thanks
|
|
|
|