GVKun编程网logo

重拾VB6(24):Using Graphical Controls

6

在这篇文章中,我们将为您详细介绍重拾VB6的内容,并且讨论关于24:UsingGraphicalControls的相关问题。此外,我们还会涉及一些关于201810-708(CMU)Probabilis

在这篇文章中,我们将为您详细介绍重拾VB6的内容,并且讨论关于24:Using Graphical Controls的相关问题。此外,我们还会涉及一些关于2018 10-708 (CMU) Probabilistic Graphical Models {Lecture 11} [CRF (Cont'd) + Intro to Topic Models]、2018 10-708 (CMU) Probabilistic Graphical Models {Lecture 21} [A Hybrid: Deep Learning and Graphical Models]、Bootstrap3 - Using glyphicon as background image in CSS、c# – WPF Caliburn.Micro和TabControl与UserControls问题的知识,以帮助您更全面地了解这个主题。

本文目录一览:

重拾VB6(24):Using Graphical Controls

重拾VB6(24):Using Graphical Controls

来自MSDN-2001-OCT: Visual Tools and Languages/Visual Studio 6.0 Documentation/Visual Basic Documentation/Using Visual Basic/Programmer’s Guide/Part 2: What Can You Do With Visual Basic/Working with Text and Graphics/

1. Using Graphical Controls

(1) The image,line,and shape controls are very useful for creating graphics at design time,and they require fewer system resources than other Visual Basic controls.

(2) Pictures can be displayed in three places in Visual Basic applications: On a form; In a picture Box; In an image control.

(3) 设计时插图的话,图会被直接编到exe里;而运行时插图的话,自己要负责把图打包到exe里。

(4)

Category Properties
display processing AutoRedraw,ClipControls
Current drawing location CurrentX,CurrentY
Drawing techniques DrawMode,DrawStyle,DrawWidth,BorderStyle,BorderWidth
Filling techniques FillColor,FillStyle
Colors BackColor,ForeColor,BorderColor,FillColor

2. Creating Persistent Graphics with AutoRedraw

(1) AutoRedraw is a Boolean property that,when set to True,causes graphics output to be saved in memory. You can use the AutoRedraw property to create persistent graphics.

(2) You can include code in the Paint event for a form or picture Box that redraws all lines,circles,and points as appropriate. This approach usually works best when you have a limited amount of graphics that you can reconstruct easily.

(3) A Paint event procedure is called whenever part of a form or picture Box needs to be redrawn — for example,when a window that covered the object moves away,or when resizing causes graphics to come back into view. If AutoRedraw is set to True,the object’s Paint procedure is never called unless your application calls it explicitly. The visible contents of the object are stored in the memory canvas,so the Paint event isn’t needed.

(4) You can change the setting of AutoRedraw at run time. If AutoRedraw is False,graphics and output from the Print method are written only to the screen,not to memory. If you clear the object with the Cls method,any output written when AutoRedraw was set to True does not get cleared. This output is retained in memory,and you must set AutoRedraw to True again and then use the Cls method to clear it.

3. Clipping Regions with ClipControls

(1) Clipping is the process of determining which parts of a form or container are painted when the form or container is displayed.

(2) When the ClipControls property is True,Windows defines a clipping region for the background of the form or container before a Paint event. This clipping region surrounds all nongraphical controls.

(3)

(4) Since calculating and managing a clipping region takes time,setting ClipControls to False may cause forms with many nonoverlapping controls (such as complex dialog Boxes) to display faster.

4. Layering Graphics with AutoRedraw and ClipControls

(1) As you create graphics,keep in mind that graphical controls and labels,nongraphical controls,and graphics methods appear on different layers in a container.

(2) Combining settings for AutoRedraw and ClipControls and placing graphics methods inside or outside the Paint event affects layering and the performance of the application..

(3)

(4) Confining graphics methods to the Paint event causes those methods to paint in a predictable sequence.

5. Moving Controls Dynamically

(1) You can either directly change the properties that define the position of a control or use the Move method.

(2) Using the Left and Top Properties

(3) Moving a Line Control using X1,X2,Y1,Y2 properties

(4) Using the Move Method可以控制movement的速度(从而平滑度)和距离。

6. Resizing Controls Dynamically

Align,Height,Width,AutoSize,Stretch,

7. Creating Simple Animation

(1) Toggling Between Two Pictures

(2) Rotating Through Several Pictures

2018 10-708 (CMU) Probabilistic Graphical Models {Lecture 11} [CRF (Cont'd) + Intro to Topic Models]

2018 10-708 (CMU) Probabilistic Graphical Models {Lecture 11} [CRF (Cont'd) + Intro to Topic Models]

分享图片

 

 

分享图片

 

分享图片

 

分享图片

 

 

 

分享图片

 

 

分享图片

分享图片

 

 

 

 

分享图片

 

 

分享图片

 

分享图片

 

  

分享图片

分享图片

 

 

分享图片

2018 10-708 (CMU) Probabilistic Graphical Models {Lecture 21} [A Hybrid: Deep Learning and Graphical Models]

2018 10-708 (CMU) Probabilistic Graphical Models {Lecture 21} [A Hybrid: Deep Learning and Graphical Models]

分享图片

分享图片

 

 

分享图片

 

 

分享图片

 

 

分享图片

 

 

分享图片

 

 

分享图片

 

 

分享图片

 

分享图片

 

 

分享图片

 

 

分享图片

 

 

分享图片

 

 

分享图片

分享图片

 

分享图片

 

分享图片

 

分享图片

 

 

 

分享图片

 

分享图片

 

 

分享图片

分享图片

 

  

 

分享图片

 

分享图片

 

分享图片

 

分享图片

 

 

分享图片

conent in green Box difficult to solve

 

分享图片

 

分享图片

 

分享图片

 

 

分享图片

分享图片

 

 

分享图片

 

 

 

分享图片

 

 

分享图片

https://www.youtube.com/watch?v=btr1poCYIzw&t=60s

Bootstrap3 - Using glyphicon as background image in CSS

Bootstrap3 - Using glyphicon as background image in CSS

总结

以上是小编为你收集整理的Bootstrap3 - Using glyphicon as background image in CSS全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

c# – WPF Caliburn.Micro和TabControl与UserControls问题

c# – WPF Caliburn.Micro和TabControl与UserControls问题

我很确定这已经在某个地方得到回答,但我似乎找不到我的生活.

我试图使用TabControl在UserControls之间切换(每个选项卡是不同的,所以不使用Items)

以下是故障:
我有我的主视图和3个用户控件. Mainview有一个选项卡控件 – 每个选项卡应显示不同的用户控件.

我可以很容易地将tabcontrol contect设置为用户控件使用

但是它不是绑定到viewmodel,只是视图.

所以我在我的VM和ActivateItem中使用Conductor.这是开始变得奇怪/令人沮丧的地方.应用程序从Tab0选择开始,但是Tab2(最后一个选项卡)的内容.单击任何其他选项卡,为该选项卡加载正确的viewmodel.点击回到Tab0,加载正确的内容.

如何让它停止?另外,如果切换选项卡不会再次重新初始化视图模型,清除已经输入的字段,我真的很喜欢它.

无论如何,这里是我的一些资料来源,我打算把这个放在这里,然后再打破我的鼠标,再尝试其他的东西.

视图:

<TabControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row ="1">
        <TabItem Header="PC information">
            <Grid>
                <ContentControl x:Name="LoadRemoteInfo" cal:View.Model="{Binding ActiveItem}"/>
            </Grid>
        </TabItem>
        <TabItem Header="Remote Tools">
            <Grid>
                <ContentControl x:Name="LoadRemotetools" cal:View.Model="{Binding ActiveItem}"/>
            </Grid>
        </TabItem>
        <TabItem Header="CHRemote">
            <Grid>
                <ContentControl x:Name="LoadCHRemote" cal:View.Model="{Binding ActiveItem}"/>
            </Grid>
        </TabItem>

    </TabControl>

和viewmodel:

class Mainviewmodel : Conductor<object>
{
    RemoteInfoviewmodel remoteInfo = new RemoteInfoviewmodel();
    Remotetoolsviewmodel remotetools = new Remotetoolsviewmodel();
    CHRemoteviewmodel chRemote = new CHRemoteviewmodel();

    public Mainviewmodel()
    {
        ActivateItem(remoteInfo);
    }

    public void LoadRemoteInfo()
    {
        ActivateItem(remoteInfo);
    }

    public void LoadRemotetools()
    {
        ActivateItem(remotetools);
    }

    public void LoadCHRemote()
    {
        ActivateItem(chRemote);
    }
}

解决方法

我可以建议一条不同的路线吗?

这是我在大师细节场景中成功的事情.假设你有一个子视图模型的集合.我将为所有这些项目准备一个标记界面,当然,如果有这样的方法跨越所有子视图模型,您可以添加您认为合适的属性/方法:

public interface IMainScreenTabItem : IScreen
{
}

您可以确定您希望所有的小孩模型都是屏幕(或者在嵌套场景下,导体).它使它们具有可用的完整初始化/激活/停用周期.

然后,孩子视图模型:

public sealed class ChRemoteviewmodel : Screen,IMainScreenTabItem
{
    public ChRemoteviewmodel()
    {
        displayName = "CH Remote";
    }
}

public sealed class PcInfoviewmodel : Screen,IMainScreenTabItem
{
    public PcInfoviewmodel()
    {
        displayName = "PC Info";
    }
}

public sealed class Remotetoolsviewmodel : Screen,IMainScreenTabItem
{
    public Remotetoolsviewmodel()
    {
        displayName = "Remote Tools";
    }
}

displayName将显示为标题文本.这是一个很好的做法,使这些类密封,因为displayName是一个虚拟属性,并且在没有密封的类的构造函数中调用虚拟方法是一个很大的no-no.

然后,您可以添加相应的视图并设置IoC容器的首选注册 – 您必须将所有子视图模型注册为实现IMainScreenTabItem的类,然后:

public class Mainviewmodel : Conductor<IMainScreenTabItem>.Collection.OneActive
{
    public Mainviewmodel(IEnumerable<IMainScreenTabItem> tabs)
    {
        Items.AddRange(tabs);
    }
}

MainView.xaml只是:

<TabControl Name="Items"/>

它只是工作.如果您的子视图模型具有多个依赖关系(例如数据库访问,记录器,验证机制等),那么它也是非常好的和方便的解决方案,现在您可以让IoC做所有的重大工作,而不是手动实例化.

有一件事情在这里:标签将按照注册类的顺序放置.如果您想要控制订单,可以通过传递自定义IComparer< IMainScreenTabItem>在Mainviewmodel构造函数中对它们进行排序.或添加一些属性您可以OrderBy或选择到IMainScreenTabItem界面.默认选择的项目将是“项目”列表中的第一个项目.

其他选项是使Mainviewmodel具有三个参数:

public Mainviewmodel(ChRemoteviewmodel chRemoteviewmodel,PcInfoviewmodel pcInfo,Remotetoolsviewmodel remotetools)
{
    // Add the view models above to the `Items` collection in any order you see fit
}

虽然你有超过2 – 3个儿童视图模型(你可以轻松获得更多),它会快速凌乱.

关于’清算’部分.由IoC创建的视图模型与常规生命周期一致:它们被初始化为最多一次(OnInitialize),然后在每次导航到OnDeactivate(bool)时被禁用,并在导航到(OnActivate)时激活. OnDeactivate中的bool参数指示视图模型是否刚刚停用或完全“关闭”(例如,当您关闭对话窗口并导航时).如果您完全关闭视图模型,则会在下一次显示时重新初始化.

这意味着在OnActivate调用之间保留任何绑定的数据,您必须在OnDeactivate中显式清除它.此外,如果您保持对子视图模型的强烈引用,则即使在调用OnDeactivate(true)之后,数据仍将在下次初始化时存在 – 这是因为IoC注入视图模型已创建一次(除非您注入工厂以Func< Yourviewmodel>形式的功能),然后根据需要初始化/激活/停用.

编辑

关于bootstrapper,我不太清楚你正在使用什么样的IoC容器.我的样品使用了SimpleInjector,但是你可以像这样简单地做同样的事情. Autofac:

public class AppBootstrapper : Bootstrapper<Mainviewmodel>
{
    private Container container;

    /// <summary>
    /// Override to configure the framework and setup your IoC container.
    /// </summary>
    protected override void Configure()
    {
        container = new Container();
        container.Register<IWindowManager,WindowManager>();
        container.Register<IEventAggregator,EventAggregator>();
        var viewmodels =
            Assembly.GetExecutingAssembly()
                .DefinedTypes.Where(x => x.GetInterface(typeof(IMainScreenTabItem).Name) != null && !x.IsAbstract && x.IsClass);
        container.Registerall(typeof(IMainScreenTabItem),viewmodels);
        container.Verify();
    }

    /// <summary>
    /// Override this to provide an IoC specific implementation.
    /// </summary>
    /// <param name="service">The service to locate.</param><param name="key">The key to locate.</param>
    /// <returns>
    /// The located service.
    /// </returns>
    protected override object GetInstance(Type service,string key)
    {
        if (service == null)
        {
            var typeName = Assembly.GetExecutingAssembly().DefinedTypes.Where(x => x.Name.Contains(key)).Select(x => x.AssemblyQualifiedname).Single();

            service = Type.GetType(typeName);
        }
        return container.GetInstance(service);
    }

    protected override IEnumerable<object> GetAllInstances(Type service)
    {
        return container.GetAllInstances(service);
    }

    protected override void BuildUp(object instance)
    {
        container.InjectProperties(instance);
    }
}

注意配置中的viewmodels注册.

今天关于重拾VB624:Using Graphical Controls的分享就到这里,希望大家有所收获,若想了解更多关于2018 10-708 (CMU) Probabilistic Graphical Models {Lecture 11} [CRF (Cont'd) + Intro to Topic Models]、2018 10-708 (CMU) Probabilistic Graphical Models {Lecture 21} [A Hybrid: Deep Learning and Graphical Models]、Bootstrap3 - Using glyphicon as background image in CSS、c# – WPF Caliburn.Micro和TabControl与UserControls问题等相关知识,可以在本站进行查询。

本文标签: