|
I want to know the length of string in pixels in a web based applicaiton. can anyone tell me how can i get it..?
If my mind can conceive it, and my heart can believe it, I know I can achieve it.
|
|
|
|
|
Well to know that you have to know the Font object the string is formatted with. Even then I'm not convinced it will give back exact results under all circumstances (also note you can change font size in the browser without the server-side knowing of it). With these limitations stated a good approximation would be:
int width;
System.Drawing.Font myFont = System.Drawing.SystemFonts.DefaultFont;
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(1, 1);
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp))
width = (int)g.MeasureString("myString", myFont).Width;
bmp.Dispose();
|
|
|
|
|
Hey Thanks a ton for the response. The code worked. Now I just need to set the width accordingly. Thanks once again.
If my mind can conceive it, and my heart can believe it, I know I can achieve it.
|
|
|
|
|
In a web based app? There's no way to figure this out. Your ASP.NET app doesn't have access to any resolution information abtou the clients machine, DPI settings, the font the browser is actually going to use to render your content, ... You can't get any of the information you need to figure this out.
The only way to simulate this is if you wrote the string to a bitmap image, then sent the image to the browser.
|
|
|
|
|
If web based applications have access to the Graphics object through any paint routines, then you can use the measurestring method.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
I'm hoping someone has some advice or can point me in the right direction on this as it's been doing my head in for a week.
I've got a Visual Studio 2005 solution, and I've added an installer project to it. My problem lies in the fact that the projects that are to be installed use two versions of the Enterprise Library. Some projects contain legacy code that uses V1.1 of the Enterprise Library and some, that have newer code, uses V2.0 of the Enterprise Library. When I add the main project (the one that references everything else) it attempts to add all the dependencies including to the Enterprise Libraries.
This causes confusion - VS throws up lots of warnings about duplicate assembly names and it installs the files randomly - Sometimes a V1.1 DLL sometimes a V2.0 DLL.
We've compiled the Enterprise Library such that it can be installed in the GAC. But adding the Enterprise Library FIRST to the installer project and into the "Global Assembly Cache Folder" doesn't appear to help. When I add the projects to be installed it still insists on installing (randomly) the Enterprise Library in the installation folder - while complaining bitterly about it too!
Finally, I've tried adding the assemblies individually (instead of selecting Project Output) but it still picks up the dependencies and insists on adding them to the installer.
Does anyone have any ideas of how I can overcome this problem and actually build an installer that works?
|
|
|
|
|
You might actually have to dig into the msi database. Its been a while but in the past I have had to use the Orca tool (I think that is what it was called) to force some issues. You might be able to bypass the IDE and add the assemblies directly to the database.
only two letters away from being an asset
|
|
|
|
|
I don't really like the idea of that. It looks like it would make rebuilding the installer a bit of a challenge.
I've discovered that I can select a file's properties in the installer and exclude it (Delete wouldn't work) so I'm going to try that.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
i write a program in vb.net and i have made a setup of it.My requirement is that when i installed the setup than automatically software run. is it possible? tell me what option would set in making setup that automatically run ater installed the setup plz guide me.if there is any solution.
Thanks
suahil shahab
|
|
|
|
|
Try using the custom action and call the execuatble once your installation is done.
Hope this helps.
|
|
|
|
|
Hi,
I have got a TestSol which contains three projects , but all three projects are not selected for build, it means if I build whole solution then none of the project would be built, but if I build the one specific project then that would be built fine. but when i want to perform same task throught MSBuild by providing command "MSBuild "E:\MyTestSol_noneprojectincluded.sln" /t:TestProject1:Rebuild "/p:Configuration=Debug" but i get the error "The project "TestProject1" is not selected for building in solution configuration "Debug".", how can i successfully build the TestProject1 in a solution even it is not selected in the solution configuration.
Warm Regards,
Mushq
|
|
|
|
|
Hi
I have a few class files that I need to reverse engineer to get UML diagrams. I have Visio Professional 2003 installed on my system , and the Visual Studio version is 2005 Professional.
I searched msdn, where i read the below directions, but I am not able to find the Visio option in my Visual Studio, please let me know how do I do this, is there a way to add the Visio component into Visual Studio?
-------------- from msdn-------------------------
In Visual Studio, in the Solution Explorer, select a solution.
On the Project menu, click Add New Item.
In the Add New Solution Item dialog box, click Visio Files, and then click UML.
Under Templates, click a UML diagram, and then click Open.
-- modified at 23:20 Wednesday 6th June, 2007
Every thing is Illusion
|
|
|
|
|
In VS.NET 2005 right click a .cs file and chose "View Class Diagram".
http://stefanprodan.wordpress.com
|
|
|
|
|
They may have removed the option in VS 2005 in favour of the built-in class diagrams feature?
Kevin
|
|
|
|
|
Hi, all. I am trying to use a DataGridView to add records from multiple, related tables in a database. So far, I have been able to bind the DataGridView to a BindingSource that consists of a query, and to display and navigate through them using a BindingNavigator.
I can't seem to figure out how to add a record the needs to populate multiple tables in the DB.
When I click the Add New Item button on the BindingNavigator (and add data for all required fields), the record appears on the DataGridView, but it is not being written to the DB. If I close the app and run it again, the new record is not there. The same happens when deleting a record using the BindingNavigator's delete button. Is it being written to the query that is contained in the bindingsource only? Can someone assist?
Regards,
|
|
|
|
|
I have posted this question, but received no answers yet, even after considerable activity in the msg board. Is this not the right place to post such a question? Please advise, as it is the first time I post to this board.
Thanks
Juan
|
|
|
|
|
I vaguely remember seeing this exact same subject line in two or three other forums, so that's probably why it didn't get answered.
ramakaniel wrote: but it is not being written to the DB.
It won't be until you call Update on some dataadapter to write the data back out to the database. A DataSet is an in-memory copy of the data, not a reference to the database itself.
|
|
|
|
|
Ok, I have a query table adapter that represents the query displayed on the datagridview, pulling data from multiple, related tables, as such:
TITLE AUTHOR PROGRAM...CATEGORY
Is this the dataadapter you refer to? If so, I does not have an Update method. Please clarify or point me to a tutorial that details this.
Regards,
Juan
|
|
|
|
|
If the TableAdapters do not have an Update, then, from MSDN here[^]:
TableAdapter Update Commands
The update functionality of a TableAdapter is dependent on how much information is available based on the main query provided in the TableAdapter Wizard. For example, TableAdapters that are configured to fetch values from multiple tables (JOINs), scalar values, views, or the results of aggregate functions are not initially created with the ability to send updates back to the underlying database.
The reason you can't call update is because the TableAdapter can't update multiple tables from a single query.
You'll either have to supply the SQL and VB.NET code in the TableAdapters to update the individual tables yourself, or scrap the tableadapter and write the complete SQL and VB.NET code for all the operations you want on the tables involved.
|
|
|
|
|
I've successfully played around with WMI to interrogate random computers on my network in an application on my workstation, and I thought it would be a cool idea to make a program like that in the compact framework so that I could do it from my PPC. Unfortunately, the System.Management namespace doesn't exist in the compact framework. Does anyone know of or can point me in the right direction to a way to querying WMI from the compact framework? Any help is appreciated, thanks in advance
|
|
|
|
|
The CF doesn't support WMI at all. It also doesn't support ASP.NET, Enterprise Services, Message Queues, COM Interop, the OleDb and ODBC data providers, generic serialization, asynch delegates, Remoting, Printing, some XML stuff, ... and some other stuff I can't remember.
No, you can't use WMI form the Compact Framework. Windows CE doesn't have the support for WMI, so it's not included in .NET CF.
|
|
|
|
|
But is there some kind of work-around, maybe a library that someone has made or a link to a way to make a library? Because it works with queries there seems like there should be a way to hack a way to do it, even if I have to do the socket code myself.
|
|
|
|
|
Nope.
WMI has two parts, a server AND a client portion. The server runs on any Windows machine, with WMI installed, compiling all the data from the WMI Providers and serving it up through something akin to a small SQL server. This part doesn't exist in Windows CE at all.
The client side is also on every machine that has WMI installed. This part is a COM-based library that formats requests, talks to the WMI Server, processes results, handles application interaction, and all kinds of other stuff on WMI collections of WMI objects. This part ALSO doesn't exist in Windows CE.
There's nothing you can do about this unless you find someone who has written a WMI Client library for Windows CE. I haven't been able to find one...
|
|
|
|
|
:/, that's unfortunate... it seems like it would be a highly arduous task to do. I suppose its back to the drawing board; thank you very much for your assistance.
|
|
|
|
|
Hi all,
I'm trying to open a socket between a device running .NET CF 1.0 and a PC. The code that sets up the socket (in C#) looks something like this:
TCPClient cli = new TCPClient("192.168.100.150", 11240)
The host runs on 192.168.100.150 and listens on port 11240. When I run the above code on a device with .NET Framework 2.0, everything works fine but when I run it on a device running .NET Compact Framework it throws a System.Net.Sockets.SocketException with error code 11001 (which translates to "No such Host is known").
This seems to have something to do with the dotted IP Address because when I provide a url like "www.google.com" it works (but then throws another exception because you can't connect to google on 11240).
Would anyone have an idea why TCPClient wouldn't accept a dotted IP Address and how to get around it?
|
|
|
|