|
Green Fuze wrote: I know I can draw a line from one X to the other, but I want to do it in dots.
Surely the end result will look the same, unless the dots are way far apart ?
Green Fuze wrote: I don't know why it doesn't work... yet
It will most certainly work
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
1) Try drawline(pen, point1, point2) where point2 has x and y values that are one greater than in point1. I'm not sure about Windows graphics, but many others I've worked on plot from the first point to one less than the second. In other words the length of the line is the distance between the two points and since you have identical beginning and end points the distance is zero which means nothing is drawn.
2) The simple transformation (x,y) <= (x+a,y+b) will move the origin of (x,y) to any (a,b) point.
|
|
|
|
|
I need to create an Ordered List (like the numbered/bulleted list in Word) without using any HTML.
I have a Table in a DataBase with an Indent Column (int).
0 - 20 indents allowed.
I have a Name Column (VarChar / String).
I cannot use Parent / Child relationships. The System would need 5 days of work to support that with the tables I'm pulling this data From.
The Data Is in order when retrieved from the DB, so I can just run through a For loop and it will print out fine. I have no idea how to do the numbered lists though.
HEre's an example on what it needs (from user requirements) to put out if the user wants it.
<br />
1...A Heading<br />
2...Another Heading<br />
...a....this is a sub heading<br />
...b...and another sub heading<br />
3...More headings<br />
...a...One more<br />
......A...Yet again<br />
.........1...Oh wait there's more<br />
4...yes there is<br />
......A...I jumped ahead one.<br />
5...Back Down<br />
..........1...I jumped Ahead a lot<br />
......A...Yes you did.<br />
.........a...Something Else<br />
6...And back down.
Sorry about the decimals, I use those for spacing.
I've been beating my head on this for 2 days now.
Any help would be very appreciated.
-- modified at 18:37 Tuesday 25th October, 2005
|
|
|
|
|
MrBic wrote: 5...Back Down
..........1...I jumped Ahead a lot
......A...Yes you did.
.........a...Something Else
I don't understand how this numbering system works ?
Can't you just count the number of indents, and when it increases, start a new numbering sequence ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I didn't understand at first either.
But you got it,
Each time the Indent Counts up, I have to indent that many spaces, and then find the letter / number used before hand for it.
So if it was:
1.
the next would be
2.
1.
2.
Indent = 1,
a.
Right now I know how to manage the INdents, I need to know how to manage the numbering / letering. That's wehere I'm stuck.
So Yes, your last statement was correct, but I've been working on this for 2 days and my mind is fried, so any help would be great.
Ryan
|
|
|
|
|
I think you need to create a char array, which represents depth. This way, the value at array position 0 represents the last character you used at the lowest depth. Then you can reset the other values when you start a new group at that depth, and increment it while the depth remains the same. Does that make sense ? The array will then remember for you what the last character was that you used, when the depth drops by one or more.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
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();
|
|
|
|
|