|
I think that windows doesn't support PPAB in controls... I'm not sure but I what you want to do is impossible...
|
|
|
|
|
|
I got the same problem 2-3 month ago, the solution was:
1.Take a bitmap of the control before windows draw it.
2.Use it in GDI+ as a background
Unfortunatly Microsoft Windows leaks in this particular area... so if anyone know how to create a alpha blended control post here.
Hope this helps.
|
|
|
|
|
Ok, in 1 week here and on usenet the problem wasn't resolved... Ok is impossible.
|
|
|
|
|
Umberto Giacobbi wrote:
Ok, in 1 week here and on usenet the problem wasn't resolved... Ok is impossible.
You cant give up in a week! Imagine MS got stuck with getting the MSDOS cursor to blink in a week and binned the idea.
There is a "solution" but it's way to slow to even use....
Give them a chance! Do it for the kittens, dear God, the kittens!
|
|
|
|
|
I am trying to simply dclick on a treeview icon and get the associated imagelist entity (a .JPG) to become the actual Image on a picturebox.
I am getting hamstrung on the conversion of a System.Drawing.Graphics object (required for the ImageList1.Draw) to an System.Drawing.Image so I can assigne it to the Picturebox1.Image.
I plan to do additional manipulation of the Picturebox1.Image.
Here is the code, assuming a valid ImageList, Treeview, and Picturebox.
private void ilTracks_DDClick(object sender, System.EventArgs e)
{
//make a graphics object
System.Drawing.Graphics g = PictureBox1.CreateGraphics();
//draw the ImageList image to the Graphic
//note: this sends the correct graphic to the picturebox, but the PictureBox1.Image property is still NULL on the picturebox...
ImageList1.Draw( g, 0, 0, TreeView1.SelectedNode.SelectedImageIndex);
//What do I need here??
//PictureBox1.Image = ????
}
Thanks any and everyone for your time.
Sandy White
|
|
|
|
|
Hi,
Bitmap bit1 = new Bitmap( pictureBox1.Width, pictureBox1.Height);
Graphics graph1 = Graphics.FromImage(bit1);
graph1.DrawXXX();
pictureBox1.Image = bit1;
Just get the Graphic object from the Bitmap
Give them a chance! Do it for the kittens, dear God, the kittens!
|
|
|
|
|
The code you sent me via email worked great! Posting it here.
Thanks! Sandy
Image temp = (Image)pictureBox1.Image.Clone(); // create a copy of the Image
Bitmap bit1 = new Bitmap(pictureBox1.Width, pictureBox1.Height); //create a
buffer
Graphics graph1 = Graphics.FromImage(bit1); //make a NEW object from the bm
object...
graph1.RotateTransform(52.0F); //rotate drawstart (canvas)
graph1.DrawImage (temp, 0, -pictureBox1.Width); //draw the image onto rotate
canvas (Graphics)
pictureBox1.Image = bit1; //does show the rotated image. alignment needs
work, but that won be too hard
Cheers
|
|
|
|
|
Hi,
I have three TextBox and one Button controls. I disable the button when the form loaded and would like to make it enabled when each textbox has input. At this point, I put following code in each textbox_textChanged event:
<br />
if(textbox1.text.length!=0 && textbox2.text.length !=0 && textbox2.text.length !=0)<br />
button1.enabled = true;<br />
Is there any other way that I don't have to duplicate above codes in each textbox which I would like to check? I appreciate it!!
|
|
|
|
|
Yes!
Create a method that does this, then go to the form designer, select one of your text boxes, click the little lightning (properties) button above the properties, find the correct event in the list, then use the drop-down next to it to select your method.
Then repeat for your other text boxes.
This attaches the same function to each of the three delegates. Neat. I do the same thing on a web form.
Paul
|
|
|
|
|
Oh, I see the "I put each in the textBox_textChanged method" thing. Duh! Don't read my post...
Your bullshit is so effusive I can smell it across oceans...
You impress no-one. You are a world-class sleazeball; an incomparable jerk. No-one is fooled by your idiotic attempts to slant votes.
-A. N. Onymous on Bill SerGio
|
|
|
|
|
Yes, it is neat and does save me lots of typing
But if I would like to do little bit different for each text_changed event, how do I do? Can I attach more than one method for each event?
Thanks!!
|
|
|
|
|
Yes, it is neat and does save me lots of typing
But if I would like to do little bit different for each text_changed event, how do I do? Can I attach more than one method for each event?
Thanks!!
|
|
|
|
|
[All code in this message is untested]
D Shen wrote:
But if I would like to do little bit different for each text_changed event, how do I do? Can I attach more than one method for each event?
Yes, but it has to be done manually.
Go to the form constructor, right underneath TODO: Add any constructor code after InitializeComponent call and add something like the following:
this.textButtonX.TextChanged += new System.EventHandler(this.MySecondaryMethod); However, be careful. If you attach two methods to one Delegate, I can't guarantee what order they will run in or even that they will run in the same sequence each time. A lot of testing is in order here.
Unless the extra code is unrelated and it doesn't matter which sequence you run in, it might be much safer to simply have a method that works like this:
private bool AllEmpty()
{
return ((textBox1.Text.Length + textBox2.Text.Length + textBox3.Text.Length) == 0)
} then use
button1.Enabled = !AllEmpty() in three different event handlers.
Paul
|
|
|
|
|
doesn't this cause the form to update on each text update?
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
Shaun Wilde wrote:
doesn't this cause the form to update on each text update?
On a web form: yes, in a manner of speaking, though you can skip the update code. Page_Load is called, which I think is your question.
On a windows form: no, it simply fires the TextChanged event. Form_Load is not called.
Paul
|
|
|
|
|
You could iterate through the controls collection of the Form to find it for all the textboxes. I think this'll work:
bool validate = true;<br />
foreach(Textbox txt in this.Controls)<br />
{if(txt.Text = "") validate = false;}
if(validate) button1.Enabled = true;
That way, if any one of them is false, then your button doesn't get enabled. I'm sure there's a better way to do it though...
Your bullshit is so effusive I can smell it across oceans...
You impress no-one. You are a world-class sleazeball; an incomparable jerk. No-one is fooled by your idiotic attempts to slant votes.
-A. N. Onymous on Bill SerGio
|
|
|
|
|
David Stone wrote:
bool validate = true;
foreach(Textbox txt in this.Controls)
{if(txt.Text = "") validate = false;}
That would work if only TextBoxes were on the form.
Rather:
foreach (Control ctrl in Controls){
TextBox txt = ctrl as TextBox;
if (txt != null && txt.Text == "") validate = false;
}
Give them a chance! Do it for the kittens, dear God, the kittens!
|
|
|
|
|
leppie wrote:
foreach (Control ctrl in Controls){ TextBox txt = ctrl as TextBox; if (txt != null && txt.Text == "") validate = false;}
Thanks for the code. Do I still put the code in each text_changed event? Thanks!
|
|
|
|
|
This wont really work unless u have only the 3 text boxes (other controls welcome)in question on the form I was just trying to point out that u will get a cast exception if you dont check the type. I would definately go with the other option.
Assigned for all 3 ontextchanged events. Obviously, you will need some reset code as well.
if (tb1.Text == "" || tb2.Text == "" || tb3.Text == "" ) validate = false;
Or place the 3 textboxes in a panel
Give them a chance! Do it for the kittens, dear God, the kittens!
|
|
|
|
|
Does anyone have a working example of a WebControl that supports DataBinding via its DataSource property.
I've tried the MS example and it doesn't work - cut&paste+compile.
I was also offered some code from an MS representitive on a newsgroup but even though it all works during design time it doesn't set the DataSource property at Runtime - I am assuming its missing a final step but I can't see what it could be.
MS example[^]
Google news thread[^]
I would also like to add a DataMember using the DataMemberConverter as well (and some DataFields using the DataFieldConverter for good measure) At the moment my code works fine but I can't bind to it nicely via the properties window.
Thanks
Shaun
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
Just a thought; but when you tried the code he gave what was the assembly's filename?
It is important that the second part of this attribute Designer("DataSourceControl.MyDataDesigner,DataSourceControl") gives the name of the assembly it is defined in.
Whenever you see something declared as "Namespace.TypeName, AnotherName" you can probably assume that 'AnotherName' is supposed to be the name of the assembly (without the .DLL or .EXE).
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
I changed that line so that it matched my assembly name - as I said the designer works at design time - its just that the DataSource doesn't get bound to the dataset at runtime eventhough it is marked to so so in the HTML DataSource="<%# dsLanguages1 %>
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
Ok, I see now that when I replied I thought the copy/paste+compile was for the code he gave you; not the example
I have zero experience in creating web controls and databinding so that was the only thing I could offer
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
actually it was for both - examples should be in straight from the tin format or it should be noted where changes should be made - I had to spend time to get them to work - it would have been easier if he has used typeof - instead of strings as it would be easier to see the errors. In the end I only had to change the designer lines in both examples - but still no dice - glad for you input though
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|