|
I need to create a panel and button with smooth edges.
I would really appreciate if any one have any ideas or sample code.
Thanks,
Mahank
|
|
|
|
|
Have you tried searching CodeProject? Some of the Aquabuttons[^] here are really smooth
|
|
|
|
|
Robert,
Thanks for the link. I will definitely look into it.
Madhavi
|
|
|
|
|
I have been scouring Google for hours on this and can't find anything useful.
I have been wonmdering if there is a way to assign a transparent color (like Color.Transparent) for web graphics, basically a nice little class that would return a true transparent color, rather than having to run the entire image through a class to set a particular color transparent.
Or, barring that, a nice clean chunk of C# code that can be used to set the transparency to a particular color. 98% of what I have seen has so much garbage code in it it is hard to discern where the actual transparency code resides.
I would usually sit and hammer the hell out of messier code that I have managed to find, but I dont really have time to sit and play with it (which is a real shame. I love playing with image code)
Any ideas?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
In what way should this be specific for web graphics?
Color.Transparent is a transparent color, why can't you use that?
---
b { font-weight: normal; }
|
|
|
|
|
When creating a Dynamic web image, for some reason, the browser does not actually render Color.Transparent as transparent. it usually seems to set it to black, which can be a problem.
I think it is because it handles the images by default as Bitmaps, rather than a gif (even though that has been specified) and the bitmap format doesnt support transparency (at least in .net)
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
Are you really sure that it handles the image as bitmap? Bitmap images are windows specific and uncompressed, so they are very impractical for web purposes.
---
b { font-weight: normal; }
|
|
|
|
|
here is an example of the code for a pretty simple image:
Response.ContentType = "image/gif";<br />
<br />
Bitmap bm = new Bitmap(300,300);<br />
Graphics gp = Graphics.FromImage(bm);<br />
<br />
Rectangle re = new Rectangle(0,0,300,300);<br />
SolidBrush br = new SolidBrush(Color.FromArgb(255,0,0,0));<br />
<br />
gp.FillRectangle(br,re);<br />
<br />
<br />
<br />
SolidBrush br2 = new SolidBrush(Color.Tomato);<br />
gp.FillEllipse(br2,75,75,150,150);<br />
<br />
gp.SmoothingMode = SmoothingMode.HighQuality;<br />
bm.MakeTransparent(Color.FromArgb(255,0,0,0));<br />
bm.Save(Response.OutputStream, ImageFormat.Gif);<br />
gp.Dispose();<br />
bm.Dispose();
this sits in the Page_Load of an aspx page. Notice that the object that is created and output is fundamentally a bitmap (which isnt actually windows specific), but is then output in gif format.
Color.Transparent works just fine for windows forms (win32 apps), but not so great for web graphics.
I have played with some classes others have created for making transparent gifs, but so far they are either terribly messy or hit-or-miss.
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
Have a look at this[^].
---
b { font-weight: normal; }
|
|
|
|
|
Awesome. I just modified it a little to work with my code, and it did. Thank you
how did you find that?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
Heyas all,
I have project that has a mainform and on it is a read-only textbox control. I have another source file that hold a class I made myself. I'm trying to access the textbox control that is on the mainform from my class file, and I keep getting erros that it's inacceble. The code wizard automatically creates the control as private. I have a method in my class that simply does this:
void vWriteToTextbox(void)<br />
{<br />
}<br />
and like I said it's not working. How can I access the control from my file (which of course is in the same project)?
Thanks,
John
|
|
|
|
|
John L. DeVito wrote: How can I access the control from my file
Why would you want to do this?
You can either make the control varialbe "textbox1" public , or create a get-function (or property) to return the textbox variable like this:
public TextBox box { get { return textbox1; } }
You also need to have a reference to your main form, you can't just do MainForm.something unless something is declared static
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Okay, the easy way to fix this is select the TextBox in the form designer and change the value of the Design >> Modifiers property to public .
While that's the easy way, it breaks the encapsulation principle of OOD. May I suggest creating a property in your main form that exposes the value of the TextBox ?
For example, in your main form's class declaration, provide the following declaration.
public string MyInterestingTextBoxValue
{
set
{
this.textBox1.Text = value;
}
} Then, you can change your method above to
private void vWriteToTextbox()
{
MainForm.MyInterestingTextBoxValue = "Hello";
}
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Thanks Curtis I like the idea of wrapping it in a property. I know I could have changed the access identifier but I really REALLY didn't want to do that. Appreciate the time, works great. Thanks again.
Thanks,
John
|
|
|
|
|
John, my pleasure. Hope all turns out well. Happy coding!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Heyas Curtis,
I've actually come across a bit of a problem, VS is saying that in order for me to set this property value I must have an instantiated object. I don't understand that. the MainForm is going to be instantied when it runs. Here's my code:
In MainForms Class description I have...
<br />
internal String txtStatusValue{ set{ this.txtStatus.Text = value;}}<br />
and then in my class file I have..
<br />
internal void vMyFunction()<br />
{<br />
MainForm.txtStatusValue = "Blah Blah Blah";<br />
}<br />
I don't get it, could I trouble you for but more assistance?
Thanks,
John
|
|
|
|
|
sounds like your calling the txtStatusValue before the mainform is instantiated or before the variable you're using to call the mainform propery is initialized.
do something like this:
public class MainForm: Form
{
public static MainForm myMainForm = null;
public MainForm()
{
myMainForm = this;
}
internal public string txtStatusValue { set { txtStatus.Text = value; } }
}
public MyClass
{
public void someFunc()
{
MainForm.myMainForm.txtStatusValue = "foo";
}
}
hope this helps...
|
|
|
|
|
If I have a function in dll generated by managed C++, how do I pass arrays in C# so that I can get my output array back?
Any help is appreciated!
Devin
|
|
|
|
|
What do you mean? Your question keeps many details unsaid. If you have a C++.NET DLL with a function like
void YourClass::MyFunc( double [] dArray ){...}
Why can't you call that function from C# directly like
...<br />
double [] dArray = new double [ 10 ];<br />
YourClass yc = new YourClass();<br />
yc.MyFunc( dArray );<br />
...
If your question is more complex than that, you will get better responses if you elaborate...
Koushik Biswas
|
|
|
|
|
Thanks Koushik!
It is then pretty natural.
Devin
|
|
|
|
|
Hi all,
I have developed a dll in Win32. That dll finds the updated regions
of the desktop and then post these regions data to a C# application
using PostThreadMessage(). But problem is here i m not so much use to
with C# so i havent any idea how can i get it from the Application
message queue of my C# application.
Thanx
|
|
|
|
|
In C#, you typically don't deal with the Win32 message queue. The .NET framework is designed to abstract away the underlying operating system & hardware. So, if you're listening for when a user moves his mouse over your System.Windows.Forms.Form, just setup an event handler for the MouseMove event.
Form myForm = new Form();
myForm.MouseMove += new MouseEventHandler(MyMouseMoveFunction);
...
void MyMouseMoveFunction(object sender, MouseEventArgs arguments)
{
}
That said, if you want to get low level, past the abstractions, you can create a class that inherits from System.Windows.Forms.Form, then override the WndProc virtual method; that method is called every time your form receives a windows message.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
|
Dear u r quite right that i can track mouse movements. But here is the
different case my dll is a hooking dll and is responsible for getting
screen display updates. So here i m restricted to use that unmanaged
dll.
I have passed dll the managed thread id so that dll can post messages
of screen updates to my C# application.
Is it right to pass a managed thread id in PostThreadMessage()?
Thanx for ur response.
|
|
|
|
|
Does the WebBrowser control introduced in .NET 2.0 work fine with console applications? I'm facing problems doing something like
string x = "<HTML>abc</HTML>";
browser.DocumentText = x;
Unfortunately, x never gets set, browser.DocumentText always remains as <HTML> </HTML>
On a hunch, I tried doing an Application.DoEvents right after setting the DocumentText property and it worked. Does that mean there is no *easy* way to use the WebBrowser just for inspecting and manipulating the DOM tree?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|