|
Hi musefan,
I am trying to display RichText not plain text. Or are you saying that the DrawString() command handles rich text as well?
-David.
|
|
|
|
|
No, DrawString() will not auto handle your formatting.
Have a look at this[^] for some ideas.
You could always handle yourself by iterating through each word in the richtextbox then getting its formatting(color, font etc.) before drawing it to the graphics object.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Thanks.
I did not think to loop though the rich text. Might just do that.
The link was useful too.
-David.
|
|
|
|
|
Hi.. Am new to C# and our director gave a project.
Basically, what i want to do is launch an external program and place it within my c# app so when i maximize it, it just maximize within my app. I know how to launch an external program. What i want to know is it is possible to place the launched program in a child form for example.
Any help would be appreciated. Thanks..
|
|
|
|
|
There's an article on here called Windows Tabifier[^] that does what you want.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi,
how can i open an existing excel file as a new document.
and if user close it from upper left close(X) button of doc,
then it should ask to save the document as a new excel doc file.
amit
modified on Friday, March 20, 2009 7:57 AM
|
|
|
|
|
Hi,
I need to loop over a class' properties(object.GetType().GetProperties()), and if the property implements IEnumerable I need to respond to that, but I cannot find a way to confirm this, any ideas?
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
You'll need to have a check that gets the type of the properties and then checks which interfaces it implements. Something like:
<br />
Type[] ifaces = field.GetType().GetInterfaces()<br />
if (ifaces.Contains(typeof(IEnumerable))<br />
{<br />
}<br />
where field is the property you're looking at.
This might be better implemented as a recursive function if you have a deep object tree.
It definitely isn't definatley
|
|
|
|
|
Great, thanks. Took me a while to figure out what the results were but makes sense.
Now for the next challenge: For Generics collections you can do object.GetType().GetProperties()[0].PropertyType.GetGenericArguments()[0].Name for example to find out what object is contained by the enumerable, what would the equivalent be for an array?
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
If I've understood correctly, you need to look at the ElementType of the object:
<br />
int[] myarray = new int[10];<br />
Type arrayType = myarray.GetType().GetElementType();<br />
will return System.Int32
It definitely isn't definatley
|
|
|
|
|
Perfect, thanks for the help
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
Hi.
How can we add an icon to our control library ?
I mean , I want to change this icon[^]
Thank you.
|
|
|
|
|
You need the ToolboxBitmap attribute. A couple of issues with it that I've found.
It doesn't show at all if the control/component is in the same project.
If it's a component, it will only show the icon in the designer (not in the toolbox for either control or component) if it's in a seperate project in the same solution.
Works fine if the output dll is used as the reference!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Is this it :
[System.Drawing.ToolboxBitmap(typeof(WebCamCapture), "CAMERA.ICO")]
DaveyM69 wrote: It doesn't show at all if the control/component is in the same project.
So how can we set an icon to it ?
|
|
|
|
|
The below code is i tryed for ajax auto complete on my site..
plz say if their is any bugs...
default2.aspx
]]>
<title>
function IAmSelected(source, eventArgs) {
alert(" Key : " + eventArgs.get_text() + " Value : " + eventArgs.get_value());
}
<asp:scriptmanager id="ScriptManager1" runat="server" xmlns:asp="#unknown">
<services>
<asp:servicereference path="~/WebService.asmx">
<asp:textbox id="TextBox1" runat="server" xmlns:asp="#unknown">
<ajaxtoolkit:autocompleteextender id="AutoCompleteExtender1" runat="server" onclientitemselected="IAmSelected" xmlns:ajaxtoolkit="#unknown">
BehaviorID="AutoCompleteEx" TargetControlID="TextBox1" ServicePath="WebService.asmx" MinimumPrefixLength="3" EnableCaching="true" ServiceMethod="GetCompletionList">
autocomplete.cs
using System;
using System.Collections.Generic;
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;
using System.Web.Script.Services;
///
/// Summary description for WebService
///
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService
{
public WebService () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string[] GetCompletionList(string prefixText)
{
{
string sql = "select Aname From Pincode Where Aname like @prefixText";
SqlDataAdapter da = new SqlDataAdapter(sql, "Server=sql346.mysite4now.com;uid=aitts_85478;password=aitts;database=aitts_85478");
da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = prefixText + "%";
DataTable dt = new DataTable();
da.Fill(dt);
// List<string> items = new List<string>();
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(dr["Aname"].ToString(), i);
//items.Add(dr["Location_Name"].ToString());
i++;
}
// return items.ToArray();
return items;
}
}
}
webservice.asmx
]]>
its not working for me....
|
|
|
|
|
First off there is an ASP.net forum that you may get more help with
Second please don't post so much code only the relevant problem areas
Third when posting code please use the code block then people can read it easier and follow the code.
and finally what error message are you getting?
|
|
|
|
|
Hi all,
Can someone tell me a way to add text and an image on a ListBox. Actually I want to add an icon in between text.
I can add text there, but stuck with the image.
Thanks all.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
You may be able to do it by setting DrawMode to one of the OwnerDraw modes and using the DrawItem event.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Sorry for disturbing.
Do you know any example link about that? If so please can you send it here.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Plenty on google[^]
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi All,
I wrote an application that reads web page contents and send to specified email addresses.
I want to make this configurable; i mean a user should be able to set/change at anytime the to,from,subject etc. details.
I am new to C# but i know that app.config is one way to do this, but what i have read in forums that people generally use it only for installation configs.
Is there any other way where a user would be able to provide input in key-value format?
Thanks,
AksharRoop
|
|
|
|
|
Use the application settings. Project|Properties|Settings. Create any fields you need making sure the scope is User.
You can then recall these using
Properties.Settings.Default.YourSettingName
and saved using
Properties.Settings.Default.Save();
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Add a "Settings" file (using the VS add new item option), name it something like "MySettings"
Open it up and add your various different settings, set a type for them, and provide default values. (Make sure they are set to "application" scope not "user".
In you program you can read the values by doing MySettings.Default.MySettingValue.
When you compile your app you'll find the defaults are added to the app.config file.
in the bin\debug\ directory you can edit the exename.config file and make changes. when you run it, it will use the value from the .config file.
(The default values are actually also compiled into the assembly, so if you delete the exename.config file, or remove any values it will still revert to the default ones that are compiled into the assembly.)
Alternatively, if you set the settings to "user" mode, you will be able to write changes to them in code, and call MySettings.Default.Save() to save the changes to a user.config file that is stored in "c:\documents and settings\username\localsettings\application data\appname\appversion\user.config". If you did this you would also need to provide a configuration form for the user to enter their values and hit save.
Simon
|
|
|
|
|
I want to write application which will run on Windows CE
& I want to use Idle processing but I am not able to handle Idle
processing for windows CE application
i.e I can not handle Application.Idle event.
How to do that.
thanks
|
|
|
|
|
saksp wrote: i.e I can not handle Application.Idle event.
Why not? According to the documentation[^] it's available on CE.
I are troll
|
|
|
|