WPF Control Base
import clr
clr.AddReference("PresentationFramework")
clr.AddReference("PresentationCore");
clr.AddReference('WindowsBase')
clr.AddReference('System.Data')
clr.AddReference('System.ComponentModel')
import System
from System import *
from System.Data import *
from System.Threading.Tasks import *
from System.ComponentModel import *
from System.Windows import *
from System.Windows.Controls import *
from System.Windows.Controls.Primitives import *
from System.Windows.Media import *
from System.Windows.Media.Imaging import *
from System.Windows.Media.Effects import *
from System.Windows.Shapes import *
from System.Windows.Data import *
from System.Windows.Ink import *
from Microsoft.Win32 import ( OpenFileDialog, SaveFileDialog )
class WpfCtrl():
def init(self):
self.ctrl.Margin = Thickness(5)
self.ctrl.Padding = Thickness(1)
def set_width(self,v): self.ctrl.Width = v
def set_height(self,v): self.ctrl.Height = v
def set_margin(self,l,t,r,b): self.ctrl.Margin = System.Windows.Thickness(l,t,r,b)
def shadow_effect(self):
from System.Windows.Media.Effects import DropShadowBitmapEffect
self.ctrl.BitmapEffect = DropShadowBitmapEffect()
def set_fontsize(self,size):
self.ctrl.FontSize = size
def set_tooltip(self,tooltip):
tip = ToolTip()
tip.Content = tooltip
self.ctrl.ToolTip = tip
def set_menu(self,menu):
#menu = ContextMenu()
self.ctrl.ContextMenu = menu
def set_filedrop(self,handler):
SetFileDropHandler(self.ctrl,handler)
댓글 없음:
댓글 쓰기