|
hye all,
How do I mask my image such that i got the masked image. For example i want to mask round shape and discard the background. Anyone could guide me?
|
|
|
|
|
Pdaus wrote: Anyone could guide me?
Yup. Help yourself to any one of these[^] bad boys.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Good Day All
i have a function that builds a Dataset from 3 Xml Files. Let me take this time to explain the xml files.
There is Subjects.xml, this xml contains all the subjects and i have XML_Venue.xml that contains all the venues and i have TimeTableFull.xml it contains the times,Venues that the subjects will be attended at. Now that means TimeTableFull.xml has many occurances of subjects but on Different venues or same venues but different times. The Following code builds a dataset from the xml's
private DataSet CreateDataSet()
{
DataColumn[] keys = new DataColumn[1];
DataSet dsFinalTimeTable = new DataSet();
DataTable tbldt;
tbldt = new DataTable("Subjects");
XmlDataDocument xmlDatadocStaff = new XmlDataDocument();
xmlDatadocStaff.DataSet.ReadXml(@"J:\Pilot Project\App_Data\Subjects.xml");
tbldt = xmlDatadocStaff.DataSet.Tables["Subjects"];
keys = new DataColumn[1];
keys[0] = tbldt.Columns["ID"];
tbldt.PrimaryKey = keys;
dsFinalTimeTable.Tables.Add(tbldt.Copy());
tbldt = new DataTable("Venue");
XmlDataDocument xmlDatadocVenue = new XmlDataDocument();
xmlDatadocVenue.DataSet.ReadXml(@"J:\Pilot Project\App_Data\XML_Venue.xml");
tbldt = xmlDatadocVenue.DataSet.Tables["VENUE"];
keys = new DataColumn[1];
keys[0] = tbldt.Columns["ID"];
tbldt.PrimaryKey = keys;
dsFinalTimeTable.Tables.Add(tbldt.Copy());
tbldt = new DataTable("TimeTable");
XmlDataDocument xmlDatadocTimeTable = new XmlDataDocument();
xmlDatadocTimeTable.DataSet.ReadXml(@"J:\Pilot Project\App_Data\TimeTableFull.xml");
tbldt = xmlDatadocTimeTable.DataSet.Tables[0];
keys = new DataColumn[1];
keys[0] = tbldt.Columns["ID"];
tbldt.PrimaryKey = keys;
dsFinalTimeTable.Tables.Add(tbldt.Copy());
DataRelation VenuesRelations = new DataRelation("VenueRel", dsFinalTimeTable.Tables["Venue"].Columns["ID"], dsFinalTimeTable.Tables["Appointment"].Columns["ID"]);
DataRelation ModuleRelations = new DataRelation("ModuleRel",dsFinalTimeTable.Tables["Subjects"].Columns["ID"],dsFinalTimeTable.Tables["Appointment"].Columns["subjectid"]);
dsFinalTimeTable.Relations.Add(VenuesRelations);
dsFinalTimeTable.Relations.Add(ModuleRelations);
return dsFinalTimeTable;
}
and my problems comes when i have have to add relations on the module relations
dsFinalTimeTable.Relations.Add(ModuleRelations);
i receive the Following error
This constraint cannot be enabled as not all values have corresponding parent values
and i tried to use this line of code to remove this integrity enforcement
dsFinalTimeTable.EnforceConstraints = false;
and this left me with an empty grid and this does not look correct.
Can someone assist me. i have attached the 3 xml files.
http://www.vbforums.com/attachment.php?attachmentid=79604&d=1280784905
http://www.vbforums.com/attachment.php?attachmentid=79605&d=1280784953
http://www.vbforums.com/attachment.php?attachmentid=79606&d=1280785001
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/
|
|
|
|
|
Hi Vuyiswa,
Please correct the data's of subjectid column in Appointment table (TimeTableFull.xml). It contains wrong values that should match the
'ID' column values of subjects table.
Thanks,
Gopal.S
|
|
|
|
|
Thank you very much. That was the case
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/
|
|
|
|
|
Hello guys,
First, I don't want to use OwnerDraw, that is a condition I have .
What I want is set a custom color to the selection of a listview. I want the color to be visible even if the listview is not focused.
I know about the HideSelection member, but that's not what I need.
I tried to overrwrite the onselectionindexchanged, and make the item.selected=false, and after that, set a custom back/fore color. This does not work because I have multiple items, and it deselects all items but one.
I need one of 2 things:
a)Keep selection visible (with blue color, not gray, this is the problem with HideSelection) always
b)Remember selected objects, but do not show the selection at all (because if the selection is visible, than the custom back/fore color are not visible), so I can "mimic" the selection by setting a custom back/fore color to the items.
Now I have been spending over 4 hours now on this stupid issue, and no luck. Anyone has a suggestion? It would help a lot.
*******************solution
Instead of setting the color in the on selected changed event, we can do it on mouse up. It's not perfect, but it's the best I got. The best way to do this is using a custom draw listview. Here is the code:
List<int> selections=new List<int>();
protected override void OnMouseUp(MouseEventArgs e)
{
selections = this.SelectedIndices.Cast<int>().ToList();
this.SelectedIndices.Clear();
for (int i = 0; i < this.Items.Count; i++)
{
if (this.selections.Contains(i))
this.Items[i].BackColor = Color.Blue;
else
this.Items[i].BackColor = Color.White;
}
base.OnMouseUp(e);
}
modified on Monday, August 2, 2010 9:01 PM
|
|
|
|
|
sodevrom wrote: a)Keep selection visible (with blue color, not gray, this is the problem with HideSelection) always
That's by design; whatever is focused is drawn in the "selected" color. That way I can (as a user) visually differentiate between the ListView that's focused (and will react to keyboard-input) and which won't. If both were using blue, it would imply that both have the input-focus. That's not possible in Windows, since there can only be one active control with input-focus.
There's no "neat" way to do this. Why no owner-drawing btw?
sodevrom wrote: b)Remember selected objects, but do not show the selection at all (because if the selection is visible, than the custom back/fore color are not visible), so I can "mimic" the selection by setting a custom back/fore color to the items.
Remembering selected objects can be done by adding them to a generic list, whenever you select one. Sounds like you want to replace the default multiselect by your own version?
I are Troll
|
|
|
|
|
Hello,
I know this is possible because I seen it in action somewhere.
I do not want to use owner draw, because I would have to implement tons of things, and I still want the list to look exactly like in windows (with the theme from windows).
Still waiting for some suggestions.
Thanks!
|
|
|
|
|
sodevrom wrote: I know this is possible because I seen it in action somewhere
Yup, it's possible
sodevrom wrote: I do not want to use owner draw, because I would have to implement tons of things
You want non-standard behavior, and that has to be implemented somewhere. Owner-drawing might sound like overkill, especially if you've been looking at examples that draw a lot manually. The example on MSDN[^] looks rather short and might do the trick.
sodevrom wrote: and I still want the list to look exactly like in windows
Make sure you're using the SystemColors[^] when drawing.
I are Troll
|
|
|
|
|
I'm not sure I understand your question fully, but I think you can set the Enabled Property to true and the Readonly property to true also.
Apologies in advance if I have misunderstood your question.
ragnaroknrol The Internet is For Porn[^]
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
Hi,
I don't think you understand exactly what I want. I simply want to view the selection in blue always (with multiple items), even if the listview has no focus. In a normal case, when the listivew loses focus, the selection turns gray, and you can't see it good.
|
|
|
|
|
Create your own list view and your own list view items. This is the easiest way to get the results you desire. In fact, it would have taken less than 4 hours, I bet.
|
|
|
|
|
Hello,
Thanks for the suggestion, I was trying to avoid this...
|
|
|
|
|
This is a very basic solution, but here it is anyway:
private List<int> selections = new List<int>();
private bool dontChange = false;
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
if (!dontChange)
{
dontChange = !dontChange;
int selectedIndex = listView2.SelectedIndices[0];
listView1.SelectedIndices.Clear();
if (selections.Contains(selectedIndex))
{
selections.Remove(selectedIndex);
listView1.Items[selectedIndex].BackColor = Color.White;
}
else
{
selections.Add(selectedIndex);
listView1.Items[selectedIndex].BackColor = Color.Blue;
}
}
else
{
dontChange = !dontChange;
}
}
of course this only works if you're selecting one item at a time. If you're doing an extended selection (meaning using Ctrl or Shift to select items) it wouldn't work because when you click the first time, it will add the item, then when you click the second time, it tries to make all of the items selected, which would deselect the first item. You'd have to include some key checking to see if Ctrl or Shift was down.
|
|
|
|
|
Hello,
I tried something like you said, before posting on this forum, but I don't think it's going to work.
Now the problem is when selecting multiple items (by dragging). It can work only with 1 item, but if you have multiple items, and remove one item at a time from the SelectedIndices, it will call the event again and again. Don't know exactly how to explain.
Thanks anyways
|
|
|
|
|
Just a quick thought. The easiest way for this to work would be to "overwrite" the SystemColors . If it's possible to change the unfocused selection color form gray to blue, all my issues would have been solved...
|
|
|
|
|
You could write your own control?
Create a user control and add a panel with with background and add labels one below the other, you can provide a property that allows to set the background of the labels. Add some internal logic to maintain selection, colors, text, indexes, etc...
Should be less then 4 hours to get you going.
V.
|
|
|
|
|
A form with a LinkLabel control and set the form's KeyPreview to true.
when press [Enter], the linkLabel's linkLabel1_LinkClicked event is called, but the form's Form1_KeyDown event is not called.
I debug the program, but I can not find why the form cannot get the [Enter]'s keydown event, can any one help me? Or, there is a good tools to see the form event called one by one?
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication3 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
int i = 0;
}
private void Form1_KeyDown(object sender, KeyEventArgs e) {
int j = 0;
}
private void Form1_KeyPress(object sender, KeyPressEventArgs e) {
int i = 0;
}
private void linkLabel1_Click(object sender, EventArgs e) {
int i = 0;
}
}
}
|
|
|
|
|
Hi , Don't use "linkLabel1_LinkClicked"
Use this "linkLabel1_MouseClick"
private void linkLabel1_MouseClick(object sender, MouseEventArgs e)
{
}
AND : Optional , not necessary :
Avoid using KeyDown, KeyPress , KeyPreview
Just past this in your form body code
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
case Keys.Enter:
{
MessageBox.Show("You KeyDowned Enter Key!");
}
break;
}
return base.ProcessCmdKey(ref msg, keyData);
}
I know nothing , I know nothing ...
|
|
|
|
|
hi
i need to get data from .csv file to access
it works excellent but i have one problem.
when i try to get : IS-43"39"36"24
i receive: "IS-43""39""36""24"
some code:
while (SW.Peek() != -1)
{
TEMP = (SW.ReadLine());
TEMP = TEMP.Replace("'", " ");
char[] BI = { ',' };
string[] WI = TEMP.Split(BI);
A = WI[0].Trim().ToString();
B = WI[1].Trim().ToString().Replace (";"," ");
C = WI[2].Trim().ToString();
SQL = "INSERT INTO Items(barcode,des,numh) VALUES('" + A + "','" + B + "','" + C + "')";
Cmd = new OleDbCommand(SQL, Conn);
Cmd.ExecuteNonQuery();
Cmd.Dispose();
}
what can be the problem ?
thank's in advance
|
|
|
|
|
string sqlStatement = "INSERT INTO items (barcode, des, numh) VALUES (@a, @b, @c);";
...
command.Paramaters.Add("@a", SqlDataTypegoesHere).Value = wi[0];
command.Paramaters.Add("@b", SqlDataTypegoesHere).Value = wi[1];
command.Paramaters.Add("@c", SqlDataTypegoesHere).Value = wi[2];
...
command.Execute();
Btw, clean up your code. It's a mess.
|
|
|
|
|
Hi
I`m running a simple application that acts as a portal for users to go to various sites such as Gmail and Facebook. I have a SQL database running in the background where I store all user passwords etc. At the moment, users access this application from 2 computers, meaning there are 2 databases. Thus, if a user updates his/her details on the one computer, it does not get reflected in the other database. Is there a way I can share a single SQL database between these 2 client computers? They are connected over a network.
|
|
|
|
|
Etienne_123 wrote: Is there a way
Yes, it's called SQL Server after all.
However, I don't think storing passwords is a good idea.
|
|
|
|
|
Thanks. Just wanted to know before I started searching all over. I`m encrypting the passwords before storing them in the database though. Plus, its a prototype application run at an old age home, so security isn't my main priority, user-friendliness is.
|
|
|
|
|
If you are in the United States and "old folks home" qualifies as Health Care which means the data you are accessing, storing, and retrieving falls under HIPPA which is security intensive.
|
|
|
|
|