|
Please don't cross post. Choose the forum that represents the language you're using, and just ask the once.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
You can convert a bitmap to an pixel[x,y] class.
I write something for you:
[code]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace CodeProject.Example.Drawing {
public partial class fcmMain : Form {
public fcmMain( ) {
InitializeComponent();
}
private void btAction_Click( object sender, EventArgs e ) {
PixelField bitmap = new PixelField((Bitmap)Bitmap.FromFile(@"C:\Documents and Settings\Marijn\Bureaublad\crap.JPG"));
Color c = bitmap[3, 4]; // get pixel.
bitmap[4, 5] = Color.Red; // assign a red color.
for(int x = 0; x < bitmap.Width; x++)
bitmap[x, 5] = Color.White; // white line.
}
}
public class PixelField {
int width; // used, because using bitmap.Width is slower then you think.
int height;
Bitmap bitmap;
public int Width {
get { return width; }
}
public int Height {
get { return height; }
}
public PixelField( Bitmap bitmap ) {
this.width = bitmap.Width;
this.height = bitmap.Height;
this.bitmap = bitmap;
}
public Bitmap Bitmap {
get { return bitmap; }
set { bitmap = value; }
}
///
/// Get or Set a pixel on the bitmap.
///
/// InvalidOperationException can occur.
///
/// <param name="x" />
/// <param name="y" />
/// <returns>
public Color this[int x, int y] {
get { return bitmap.GetPixel(x, y); }
set { bitmap.SetPixel(x, y, value); }
}
}
}
[/code]
Don't forget, easy class, no unsafe code, so in this case: pritty slow for most actions.
|
|
|
|
|
hi
i use vc# 2005.
i want in form2_load event,the form_login should be hide,but it's not hide,where is the problem ??
when user press btn_enter in form_login,the form_login hide(it is worked),but in form2_load event it's not hide. How to solve problem??
thanks
|
|
|
|
|
hdv212 wrote: hi
i use vc# 2005.
i want in form2_load event,the form_login should be hide,but it's not hide,where is the problem ??
when user press btn_enter in form_login,the form_login hide(it is worked),but in form2_load event it's not hide. How to solve problem??
thanks
Your question is a little vague. How are you passing the reference to the first form into the second form? Is it via the Form2 constructor or another method.
|
|
|
|
|
|
Hi Everyone!
I am unable to view xml document into Browser control. Please help me in this. Here is what I am doing:
<br />
<br />
XmlDocument xDoc = new XmlDocument();<br />
<br />
xDoc.Load("Check.xml");<br />
<br />
<br />
I want to display this xDoc into "Microsoft Web Browser" component that is dropped on Form.
<br />
<br />
private AxSHDocVw.AxWebBrowser axWebBrowser1;<br />
<br />
object obj = null;<br />
<br />
axWebBrowser1.Navigate(??????, ref obj, ref obj, ref obj, ref obj);<br />
<br />
In first parameter if I use URL it works fine for it but tell me how can I display xDoc into that browser component.
Is there any other simple way to perform this task? please plzzz mention code.
please guide thank you.
|
|
|
|
|
private void InitializeComponent()
{
this.webBrowser1 = new System.Windows.Forms.WebBrowser();
this.SuspendLayout();
//
// webBrowser1
//
this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
this.webBrowser1.Location = new System.Drawing.Point(0, 0);
this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser1.Name = "webBrowser1";
this.webBrowser1.Size = new System.Drawing.Size(718, 548);
this.webBrowser1.TabIndex = 0;
this.webBrowser1.Url = new System.Uri("C:\\ZJA\\VS2005\\Test.xml", System.UriKind.Absolute);
}
Try this:
I read your post and this is what I did to check myself.
1: Create test.xml file
2: dropped a webbrowser on a from and set the url to my test.xml file
3: run and the webbrowser loaded the file without errors
Jason
Sometimes simply is better than fancy. The developer stated after typing code line 10 billion!!!
|
|
|
|
|
Thanks Jason.
I have XmlDocument class object that has Xml file loaded. I want to display that object contents into browser. I hope I am making clear.
|
|
|
|
|
If you are just wanting to view the xml file in a webBrowser then why are you loading it into a xmlDoc class in the first place? I guess you are doing something more than just viewing it right?
Jason
Sometimes simply is better than fancy. The developer stated after typing code line 10 billion!!!
|
|
|
|
|
Have you tried setting the webBrowser's Url property?
|
|
|
|
|
yes I am doing little bit extra. I have loaded xml file into DOM "XmlDocument" class and modified its in memory. As DOM class loads xml file into memory in tree form. Now i want to display that modified file into browser control in form.
is that possible???????????????
Thanks
|
|
|
|
|
Open it, change it, save it, then open it in web browser. You might want to output it to a stream instead of saving it.
|
|
|
|
|
Have you seen XML Notepad 2007.
It creates XML file in treeView and when we click "XSL Output" tabpage it displays browser output of XML.
|
|
|
|
|
Yes. Why not just download their sourcecode from codeplex and see how they did it?
|
|
|
|
|
Hi
I have a MdiForm with some child forms.
In MdiForm i have a StatusStrip control with toolStrips as items.
From ChildForms i cant change visible property of StatusStrip items.
I created a function in MdiForm to call it from ChildForms and wrote code in it to change visible property, but it faild too.
In MdiForm i have no problem, problem occurs when i try to change from childForms.
What should i do?
Regards
|
|
|
|
|
Posting the text of the error messages abd some code snippets wouldbe very helpful.
Regards
|
|
|
|
|
Ok
Can you describe it more for me please?
Tanx.
|
|
|
|
|
Describe what??!! I'm telling you to post the errors are you getting, and the code you are using that is giving you these errors!!
Regards
|
|
|
|
|
Ok
Dear friend
For example in statusStrip control, i want to change first items text or second items visibility, i can do this in MDIForm that contains this control, this controls and it's items are public, but changing its items from ChildForm has no effect!
There is no error message, just i see nothing.
<br />
public void setStatusbar(string Message, bool visible, string tsStatusLabel)<br />
{<br />
statusStripMain.Items[tsStatusLabel].Text = Message;<br />
statusStripMain.Items[tsStatusLabel].Visible = visible;<br />
}<br />
<br />
copymdiMain.setStatusbar("InProcess...", True, "tsStatusLabelProcess");<br />
i wish this was enough.
-- modified at 14:07 Friday 1st December, 2006
|
|
|
|
|
The copymdiMain object; How do you provide it to the child form? Via a Constructor I suppose?
It should work, but if you make it using the new keyword for every child sure it won't work.
Regards
|
|
|
|
|
can i use matlab in C#??how to include it?
SUMA
|
|
|
|
|
|
Hi everyone,
I am using Sharpdevelop.
I have specified the icon of my app in the property inspector,
and it is showing correctly in the title bar of the app when
I run it.
But when I look at the executable in explorer, it is a dos window
exe icon.
How do I specify the icon so that it shows up correctly in explorer?
forged
|
|
|
|
|
Sounds like you have set the 'forms' icon but not the app's icon
Sometimes simply is better than fancy. The developer stated after typing code line 10 billion!!!
|
|
|
|
|
OK, I have set the form icon properly.
How do I set the application icon?
Can someone please tell me?
I AM USING SHARPDEVELOP and C#.
forged
|
|
|
|