|
|
I'm new to C# and new to programming in general, so please forgive me if I don't have my nomenclature down. I'd like to recreate one of my favorite utilities, Vitrite, a tiny open source program that allows you to right-click on any window, make it "always on top" and adjust its transparency. I've been reading up on hooking and writing background services, but I'm having some trouble finding a good primer explaining how to define properties for a global system object (is that the correct term?), or even if that's possible in C#.
To clarify, in case I'm not wording it correctly, I want to be able to define focus for any window that opens on my system. I'm teaching myself, so I'm happy to figure out the details on my own, but if anyone could get me pointed in the right direction, I'd appreciate it.
Thanks!
modified on Saturday, September 26, 2009 10:37 PM
|
|
|
|
|
If I understand the technique correctly, this is not possible to do in C# because it doesn't support the exports required in .DLL's to inject code.
|
|
|
|
|
hi
how i can fill collection from database and connect this collection to ComboBox ?
thank's in advance
|
|
|
|
|
Create the Data Source From DB. Set DataSource And DataMember Properties of Combobox. Thats All
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Any way you like; have at it.
|
|
|
|
|
Hello,
How can i create an icon (like in MSN) when the user launch the application?
and to close it he have to close it from the TaskBar?
thank alot...
|
|
|
|
|
|
Thanks abhijit its nice
Shafik
|
|
|
|
|
By the task bar I assume you mean the system tray.
You need to handle the FormClosing event and add a NotifyIcon.
In the FormClosing, check if the form is Visible. If true, then hide the form, show the notify icon and set e.Cancel to true.
All that's left to do then is add a context menu to the notify icon so you can provide a way to exit and handle left/right/double click on the notify icon for unhiding the form and hiding the icon.
|
|
|
|
|
First select all product from database
private DataTable ShowProduct()
{
string mach = "select ID,Name from product";
cmd = new SqlCommand(mach,con);
adt = new SqlDataAdapter(cmd);
ds = new DataSet();
adt.Fill(ds);
return ds.Tables[0];
}
-----------------------------------------------------------------
Second build funtion create id auto
private int AutoID() //funtion create auto id
{
DataTable dt = new DataTable();
dt=ShowProduct(); //datatable store list id
int ma=-1;
int row = -1;
string mach1="";
int i = 0;
if (dt.Rows.Count > 0) //at least one id
{
int[] id = new int[dt.Rows.Count];
foreach (DataRow mach in dt.Rows) //assigned id in string array
{
ma++;
row++;
mach1 = dt.Rows[row][0].ToString();
id[ma] = Convert.ToInt32(mach1.Substring(2)); //get string index=2 to end converter int assigned id in string array
}
for (int j = 0; j < id.Length; j++) //create auto id
{
i++;
if (id[0] != 1) //first id !=1 set id =0
{
i = i - 1;
break;
}
if (id[j] > i) //id[j] != id[j-1]+1 set id=id[j-1]
{
i = id[j - 1];
break;
}
}
}
return i + 1; //return id need create
}
---------------------------------------------------------------
Using
private void bttInsert_Click(object sender, EventArgs e)
{
int id = AutoID(); ////Using
string idpro = "SP" + id.ToString().PadLeft(4, '0');
txtID.Text = idpro;
if (bttInsert.Text == "Insert")
{
txtName.Clear();
bttInsert.Text = "Save";
}
else
{
if (txtName.Text != "")
{
InsertSP(idpro, txtName.Text);
dgvShowSP.DataSource = ShowProduct();
bttInsert.Text = "Insert";
}
else
MessageBox.Show("Bạn chưa nhập tên sản phẩm");
}
}
Link download demo
CreateAutoID.rar
|
|
|
|
|
why dont you use GUID all the time.. Most useful for Primary Key....
|
|
|
|
|
I'm sorry, I speak English very bad. I idea every time user add product id auto create, information user fill out rest. I don't know GUID.
You can explain to me what the GUID?
|
|
|
|
|
You should be creating your own AutoIDs in the first place. They should be created by the database when you insert new records, not your code.
|
|
|
|
|
Every body should download demo and run. Every body will understand my idea.
|
|
|
|
|
Theres lots of info about adding buttons to title bar, like this: http://www.codeproject.com/KB/cs/mintraybtn.aspx
But ive seen a couple programs that can add a button like that to every windows window. Like an nvidia(IIRC) app which added a button next to the minimize on EVERY window. Now i need to be able to that, plus assign some code to the button.
Thanks guys.
Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
That would suck; keep it off my system. 
|
|
|
|
|
I need to create characters of the people as requirement of my application, I'm thinking of making cartoons from real life images, I see this done in some facebook application, how should I do this, I have done grayscale and that does not produce the result I need.
Any advice ?
Also tried box blur filter, but effect is not as desired
modified on Saturday, September 26, 2009 12:15 PM
|
|
|
|
|
Those sort of filters tend to be complex, they are certainly not a filter you can create by changing values in a convolution filter. You need to understand the theory behind it and write dedicated code to the effect you're trying to create.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi.
I'm gonna take the DateTime of 24 hours former with C# , I've written below code :
DateTime _24HoursFormer
{
get { return new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day - 1, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); }
}
But whenever DateTime.Now.Day equals 1, it throws an Exception !!
Could you guide me ?
Thanks.
|
|
|
|
|
Doesn't DateTime.Now.AddHours(-24) looks cleaner?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Thanks a lot.
I didn't know it 
|
|
|
|
|
d@nish wrote: Doesn't DateTime.Now.AddHours(-24) looks cleaner?
IMO the logical approach would be DateTime.Now.AddDays(-1)
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Especially since subtracting hours may not work on days with leap seconds or 25 hours.
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: Especially since subtracting hours may not work on days with leap seconds or 25 hours.
There are no days with 25 hours, only ones with 24.
|
|
|
|