|
What I get from this, is that char array will stay 0. WHen the Indent is increased, the char is set to the lowest of that Indent, say 'a'.
if there are 3 headings on that indent, that char will always be 'a' so the system knows it's on that level of indentation, and it will use that charset.
|
|
|
|
|
MrBic wrote: What I get from this, is that char array will stay 0.
It gets set before you start to represent the maximum number of indents, and what they will start with.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Basically,
i look at the Indent, and I indent that many over.
THat example is something stupid that customers would never use, though they could.
They need the same requirements as MS WOrd, and Word can do that unfortunately.
So yes, I just count the number of indents and then start a new sequence.
Indenting is easy, it's the sequence I'm having a hard time figuring out.
|
|
|
|
|
Hi, I have the following string which has a character \xF3, that should be character ó, how can I convert it from \xF3 to ó
"/L=Ciudad de Mexico/ST=Mexico, D.F./C=MX/CN=AC de Pruebas SAT/OU=Administraci\xF3n de Seguridad de la Informaci\xF3n/O=Servicio de Administraci\xF3n Tributaria"
Thanks in advance
Isaac B
|
|
|
|
|
Would String.Replace("\\xF3", "ó") work?
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Forum Folks,
I cannot get my mind around the catch-22 I am in. I have added a text box to the page dynamically as expressed in the code below. The user may change the contents of that textbox. However, when the user clicks on the Save button, the page is rewritten and, of course, the textbox is rewritten: the content is gone.
How do you save the content of a dynamic control before the page is rewritten?
TIA,
Sad Dog
//add the Filing Date
td = new TableCell();
txt = new TextBox();
if (dr["Filing"] == DBNull.Value)
{
txt.Text = "";
}
else
{
dtTemp = Convert.ToDateTime(dr["Due"]);
txt.Text = dtTemp.ToShortDateString();
};
txt.Width = System.Web.UI.WebControls.Unit.Pixel(75);
td.Controls.Add(txt);
tr.Controls.Add(td);
|
|
|
|
|
And, I have "most" of the anwser...
First, I created a User Control.
Then, I created: public void Save_Content().
Next, I went back to the parent page where the control is placed.
I created a Save button there. The click event does the following:
private void btnSave_Click(object sender, System.EventArgs e)
{
m_oLIFTable.Save_Content();
}
Also, I created a reference to the User Control where all my other controls are defined:
protected LoanTrak.WebForms.Controls.LIFTable m_oLIFTable;
The reason that I say "most" of the answer is because the page doesn't quite write the table of these dynamic date objects correctly. The first time through, as you chose a customer off of the parent page dropdown, the grid is filled out correctly. However, subsequent choices create the correct number of rows in this dynamic table, but the information from the previous choice is not completely cleared out.
I will work on that...Unless, someone has an idea?
Thanks.
Sled Dog
|
|
|
|
|
Hello,
I just want to know if it's possible to do sintax highlighting with .net richtextbox without extending that class. I've seen that there're two examples on codeproject but they extend the dll, and I can't.
Thanks you
Bests,
Paolo
|
|
|
|
|
I've done quite some work with the richTextBox control that was included with .NET 2003 (so this comment doesn't apply to the 2005 version) and I can tell you that it doesn't support syntax highlighting by itself. Actually the .NET component is actually a wrapper for the good old COM-based pre-.NET RichEdit32 control.
Those being said, what you could do is you could use the text changed event of the control and create your own interpretation class that you could feed the content of the control. The interpretaion class would then run through the text and *interpret* (that is, set formatting options for certain areas of the text) and set the text property of the component to the *interpreted* text. This is a solution although it may become slow as the density of the text increases. You may consider optimizing it by making a *wise* run-thtough by examinig what type of changes the text suffered...
Good luck!
|
|
|
|
|
Hey, guys.
I've been searching for days for a code example on how to update controls in the UI thread from a worker thread. All of the examples I come across are using windows forms rather than ASP.NET WebControls UI components. Consequently, they reference Invoke and BeginInvoke calls that are in the System.Windows.Forms.Control class but not in the WebControls derived classes.
The scenario I'm working with is a common one. On a button click event handler of an aspx page, I'm kicking off a worker thread that does a long process, and I'd like to update a System.Web.UI.WebControls.Label control with the status on each iteration through the long process loop in my worker thread. Naturally, you can't update a UI control from any thread other than the UI thread. Examples abound on how to use delegates to accomplish this in a Windows Forms app, but I've yet to find anything that shows the proper technique in an ASP.NET app.
Any help on this would be most appreciated, as I've pretty much Googled myself to death with no luck.
Thanks,
Christopher Duncan
The Career Programmer: Guerilla Tactics for an Imperfect World
Unite the Tribes: Ending Turf Wars for Career and Business Success
The Composer Channel (Internet radio)
|
|
|
|
|
You haven't found any examples simply because you can't do what you want! Once the page is sent to the browser, there is no updating it unless the browser requests a new, updated page. The server can only give information to the browser when the browser requests it, not when the server has it to give.
Other pages can do this because it's a Java component that is communicating with the server and getting updates from this other thread.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 16:10 Tuesday 25th October, 2005
|
|
|
|
|
Dave Kreskowiak wrote: You haven't found any examples simply because you can't do what you want!
Arrrrrggghhh! I hate bloody web developing!!!
Sorry, just had to get that out of my system.
Thanks, man. I was beginning to wonder if I was just too stupid to program anymore (always an option worth considering). Added an internal 'started' flag for the thread to keep the event handler from kicking one off on each refresh, and then added a
to the aspx file to auto refresh every ten seconds and I'm getting the desired results. Crude, but effective. At least I can quit chasing my tail on this one.
Does anyone know if there's an easy way to alter the CONTENT= portion of this meta tag from the C# code so that I can turn off the refresh when the processing is done?
Christopher Duncan
The Career Programmer: Guerilla Tactics for an Imperfect World
Unite the Tribes: Ending Turf Wars for Career and Business Success
The Composer Channel (Internet radio)
|
|
|
|
|
The only thing you can really do is use Ajax (client side JavaScript + XmlHttpRequest) to poll the server for when something's done, then change the UI when the server responds that it is.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
I ran into some problems with the bitmap class and I was given the following advice:
The code below works for me.
Bitmap bmp = new Bitmap(w,h,PixelFormat.Format24bppRgb);
//create drawing surface
float res = 300f; //default resolution of 300dpi
bmp.SetResolution(res,res);
bmp.MakeTransparent(Color.White);
//Create new graphics canvas from the bitmap
Graphics G = Graphics.FromImage(bmp);
//set graphics properties for good bitmap rendering
G.PageUnit = GraphicsUnit.Pixel;
G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
G.CompositingQuality = CompositingQuality.HighQuality;
G.CompositingMode = CompositingMode.SourceCopy;
G.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;
G.InterpolationMode = InterpolationMode.High;
//clear the bitmap background (set to white)
G.Clear(Color.White);
// draw a 2px border around the grid image area
G.DrawRectangle(new Pen(Color.Black,2),0,0,w-2,h-2);
....
// draw the rest of the graphics, including text
...
G.Dispose();
// save the image
bmp.Save(imagefilePath,ImageFormat.Bmp);
bmp.Dispose();
This worked fine, up to a point. It enabled me to write a .bmp file to C drive like I intended but all I got was a blank .bmp file without the lines, curves and the labels I wanted displayed.
Can someone knowledgable help me please?
FJ
|
|
|
|
|
I just tried your code and it worked for me, in as much as I got a bitmap with a hollow black rectangle in it. Is that not what you get?
Rob Philpott.
|
|
|
|
|
Hi.
I got this code from this site, I used part of it, what I wanted and needed. I still don´t know how to make my program (that I used the code I mentioned before) write what I want to the .bmp file. All I get is a blank .bmp file with nothing in it. I wanted my program to save a .bmp file to disc (it does that now) but more importantly write some stuff that I tell it to do in this .bmp file (labels with text, lines and curves). Do you know how to do that?
FJ
|
|
|
|
|
Sorry, I'm confused. I took the code you pasted in your original message and turned it into a simple console application. I also added an extra line of code to put a circle in the middle of the bitmap:
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Drawing.Imaging;
namespace Test
{
class Test
{
[STAThread]
static void Main(string[] args)
{
Bitmap bmp = new Bitmap(100, 100, PixelFormat.Format24bppRgb);
//create drawing surface
float res = 300f; //default resolution of 300dpi
bmp.SetResolution(res,res);
bmp.MakeTransparent(Color.White);
//Create new graphics canvas from the bitmap
Graphics G = Graphics.FromImage(bmp);
//set graphics properties for good bitmap rendering
G.PageUnit = GraphicsUnit.Pixel;
G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
G.CompositingQuality = CompositingQuality.HighQuality;
G.CompositingMode = CompositingMode.SourceCopy;
G.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;
G.InterpolationMode = InterpolationMode.High;
//clear the bitmap background (set to white)
G.Clear(Color.White);
G.DrawRectangle(new Pen(Color.Black,2), 20, 20, 60, 60);
G.DrawEllipse(new Pen(Color.Black,2), 20, 20, 60, 60);
G.Dispose();
// save the image
bmp.Save(@"c:\tst.bmp",ImageFormat.Bmp);
bmp.Dispose();
}
}
}
When I compile and run this console application, I get a new file c:\tst.bmp which is a 100x100 bitmap with white background with a 60x60 hollow black square and in the middle of it. Inside the square is a circle. It looks to work fine...
Rob Philpott.
|
|
|
|
|
Since I posted the code for you, I guess I should point out that the comment between the ellipses
:
...
// draw the rest of the graphics, including text
...
means you have some work to do. I have no idea what you want to draw on the graphics surface, but this is where you need to do it. I left in the G.DrawRectangel that draws a border around the bitmap as a sort of example, but the rest is up to you.
The secret to this is that by creating the graphics surface from the bitmap (you decide on the size and set the w (width) and h (height) parameters approprietly,
then draw the rest of the content (Use any of the Drawxx Methods in the System.Graphics namespace). Then when you save the bitmap, it will contain what you have drawn. Without seeing the code you were using to 'create' your lables, this is the best I can offer. If you will post the code you are using now (or at least some examples, I will try to flesh out the example further.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
-- modified at 18:53 Tuesday 25th October, 2005
|
|
|
|
|
I'm having a problem with an exception thrown by a backend (non gui) class being intercepted by the framework before it has a chance to bubble up to the GUI layer to display the appropriate error message.
Trying to localize the probem I wrapped every call going up the stack in this sort of try/catch block:
try
{
/*calling statements*/
}
catch
{
throw;
}
Tracing it via the debugger, it's successfully thrown out of the assembly where it occurs, is caught and rethrown by the first two methods inside the gui, from the second method (which is a gui control event handler if it's relevant) instead of propagating farther up the callstack, it's intercepted by the framework which displays a details/continue error and eats the exception.
I could move the error generation and shutdown code to a place in the callstack before this happens, but the same error can (potentially) occur elsewhere in the app, and in all cases should result in an identical action (shutdown), so I'd like to handle it in only one place, with the other fatal exceptions which are handled inside Main();
|
|
|
|
|
|
I don't think so. appDomains only come in during IPC, right? MY apps single threaded, and the exception gets stolen going between two methods of a single class.
|
|
|
|
|
dan neely wrote: which is a gui control event handler if it's relevant
Event handlers for GUI controls run on the UI thread, so any exceptions thrown from them will cause the message loop to terminate and Application.Run to return. How are you attempting to propagate the exception from the event handler?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I didn't know that, and didn't do anything special. Is there a way to make it pass through? If not, I can change the structure of the app enough to avoid the problem.
|
|
|
|
|
I have the following enum:
[TypeConverter(typeof(E1C))]
public enum E1
{
a = 1,
b = 2,
c = 3
}
And the following converter:
public class E1C : EnumConverter
{
public E1C(): base(typeof(E1))
{
}
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
if(value != null)
{
if(destinationType == typeof(string))
{
if((E1)value == E1.a)
{
return "a a a";
}
else if((E1)value == E1.b)
{
return "b b b";
}
else if((E1)value == E1.c)
{
return "c c c";
}
}
if(destinationType == typeof(InstanceDescriptor))
{
FieldInfo fi = EnumType.GetField(value.ToString());
if(fi != null)
{
return new InstanceDescriptor(fi, null);
}
}
}
return base.ConvertTo (context, culture, value, destinationType);
}
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if(value != null && value is string)
{
if((string) value == "a a a")
{
return E1.a;
}
else if((string) value == "b b b")
{
return E1.b;
}
else if((string) value == "c c c")
{
return E1.c;
}
}
return base.ConvertFrom (context, culture, value);
}
}
Now, on the property page every thing works fine, as well as in ASP .net page,
but within Windows Form, the designer generates the folowing code:
#region Windows Form Designer generated code
...
...
this.userControl11.E1 = WindowsApplication2.E1.b b b;
...
...
#endregion
As you can see, instead of generating:
this.userControl11.E1 = WindowsApplication2.E1.b;
It generated:
this.userControl11.E1 = WindowsApplication2.E1.b b b;
If anyone know this problem and its solution, it would be nice!
Thanks in advance!
Ilan
|
|
|
|
|
I posted this message in ASP.net by mistake.
However, minhpc_bk has answer this question, and it works fine!
Here is the link to the answer of the same question (if anybody is interested).
The answer
|
|
|
|
|