|
Hi,
I'm using picturebox to show some images that my application hold.
I want to mark with some square part of my image ( mark in the code ).
How can i do it ?
Thanks.
P.S I'm using simple winform (not WPF)
|
|
|
|
|
You'll need to create a watermarked version of the Image before setting it into the PictureBox control.
/ravi
|
|
|
|
|
Maybe you want something like the following:
Graphics g = Graphics.FromImage(pb.Image);
g.DrawRectangle(Pens.Red, pbleft, pbtop, pbwidth, pbheight);
g.Dispose();
This will draw a red rectangle in your image. Is that what you want?
|
|
|
|
|
I don't think the PictureBox will even be aware you did that. You would have to reload the image or otherwise signal it about the change.
BTW: I think PictureBoxes are crap anyway, one should not even try and do such complex things to them.
|
|
|
|
|
That's probably true. In that case
Image im = pb.Image;
Graphics g = Graphics.FromImage(im);
g.DrawRectangle(Pens.Red, pbleft, pbtop, pbwidth, pbheight);
g.Dispose();
pb.Image = im;
|
|
|
|
|
I have to Get data from database and fill data into ListBox using javascript. I did like below
var strConn = 'Provider=SQLOLEDB;server=localhost;user id=sa;pwd=***;initial catalog=xxx;';
var cn = new ActiveXObject("ADODB.Connection");
cn.open(strConn);
var rs = new ActiveXObject("ADODB.Recordset");
rs.Open('SELECT EmpId,Name FROM Employee', cn);
rs.MoveFirst
while(!rs.eof)
{
var opt = document.createElement("Option");
opt.text = rs.fields(1);
opt.value = rs.fields(0);
document.getElementById(ListBoxCtrlName).options.add(opt);
rs.movenext;
}
rs.close;
cn.close;
This is working fine in IE only when access datasource across domains enabled otherwise listbox not getting data.How can I fix this issue in IE And FireFox
|
|
|
|
|
Try posting this in the Javascript forum?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
As mentioned you should have posted this to the JavaScript forum.
ActiveXObject is an IE object and not officially supported in FireFox, AFAIK. Most importantly though you are exposing the details of your database, username, password, table, table structure; a huge breach of security.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Oh jeez, not only a conn string in javascript, but a conn string with an sa password!
Looks like im going to be employed for the foreseeable future.
|
|
|
|
|
If you had done little search on internet, you would have found the answer.
Here is your solution.
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
Good Day All
I have a Class that is defined like this
namespace EAVV
{
public class EAV
{
private string _Attribute;
private string _Value;
public string Attribute
{
get
{
return _Attribute;
}
set
{
_Attribute = value;
}
}
public string Value
{
get
{
return _Value;
}
set
{
_Value = value;
}
}
public EAV(string AttributeEA, string ValueEA)
{
this._Attribute = AttributeEA;
this._Value = ValueEA;
}
public EAV()
{
}
}
}
And I have another one to process this like this
namespace EAVV
{
public class EAVProcess
{
public List<EAV> GetRecords(List<string> ParentRecords,List<string> ChildRecords)
{
List<EAV> Final= new List<EAV>();
for (int i = 0; i < ParentRecords.Count; i++)
{
for (int J = 0; J < ChildRecords.Count; J++)
{
Final.Add(new EAV(ParentRecords[i], ChildRecords[J]));
}
}
return Final;
}
public EAVProcess()
{
}
}
}
And as you can see this will return a list. So I am binding my Grid(Telerik) which is the same as binding the normal asp.net grid like this
RadGrid1.DataSource = EAVobj.GetRecords(ParentRecordsRow, ChildRecordsField);
RadGrid1.DataBind();
And I get the Following Data
http://www.telerik.com/ClientsFiles/212012_grid-hierachy.JPG[^]
from the Image, You can see there is an Attribute Column and there is a Value Column, Now what i want to do is that i want to have only one Country and one Event in the Attribute and the Values must be nested underneath each other in a Grid, so basically i need a nested View and the Attribute is the parent and the Values will be grouped according to their parent.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
If I am not mistaking this may solve your purpose
namespace EAVV
{
public class EAVProcess
{
public List<EAV> GetRecords(List<string> ParentRecords,List<string> ChildRecords)
{
List<EAV> Final= new List<EAV>();
for (int i = 0; i < ParentRecords.Count; i++)
{
--Put a check for child records exists and add
Final.Add(new EAV(ParentRecords[i], ChildRecords[0]));
--Start looping from 2nd J = 1 instead of 0
for (int J = 1; J < ChildRecords.Count; J++)
{
--remove ParentRecords[i]
Final.Add(new EAV("", ChildRecords[J]));
}
}
return Final;
}
public EAVProcess()
{
}
}
}
|
|
|
|
|
This is wonderful
Thank you very much you are a star
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi,
I wrote some simple class with 3 fields ( lets say that the fields are RGB ).
and i have some UI to define the value of those fields.
The UI is on class A and the class with the RGB values is in other class.
Now, I want to do binding between those two classes -
I mean that i want to do 'auto update' if the value in the UI change - and this 'auto update' will set the field value.
How can i do it ?
Thanks.
|
|
|
|
|
In your RGB class:
Inherit iNotifyPropertyChanged
create the Notifychange event
Create the properties for RGB
Implement the InotifyChanged in the setter
In you UI
Instantiate the RGB class
add a databinging to the controls binding to the rgb properties in that class
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi
I want to problematically determine if mysql is installed on my machine or not.
Please help
|
|
|
|
|
I'd try WMI and look for the MySQL service.
|
|
|
|
|
|
It's something like:
System.Management.ManagementScope oMs = new System.Management.ManagementScope(@"\\localhost");
oMs.Path.NamespacePath = @"root\cimv2";
string query = "select * From Win32_Service Where Name Like \"%mysql%\"";
System.Management.ObjectQuery oQuery = new System.Management.ObjectQuery(query);
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMs, oQuery);
ManagementObjectCollection oReturnCollection = oSearcher.Get();
foreach (ManagementObject oReturn in oReturnCollection)
{
foreach (PropertyData propertyData in oReturn.Properties)
{
txtResult.Text += string.Format("{0}: {1}\r\n", propertyData.Name, propertyData.Value);
}
}
This writes all information available on all services containing "mysql" in their name into textbox "txtResult".
Note also the "State" and "Started" properties.
|
|
|
|
|
sumit7034 wrote: I want to problematically determine...
really?
it could be installed but not running, so maybe it is better to check for a process, with a name that contains "mysql"; the exact name may depend on the implementation, my XAMPP package launches a "mysqld" process.
See Process.GetProcessesByName()
|
|
|
|
|
Is it possible Inherit an internal class to a public class in C# class library
|
|
|
|
|
No. You can reduce accessibility, but you cannot increase it. Otherwise, what would be the point?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
No. Why don't you try it?
Visual Studio will give you an "Inconsistent accessibility: base class xyz2 is less accessible than class xyz1" error when both classes are in the same source file.
|
|
|
|
|
thanx,
yup, i tried and got error msg.
Then pls let me know, what will be the use of internal class in class library(any real time eg)
mean signification reason of using internal class in class library
|
|
|
|
|
a class can be useful without being inherited; so could be a nested class, however an internal one is usable in several classes within the same source file.
|
|
|
|