|
 ReHi!
Because such a flow panel could be useful for me too, I wrote a quick initial version.
You can try it out if you like:
public class FlowLayoutPanel : Panel
{
public FlowLayoutPanel()
{}
private Orientation _orient = Orientation.Horizontal;
[DefaultValue(Orientation.Horizontal)]
public Orientation Orientation
{
get { return _orient; }
set
{
_orient = value;
RecalcLayout();
Invalidate();
}
}
private void RecalcLayout()
{
if (this.Controls.Count==0)
{
this.Size = new System.Drawing.Size(100,100);
return;
}
int x=0,y=0,h=0,w=0;
if (Orientation == Orientation.Horizontal)
{
foreach (Control c in Controls)
{
if (x+c.Width > this.Width)
{
x = 0;
y = h+1;
}
c.Left = x;
c.Top = y;
h = Math.Max(h,c.Bottom);
x += c.Width;
}
this.Height = h;
}
else
{
foreach (Control c in Controls)
{
if (y+c.Height > this.Height)
{
y = 0;
x = w+1;
}
c.Left = x;
c.Top = y;
w = Math.Max(w,c.Right);
y += c.Height;
}
this.Width = w;
}
}
protected override void OnResize(EventArgs eventargs)
{
RecalcLayout();
base.OnResize (eventargs);
}
protected override void OnControlAdded(ControlEventArgs e)
{
RecalcLayout();
base.OnControlAdded (e);
}
protected override void OnControlRemoved(ControlEventArgs e)
{
RecalcLayout();
base.OnControlRemoved (e);
}
}
Regards,
mav
|
|
|
|
|
Thanks - will check it out pronto.
Mal.
|
|
|
|
|
Hi!
Does anyone know, how i can call javascript functions in a web document from a winform application. like the article JavaScript call from C++
|
|
|
|
|
how do i disable the close button on the top right corner of a window form?
chris
|
|
|
|
|
Hi Cris,
It involves P/Invoking
1.GetSystemMenu
2.GetMenuItemCount
3.RemoveMenu
4.DrawMenuBar
API methods declaration and DisableCloseButton function can be written as below:
[DllImport("user32.Dll")]
public static extern IntPtr RemoveMenu(int hMenu, int nPosition,long wFlags);
[DllImport("User32.Dll")]
public static extern IntPtr GetSystemMenu(int hWnd, bool bRevert);
[DllImport("User32.Dll")]
public static extern IntPtr GetMenuItemCount(int hMenu);
[DllImport("User32.Dll")]
public static extern IntPtr DrawMenuBar(int hwnd);
private const int MF_BYPOSITION = 0x400;
private const int MF_REMOVE = 0x1000;
private const int MF_DISABLED = 0x2;
public void DisableCloseButton(int hWnd)
{
IntPtr hMenu;
IntPtr menuItemCount;
hMenu = GetSystemMenu(hWnd, false);
menuItemCount = GetMenuItemCount(hMenu.ToInt32());
RemoveMenu(hMenu.ToInt32(), menuItemCount.ToInt32() - 1,MF_DISABLED | MF_BYPOSITION);
RemoveMenu(hMenu.ToInt32(), menuItemCount.ToInt32() - 2,MF_DISABLED | MF_BYPOSITION);
DrawMenuBar(hWnd);
}
Do revert back whether it could do the desired thing or not.
Please Note that User can also close the application using Alt+F4. you should handle that aspect as well, which can be done very easily by overriding wndProc method.
Regards,
Jay
|
|
|
|
|
If you don't need the Minimize, Maximize and Help Button simply set the Form.ControlBox property false.
www.troschuetz.de
|
|
|
|
|
HI,
i got the Tlbimp.exe at path
C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin\Tlbimp.exe
I have my Atl(COM) DLL at f:\ComDll.dll
this dll is written by me in VC++ (ATL COM wizard) it has some functions i want to use these functions in my ASP.Net net web page.
How can i Import it or use it in ASP.Net using C#.
Plz reply me urgent
at zahid_ash@hotmail.com
or
zahid_ash@yahoo.com
thanx
Regards.
|
|
|
|
|
hi,
You can easily bind com components using vs.net sdk. Go to reference folder of your project and right click to get the Add reference option. Choose that option and choose com tab. Then you can browse and locate the directry which contain your dll.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
i did that all is fine upto this.
But now in ASP.Net i Add a Button under this button Event i want to use the Function of that DLL.
say function is Test(.. ,..),, and Class is MyClass in COM DLL.
How can i use it in C# , Means how can i create the Object of that class to call the Function.
the name shown is refernce folder after adding refernce is COMDLLLib , and name is Interop.COMDLLLib.
what thew way to create object and call function
thanx
Regards.
|
|
|
|
|
hi,
Refer your dll on namespace reference location.
Like
using system;
using yourdll;
etc.
then
try to create instance on your event handler location.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
hi i m doing this but
the arror ocuur " the type or name sapce could not found"
y this is happening
thanx
Regards.
|
|
|
|
|
hi,
Otherwise would u like to try tlbimp.exe. if so i will explain.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
i tried it , but it not worked,
i added refernce from Add refernce , it is shown in refrence tree as COMDLLLib
and it also copy the dll to bin folder with name interop.COMDLL.dll.
but i cant create the object ,
plz send me any sample
thanx
Regards.
|
|
|
|
|
hi,
C:\>TLBIMP.EXE 'location of your .dll file and filename' /out: 'name of your new dll'
for eg. i am trying to import a windows .dll file into managed assembly. and the name of my new assembly and location respectively Mydll.dll and C drive
C:\>TLBIMP.EXE C:\WINDOWS\system32\webv.dll /out:mydll.dll
So my final .dll( managed assembly) wil be there in C drive.;)
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Sorry to disturb u again and again.
I did it as u said , i got finaly C:\SockDll.dll
But now how can i make its object and call mehtods uisng C# code.
Bcoz i m new to C3 and ASP.NEt
thanx
Regards.
|
|
|
|
|
hi,
Nevar a problem.
I think i already told you about reference forlder.
Right click the reference folder which is there in your asp.net application. And locate the .dll file.
After that, if you try to view the content of reference folder you will came to know u'r dll file is there in that list.
check this much and get back to me.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
yes i did it.
now SockDll is refernce folder of ASP.NET.
but i not know how create its object now unber a button event and call it method.
thanx
Regards.
|
|
|
|
|
hi,
In the namespace declaration section try to call your dll file.
like
using System;
using name of your dll;
then you will get all avilable types in button click.
Eg:
using System;
using SockDll;
private void button_clcik(object sender, System.EventArgs e)
{
SockDll.MyClass Obj=new SockDll.MyClass();
Obj.Method();
}
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
but on writing Using SockDll;
it gives error
c:\inetpub\wwwroot\WebApplication2\WebForm1.aspx.cs(2): The type or namespace name 'SockDll' could not be found (are you missing a using directive or an assembly reference?)
y it is ???
Regards.
|
|
|
|
|
tell me your .dll is not there in reference folder.
The error is because that perticular dll is there in reference folder.
please check that.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
do u have MSN ID plz come there thay may save our boths time and i can solve it. plz come online
mine is zahid_ash@hotmail.com
Refernce (Tree node) folder has the DLL
thanx
Regards.
|
|
|
|
|
Hi all,
I have a datatable, which I want to query by using LIKE operator like we do in SQL
SQL
Select * from Tab1 where col1 LIKE '%xyz%'
C#
datatable dt
dt.select(...)
Is it possible in C#. Please advice
Thanks
Ruchi
|
|
|
|
|
Yes, it is possible. Check here[^] for an explanation and examples.
Paul Lyons, CCPL Certified Code Project Lurker
|
|
|
|
|
dear paul,
please re-check whether it is working in table select.
dataset.Table[0].Select("Disp==%sdsd%");
(forget abt the above syntax).
It is not working for me..
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Paul,
I know how to use Select with DataTable. I couldn't find any example for LIKE operator from the link that you specified.
Could you please point out specific example out of that link.
Thanks
Ruchi
|
|
|
|