|
about the SetPixel.
I cannot find SetPixel for a graphic object, only for Bitmap object.
I want to draw on the window itself, not on a bitmap.
I tried this code:
creating a bitmap on the window, and draw on it, but it doesn't work.
X=1;
Y=1;
Bitmap bp = new Bitmap(this.Width, this.Height);
bp.SetPixel(X, Y, System.Drawing.Color.Black);
thanks again!
|
|
|
|
|
Yes, SetPixel is a method on the Bitmap. I'm not sure why drawing a one pixel long line would fail to work though ( although I've never tried it ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
what I am trying to do is to draw a mathimatical function, something like:
y = x^2 + x + 1
just as example,
so I wrote a for loop from x= -50 to x= +50, and I want c# to put a black dot at each x,y , but instead of drawing that, it does nothing...
if you have any idea why it wouldn't work, I'll be more than greatful!
thanks again!
|
|
|
|
|
I don't understand why you can't just draw onto a bitmap and draw that to the screen. The other thing is, you can draw a line from each x value to the next one.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I know I can draw a line from one X to the other, but I want to do it in dots.
and about why I can't draw onto a bitmap and than draw that on the screen, I don't know why it doesn't work... yet
|
|
|
|
|
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
|
|
|
|
|