|
is it possible to add a folder in a tree view, if i drag and drop a folder from my desktop or local drives to my application tree view control.
Plz help me... if it is possible? how i have to proceed....
thanks in advance.........
|
|
|
|
|
Hi ,
Am new to Graphics and Imaging.
i tried to draw a *.jpg image[which is a MRI image of human brain] using SetPixel(..).
But while executing its throwing exception as "SetPixel is not supported for images with indexed pixel formats".
What does it actually mean and how can i resolve it?
Thanks
|
|
|
|
|
Hi,
Vsree wrote: i tried to draw a *.jpg image
what do you mean by drawing a jpg image? Do you want to draw pixel by pixel in your application and save as a jpg or do you want to display a jpg?
Do your best to be the best
|
|
|
|
|
Actually i tried to load an JPEG image from file and set its pixel color to a new value and redraw it using Graphics object and save it in the file.
<br />
Color c;<br />
for ( int x=0; x<imgDefault.Width-1; x++ )<br />
{<br />
for ( int y=0; y<imgDefault.Height-1; y++ )<br />
{<br />
c = imgDefault.GetPixel( x, y );<br />
c = Color.FromArgb( c.ToArgb() + 100 );<br />
imgDefault.SetPixel( x, y, c );<br />
}<br />
}<br />
pe.Graphics.DrawImage( imgDefault, 0, 0 );<br />
I loaded a MRI Scan image of human brain and tried to do the above work,
which threw error as:"SetPixel is not supported by Indexed pixel format"
What does it mean?
Please help me
|
|
|
|
|
SetPixel doesn't work with images with indexed pixel format. Try copying your image to a new bitmap pixel by pixel and make your changes on that bitmap
Do your best to be the best
|
|
|
|
|
Try this:
Image imgDefault;
Bitmap imgSaveForSetPixel = new Bitmap(imgDefault.Width, imgDefault.Height);
using (Graphics g = Graphics.FromImage(imgSaveForSetPixel)) {
g.DrawImageUnscaled(imgDefault, 0, 0);
}
Robert
|
|
|
|
|
hey guys, having a little trouble here...
what im trying to do is set focus to an Edit field on a different application... so im doing this, to test im using Spy++ to get the handle to a random field on a random application,
Handle: 2692780
SendMessage(hWnd, WM_SETFOCUS, IntPtr.Zero, null);
it doesnt seem to be working
ideally what i want is to bring focus to the entire process, and focus the control...
am i on the right track here?
|
|
|
|
|
Hi!
The documentation for WM_SETFOCUS states that this is a notification that's being sent to a window when it's receiving the focus, it doesn't actively set the focus!
How about using SetFocus()[^]?
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hello Friends,
I want to make AGC i.e. Automatic Gain Control OFF or ON through coding.
I have seen "KSPROPERTY_AUDIO_AGC" in the platform SDK but can't understand
how to use it.
Thanks in Advance.
Rahul Kulkarni
|
|
|
|
|
when i declared a method string getName(){return this.name}; string getAddress(){return this.address;}... get appears like blue color its means c# word, then this methods get and set how can i use them or how its use
i hope, i can explain good
Dios creo un equipo perfecto a los demas los lleno de extranjeros
|
|
|
|
|
You should use properties for this, e.g.,
public string Address
{
get
{
return this.address;
}
set
{
this.address = value;
}
}
Or, just for get.
public string Address
{
get
{
return this.address;
}
}
Kevin
|
|
|
|
|
Hello Legolas,
Actually set & get both are keyword of C#.
You can use it when you define any property for class like...
class TimePeriod
{
private double seconds;
public double Hours
{
get { return seconds / 3600; }
set { seconds = value * 3600; }
}
}
You can get more help from here.
regards,
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
If you want to use get & set you have to use a Property. (Unless you are programming in Java which don't have get & set)
It seems like you have two options.
1. To have TWO methods FOR EACH property, of get and set, eg. string getName() { return this.name; } void setName(string NewName) { this.name = NewName; }
(Just like in Java)
2. You can use it as a Property (the easyer and more comfort one), eg.:
string Name
{
get { return this.name; }
set { this.name = value; }
}
and to use it in code:
string thisname = obj1.Name;
obj1.Name = "My New Name";
(You don't use the "()" in a Property)
You can learn a little bit more if you read a little about this chapter.
Hope I helped.
NaNg.
|
|
|
|
|
using System;
class Circle
{
public int X
{
get
{
return(x);
}
set
{
x = value;
// draw the object here.
}
}
int x;
}
class Test
{
public static void Main()
{
Circle c = new Circle();
c.X = 35;
}
}
In this code, the get or set accessor is called when the property X is referenced.
Vikas Amin
EATON
PUNE
|
|
|
|
|
But whatis better using get & set or using getName();??
Dios creo un equipo perfecto a los demas los lleno de extranjeros
|
|
|
|
|
You don't have to type () with properties :P
|
|
|
|
|
|
I am using Visual Studio 2003 and C# to develop a textbox user control. In the Properties Window of the Visual Studio Editor I have a few of the public properties that the developer can select to change how the user control is going to behave and/or look. Is it possible to have some properties not available on the Properties Window until the developer has selected a value? For example the background color. If I use an enumerator to give the following values for the background color: Default, Custom
In the properties window I would like the developer to be able to choose a color if he has chosen the Custom option, but not if he has chosen the Default option.
All help will be appreciated.
Thanks
Kobus
|
|
|
|
|
Dear Respected Programmers
I need some help, Kindly convert the following code into C# which is written in VB6. because whenever I try to use said method in C# it does not work.
Thank you in Advance
Private Sub Form_Load()
Dim frmViewer As New Form2
Dim ReportObject As New CrystalReport1
objRecordSet.Open ("Select * from EMP"), objConnection, adOpenStatic, adLockReadOnly
ReportObject.Database.SetDataSource objRecordSet, 3
frmViewer.CRViewer1.ReportSource = ReportObject
frmViewer.CRViewer1.ViewReport
frmViewer.Show
End Sub
|
|
|
|
|
I am trying to understand how to hook up some event handlers. Here is an analogy to my situation: I have an object tree that represents all passenger trains in a train station. It looks like this:
<br />
Station<br />
.....Trains<br />
.........Train_0<br />
..............Cars<br />
................Car_0<br />
...................Passengers<br />
..........................Passenger_0 <br />
..........................Passenger_1<br />
.........Train_1 <br />
..............etc...<br />
Each of these objects fire events (like when passengers board a car).
I have a Form where I want to display status of Trains, Cars, Passengers etc.
I need to attach the handlers in the Form, but must be done dynamically, and I have no clue.
For testing I tried this, but I get a runtime error if the collections are empty:
<br />
Station.Trains[1].Cars[5].CarsChanged += new CarsChangedEventHandler(Cars_Changed);<br />
I have spent a good bit of time searching for info. Any suggestions would most helpful. I'm guessing that C# has an elegant solution (in lieu of my duck tape).
Thanks in advance-
|
|
|
|
|
Of course you get an error when the collection is empty, but that has nothing to do with event handlers.
You're trying to access Car number 5 when there is no Car number 5 in the collection if it's empty.
An event is usually bound to an instance of an object (there are static events, too, but they're far less common) and unless you have the instance you can't assign event handlers to it.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hi
Well if you have a tree then you can enumarate it and hook up the event handlers:
Something like this:
<br />
foreach(Train train in this.trains)<br />
foreach(Car car in train.Cars)<br />
car.CarsChanged+=new CarsChangedEventHandler(Cars_Changed);<br />
if you are building the tree dynamically you can add the event handler on the fly for example
<br />
Car car=new Car();<br />
car.CarsChanged+=new CarsChangedEventHandler(Cars_Changed);<br />
this.SelectedTrain.AddCar(car);<br />
or
<br />
public Car AddNewCarToTrain(Train train)<br />
{<br />
Car car=new Car();<br />
train.Cars.Add(car);<br />
return car;<br />
}<br />
AddNewCarToTrain(this.selectedTrain).CarsChanged+=new CarsChangedEventHandler(Cars_Changed);<br />
Regards
|
|
|
|
|
Thanks.
I am building the tree dynamically. I knew there was a way to do this, but you made it very clear.
I think I can make that work.
Squeaker
|
|
|
|
|
Hi,
Try using a index property in your objects (like Tag property for labels). And then set the same event handler for all you Cars ojects (for example) and depending on the index you can do your work. In your event handler you have a sender object. You can use something like this:
<br />
private void Cars_Changed(object sender,EventArgs e)<br />
{<br />
int index = ((Cars)object).index;<br />
}<br />
Hope it helps
Do your best to be the best
|
|
|
|
|
This is what I wanted to do, but I need a little clarification.
It looks like you are saying that all Car objects can fire the same event, and the eventArgs will include an index so I will know which car raised the event.
If that is correct, then how do I declare the same event in each Car??
Thanks
Squeaker
|
|
|
|